Newer
Older
# Media library service
## Features
FORESTIER Fabien
committed
This service allows you to upload a file on the [Minio](https://min.io/) instance (compatible with S3) of your choice. The file will be stored in the bucket defined in the configuration of the service. It also stores some metadataabout the file in a mongo database.
## Dependencies
FORESTIER Fabien
committed
This service needs a running instance of Minio in order to work.
## Endpoints
For this service we implemented a custom health indicator that checks the connection to MinIO giving the total number of buckets when the connection is succesful.
## Implementation

The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. The service uses the [Javascript MinIO SDK](https://docs.min.io/docs/javascript-client-quickstart-guide.html) to interact with a running instance of Minio.
Before uploading the file, it makes sure that the specified bucket is created. If this is not the case, it creates it with a `public read access`.
The files are folded in sub-buckets as following `/<specified-bucket-name>/<year-YYYY>/<month-MM>/`.
FORESTIER Fabien
committed
The uploaded file keep its original name but is prefixed with the id of the corresponding entry in the mongo database.