chore: remove direct avatar upload endpoint (POST /profile/avatar);
feat: add endpoints for presigned upload URLs (GET /upload/avatar, GET /upload/image); refactor: replace ProfileDto with NewProfileDto in update profile endpoint; feat: implement S3 integration for avatar management; fix: update database queries to handle new avatar upload flow; chore: add new dependencies for S3 handling (golang.org/x/time); refactor: rename UploadService to S3Service; refactor: change return type for func LocalizeS3Url(originalURL string) (*url.URL, error); feat: add custom validator for upload_id
This commit is contained in:
@@ -314,7 +314,7 @@
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ProfileDto"
|
||||
"$ref": "#/definitions/dto.NewProfileDto"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -328,42 +328,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/profile/avatar": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JWT": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Profile"
|
||||
],
|
||||
"summary": "Upload an avatar",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
"description": "Avatar image file",
|
||||
"name": "file",
|
||||
"in": "formData",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Uploaded image url",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.UrlDto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/profile/settings": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -491,14 +455,97 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/upload/avatar": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JWT": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Upload"
|
||||
],
|
||||
"summary": "Get presigned URL for avatar upload",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Presigned URL and form data",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.PresignedUploadResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/upload/image": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JWT": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Upload"
|
||||
],
|
||||
"summary": "Get presigned URL for image upload",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Presigned URL and form data",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.PresignedUploadResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"dto.ProfileDto": {
|
||||
"dto.NewProfileDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"avatar_upload_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"bio": {
|
||||
"type": "string"
|
||||
},
|
||||
"birthday": {
|
||||
"type": "integer"
|
||||
},
|
||||
"color": {
|
||||
"type": "string"
|
||||
},
|
||||
"color_grad": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ProfileDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"avatar_url": {
|
||||
"type": "string"
|
||||
@@ -546,17 +593,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.UrlDto": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ChangePasswordRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -659,6 +695,20 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.PresignedUploadResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fields": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.RefreshRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user