Skip to content

The Media-Service handles the storage, retrieval, and management of media files like images and banners for the application.

Notifications You must be signed in to change notification settings

sympoll/media-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

media-service

Table of Contents

1. About
2. Architecture

3. Error Codes
4. Notes


1) About

The Media Service is a RESTful API for storage, retrieval, and management of media files like images and banners for the application.


2) Architecture

2.1) Ports

  • Service port: 8086

  • Database port: 5436


2.2) Media Service Schema

The database schema includes the following tables:

 CREATE TABLE images (
        id      SERIAL PRIMARY KEY,
        name    VARCHAR(255),
        type    VARCHAR(255),
        data    BYTEA
    );

2.3) Endpoints

BASE URL: /api/media.

All calls to this service must start with the base URL. Any additional URL fields will be specified if relevant.


2.3.1) Upload user profile picture

  • Method: POST

  • Endpoint: /user/upload-profile-picture

  • Description: Upload a user's profile picture to the service.

  • Query Parameters:

    • file (MultipartFile) – The profile picture.
    • {
        "ownerUserId": "uuid"
      }
  • Response:

{
    "message": "string",
    "imageUrl": "string",
    "imageName": "string",
    "type": "string"
}
  • Response HTTP Status:
    • 200 OK – Picture successfully uploaded.

2.3.2) Upload user banner picture

  • Method: POST

  • Endpoint: /user/upload-banner-picture

  • Description: Upload a user's banner picture to the service.

  • Query Parameters:

    • file (MultipartFile) – The banner picture.
    • {
        "ownerUserId": "uuid"
      }
  • Response:

{
    "message": "string",
    "imageUrl": "string",
    "imageName": "string",
    "type": "string"
}
  • Response HTTP Status:
    • 200 OK – Picture successfully uploaded.

2.3.3) Upload group profile picture

  • Method: POST

  • Endpoint: /group/upload-profile-picture

  • Description: Upload a group's profile picture to the service.

  • Query Parameters:

    • file (MultipartFile) – The profile picture.
    • {
        "ownerUserId": "uuid"
      }
  • Response:

{
    "message": "string",
    "imageUrl": "string",
    "imageName": "string",
    "type": "string"
}
  • Response HTTP Status:
    • 200 OK – Picture successfully uploaded.

2.3.4) Upload group banner picture

  • Method: POST

  • Endpoint: /group/upload-banner-picture

  • Description: Upload a group's banner picture to the service.

  • Query Parameters:

    • file (MultipartFile) – The banner picture.
    • {
        "ownerUserId": "uuid"
      }
  • Response:

{
    "message": "string",
    "imageUrl": "string",
    "imageName": "string",
    "type": "string"
}
  • Response HTTP Status:
    • 200 OK – Picture successfully uploaded.

2.3.4) Get image

  • Method: GET

  • Endpoint: /id

  • Description: Retrieves the image by its ID.

  • Path Variable:

    • id (Long) – The image's ID.
  • Response:

    • ret (byte[]) – A byte array of the retrieved image.
  • Response HTTP Status:

    • 200 OK – Image successfully retrieved.

    • 404 Not Found – Image with the specified ID not found.


3) Error Codes

  • 400 Bad Request – The request could not be understood or was missing required parameters.

  • 404 Not Found – The specified resource could not be found.

  • 500 Internal Server Error – An error occurred on the server.


4) Notes

  • Make sure to include the Content-Type: application/json header in your requests.

  • Use valid UUIDs in your requests.

About

The Media-Service handles the storage, retrieval, and management of media files like images and banners for the application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages