UPDATE: Media module
All checks were successful
Build and Release / release (push) Successful in 1m7s

This commit is contained in:
2026-04-05 22:25:43 +07:00
parent eb404b37e9
commit 2d36004ac7
24 changed files with 1972 additions and 94 deletions

View File

@@ -362,6 +362,294 @@ const docTemplate = `{
}
}
},
"/media": {
"get": {
"description": "Search media with filters, pagination",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Search media",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "Search keyword",
"name": "keyword",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.PaginatedResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/presigned": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Generate a presigned URL for direct upload to storage",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Generate presigned URL",
"parameters": [
{
"type": "string",
"description": "File name",
"name": "filename",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Content type",
"name": "contentType",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/presigned/complete": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Confirm that upload via presigned URL is completed",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Confirm presigned upload",
"parameters": [
{
"type": "string",
"description": "Storage key",
"name": "key",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/upload": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Upload media file through server",
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Upload media (server-side)",
"parameters": [
{
"type": "file",
"description": "Upload file",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/{id}": {
"get": {
"description": "Retrieve a media file by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Get media by ID",
"parameters": [
{
"type": "string",
"description": "Media ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a media file by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Delete media",
"parameters": [
{
"type": "string",
"description": "Media ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/roles": {
"get": {
"security": [
@@ -601,7 +889,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
"$ref": "#/definitions/history-api_internal_dtos_response.PaginatedResponse"
}
},
"400": {
@@ -653,6 +941,40 @@ const docTemplate = `{
}
}
},
"/users/current/media": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve media list of the currently authenticated user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Get current user's media",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
@@ -793,6 +1115,44 @@ const docTemplate = `{
}
}
},
"/users/{id}/media": {
"get": {
"description": "Retrieve media list by specific user ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Get user's media by user ID",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/users/{id}/password": {
"patch": {
"security": [
@@ -1166,6 +1526,29 @@ const docTemplate = `{
}
}
},
"history-api_internal_dtos_response.PaginatedResponse": {
"type": "object",
"properties": {
"data": {},
"message": {
"type": "string"
},
"pagination": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": "string"
}
}
},
"status": {
"type": "boolean"
}
}
},
"history-api_pkg_constants.TokenType": {
"type": "integer",
"format": "int32",
@@ -1179,7 +1562,7 @@ const docTemplate = `{
"TokenPasswordReset",
"TokenEmailVerify",
"TokenMagicLink",
"TokenRefreshToken"
"TokenUpload"
]
}
},

View File

@@ -355,6 +355,294 @@
}
}
},
"/media": {
"get": {
"description": "Search media with filters, pagination",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Search media",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "Search keyword",
"name": "keyword",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.PaginatedResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/presigned": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Generate a presigned URL for direct upload to storage",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Generate presigned URL",
"parameters": [
{
"type": "string",
"description": "File name",
"name": "filename",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Content type",
"name": "contentType",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/presigned/complete": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Confirm that upload via presigned URL is completed",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Confirm presigned upload",
"parameters": [
{
"type": "string",
"description": "Storage key",
"name": "key",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/upload": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Upload media file through server",
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Upload media (server-side)",
"parameters": [
{
"type": "file",
"description": "Upload file",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/media/{id}": {
"get": {
"description": "Retrieve a media file by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Get media by ID",
"parameters": [
{
"type": "string",
"description": "Media ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a media file by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Media"
],
"summary": "Delete media",
"parameters": [
{
"type": "string",
"description": "Media ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/roles": {
"get": {
"security": [
@@ -594,7 +882,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
"$ref": "#/definitions/history-api_internal_dtos_response.PaginatedResponse"
}
},
"400": {
@@ -646,6 +934,40 @@
}
}
},
"/users/current/media": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve media list of the currently authenticated user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Get current user's media",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
@@ -786,6 +1108,44 @@
}
}
},
"/users/{id}/media": {
"get": {
"description": "Retrieve media list by specific user ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Get user's media by user ID",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/users/{id}/password": {
"patch": {
"security": [
@@ -1159,6 +1519,29 @@
}
}
},
"history-api_internal_dtos_response.PaginatedResponse": {
"type": "object",
"properties": {
"data": {},
"message": {
"type": "string"
},
"pagination": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": "string"
}
}
},
"status": {
"type": "boolean"
}
}
},
"history-api_pkg_constants.TokenType": {
"type": "integer",
"format": "int32",
@@ -1172,7 +1555,7 @@
"TokenPasswordReset",
"TokenEmailVerify",
"TokenMagicLink",
"TokenRefreshToken"
"TokenUpload"
]
}
},

View File

@@ -150,6 +150,21 @@ definitions:
status:
type: boolean
type: object
history-api_internal_dtos_response.PaginatedResponse:
properties:
data: {}
message:
type: string
pagination:
properties:
has_more:
type: boolean
next_cursor:
type: string
type: object
status:
type: boolean
type: object
history-api_pkg_constants.TokenType:
enum:
- 1
@@ -162,7 +177,7 @@ definitions:
- TokenPasswordReset
- TokenEmailVerify
- TokenMagicLink
- TokenRefreshToken
- TokenUpload
info:
contact:
email: support@swagger.io
@@ -398,6 +413,191 @@ paths:
summary: Verify a security token
tags:
- Auth
/media:
get:
consumes:
- application/json
description: Search media with filters, pagination
parameters:
- description: Page number
in: query
name: page
type: integer
- description: Items per page
in: query
name: limit
type: integer
- description: Search keyword
in: query
name: keyword
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.PaginatedResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
summary: Search media
tags:
- Media
/media/{id}:
delete:
consumes:
- application/json
description: Delete a media file by ID
parameters:
- description: Media ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Delete media
tags:
- Media
get:
consumes:
- application/json
description: Retrieve a media file by its ID
parameters:
- description: Media ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
summary: Get media by ID
tags:
- Media
/media/presigned:
get:
consumes:
- application/json
description: Generate a presigned URL for direct upload to storage
parameters:
- description: File name
in: query
name: filename
required: true
type: string
- description: Content type
in: query
name: contentType
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Generate presigned URL
tags:
- Media
/media/presigned/complete:
post:
consumes:
- application/json
description: Confirm that upload via presigned URL is completed
parameters:
- description: Storage key
in: query
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Confirm presigned upload
tags:
- Media
/media/upload:
post:
consumes:
- multipart/form-data
description: Upload media file through server
parameters:
- description: Upload file
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Upload media (server-side)
tags:
- Media
/roles:
get:
consumes:
@@ -551,7 +751,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
$ref: '#/definitions/history-api_internal_dtos_response.PaginatedResponse'
"400":
description: Bad Request
schema:
@@ -654,6 +854,31 @@ paths:
summary: Update user profile
tags:
- Users
/users/{id}/media:
get:
consumes:
- application/json
description: Retrieve media list by specific user ID
parameters:
- description: User ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
summary: Get user's media by user ID
tags:
- Users
/users/{id}/password:
patch:
consumes:
@@ -777,6 +1002,27 @@ paths:
summary: Get current user profile
tags:
- Users
/users/current/media:
get:
consumes:
- application/json
description: Retrieve media list of the currently authenticated user
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Get current user's media
tags:
- Users
securityDefinitions:
BearerAuth:
description: Type "Bearer " followed by a space and JWT token.