-
Notifications
You must be signed in to change notification settings - Fork 0
API
POST localhost:3000/api/upload
Upload a video file to the AWS S3 bucket and save metadata in a postgres database. Uses multer-s3 for uploads. Multer configuration can be found in api/src/middleware/upload.ts
Headers:
Content-Type: multipart/form-data
Authorization: Bearer <TOKEN>
Body:
file: <filepath>
faceBlur: boolean
backgroundBlur: boolean
curl --request POST \
--url http://localhost:3000/api/upload \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: multipart/form-data' \
--form 'file=<FilePath>' \
--form faceBlur=<Bool>\
--form backgroundBlur=<Bool>
Sample Response:
{
"file": {
"fieldname": "file",
"originalname": "roller_Trim.mp4",
"encoding": "7bit",
"mimetype": "video/mp4",
"size": 1538487,
"bucket": "my-bucket",
"key": "roller_Trim.mp4",
"acl": "private",
"contentType": "application/octet-stream",
"contentDisposition": null,
"contentEncoding": null,
"storageClass": "STANDARD",
"serverSideEncryption": null,
"metadata": {
"fieldName": "file"
},
"location": "https://my-bucket.my-bucket.s3.us-east-1.amazonaws.com/roller_Trim.mp4",
"etag": "\"73432a279f3\""
},
"blurType": "NO_BLUR",
"userId": 2
}
GET localhost:3000/api/video_list/list
Gets a list of video metadata for each video in the Prisma database
Headers:
Content-Type: application/json; charset=utf-8
Sample Response:
[
{
"id": 1,
"name": "file_example_MP4_480_1_5MG.mp4",
"type": "NO_BLUR",
"uploaderId": 1,
"dateUploaded": "2022-12-08T20:18:46.308Z",
"uploader": {
"id": 1,
"email": "[email protected]",
"password": "$2b$10$yHaQZJcfEmZp/2wF2SswmOgI87sgcDDVFlA/QyS9PdXNXN7lmqahC"
},
"tags": []
},
{
"id": 2,
"name": "sample-mp4-file-small.mp4",
"type": "NO_BLUR",
"uploaderId": 1,
"dateUploaded": "2022-12-08T22:10:38.344Z",
"uploader": {
"id": 1,
"email": "[email protected]",
"password": "$2b$10$yHaQZJcfEmZp/2wF2SswmOgI87sgcDDVFlA/QyS9PdXNXN7lmqahC"
},
"tags": []
}
]
GET localhost:3000/api/video
Gets a presigned url to access a private video object in s3
Headers:
Content-Type: application/json
Body:
key: String
Sample Response:
"https://tecl-private-testing.s3.us-east-2.amazonaws.com/file_example_MP4_480_1_5MG.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA24N6DJTDLNVG7EHC%2F20221208%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20221208T224442Z&X-Amz-Expires=3600&X-Amz-Signature=44dda7945a4adcb9704fde795675a2a4003eb6543469d05fdd4b3ba091f0d6e3&X-Amz-SignedHeaders=host&x-id=GetObject"
PATCH http://localhost:3000/api/video_list/tags/:videoId
Set tags for a video
Headers: N/A
curl --request GET 'http://localhost:3000/api/video_list/tags/'
Sample Response:
{
"tags": [
"test"
]
}
GET http://localhost:3000/api/video_list/tags/
Gets a list of all active tags for videos in the system
Headers:
Content-Type: application/json
Body:
tags: Array of Strings
curl --location --request PATCH 'http://localhost:3000/api/video_list/tags/1' \
--header 'Content-Type: application/json' \
--data-raw '{
"tags": [
"new_tag",
"tag1"
]
}'
Sample Response:
{
"id": 1,
"name": "name",
"type": "FACE_BLURRED",
"uploaderId": 1,
"dateUploaded": "2022-12-08T18:33:11.187Z",
"tags": [
{
"id": 2,
"name": "new_tag"
},
{
"id": 3,
"name": "tag1"
}
]
}
POST http://localhost:3000/api/register/
Registers a user
Headers:
Content-Type: application/json
Body:
email: String password: String
curl --location --request PATCH 'http://localhost:3000/api/register/' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "password123"
}'
Sample Response:
{
status: 'succeeded',
token: jwt.sign(
{ id: user.id,
email: user.email } ?? '',
JWT_SECRET
)
}
POST http://localhost:3000/api/login/
Logs in an existing user (sends validated token), otherwise returns no such user could be found
Headers:
Content-Type: application/json
Body:
email: String password: String
curl --location --request PATCH 'http://localhost:3000/api/login/' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "password123"
}'
Sample Response:
{
status: 'success',
token: jwt.sign(
{ id: user.id,
email: user.email } ?? '',
JWT_SECRET
)
}