add docs annottions

This commit is contained in:
harold 2025-03-08 22:21:10 +05:00
parent bccd1259b5
commit bd2843ff4e
5 changed files with 96 additions and 34 deletions

View File

@ -1002,19 +1002,24 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"file_id": { "file_id": {
"type": "string" "type": "string",
"example": "550e8400-e29b-41d4-a716-446655440000"
}, },
"file_link": { "file_link": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000"
}, },
"file_name": { "file_name": {
"type": "string" "type": "string",
"example": "header.png"
}, },
"file_size": { "file_size": {
"type": "integer" "type": "integer",
"example": 1024
}, },
"file_type": { "file_type": {
"type": "string" "type": "string",
"example": "image/png"
} }
} }
}, },
@ -1033,22 +1038,28 @@ const docTemplate = `{
"type": "object", "type": "object",
"properties": { "properties": {
"avatar_img": { "avatar_img": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/avatar.png"
}, },
"background_img": { "background_img": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/background.png"
}, },
"description": { "description": {
"type": "string" "type": "string",
"example": "Поддержи этого стримера"
}, },
"head_img": { "head_img": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/header.png"
}, },
"login": { "login": {
"type": "string" "type": "string",
"example": "streamer123"
}, },
"online": { "online": {
"type": "string" "type": "string",
"example": "online"
} }
} }
}, },

View File

@ -995,19 +995,24 @@
"type": "object", "type": "object",
"properties": { "properties": {
"file_id": { "file_id": {
"type": "string" "type": "string",
"example": "550e8400-e29b-41d4-a716-446655440000"
}, },
"file_link": { "file_link": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000"
}, },
"file_name": { "file_name": {
"type": "string" "type": "string",
"example": "header.png"
}, },
"file_size": { "file_size": {
"type": "integer" "type": "integer",
"example": 1024
}, },
"file_type": { "file_type": {
"type": "string" "type": "string",
"example": "image/png"
} }
} }
}, },
@ -1026,22 +1031,28 @@
"type": "object", "type": "object",
"properties": { "properties": {
"avatar_img": { "avatar_img": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/avatar.png"
}, },
"background_img": { "background_img": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/background.png"
}, },
"description": { "description": {
"type": "string" "type": "string",
"example": "Поддержи этого стримера"
}, },
"head_img": { "head_img": {
"type": "string" "type": "string",
"example": "https://cdn.example.com/images/header.png"
}, },
"login": { "login": {
"type": "string" "type": "string",
"example": "streamer123"
}, },
"online": { "online": {
"type": "string" "type": "string",
"example": "online"
} }
} }
}, },

View File

@ -150,14 +150,19 @@ definitions:
donat-widget_internal_model.InnerFile: donat-widget_internal_model.InnerFile:
properties: properties:
file_id: file_id:
example: 550e8400-e29b-41d4-a716-446655440000
type: string type: string
file_link: file_link:
example: https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000
type: string type: string
file_name: file_name:
example: header.png
type: string type: string
file_size: file_size:
example: 1024
type: integer type: integer
file_type: file_type:
example: image/png
type: string type: string
type: object type: object
donat-widget_internal_model.ModerationResponse: donat-widget_internal_model.ModerationResponse:
@ -170,16 +175,22 @@ definitions:
donat-widget_internal_model.OuterDonatePageResponse: donat-widget_internal_model.OuterDonatePageResponse:
properties: properties:
avatar_img: avatar_img:
example: https://cdn.example.com/images/avatar.png
type: string type: string
background_img: background_img:
example: https://cdn.example.com/images/background.png
type: string type: string
description: description:
example: Поддержи этого стримера
type: string type: string
head_img: head_img:
example: https://cdn.example.com/images/header.png
type: string type: string
login: login:
example: streamer123
type: string type: string
online: online:
example: online
type: string type: string
type: object type: object
donat-widget_internal_model.UpdateFilterSettings: donat-widget_internal_model.UpdateFilterSettings:

View File

@ -118,11 +118,11 @@ type DonatePage struct {
} }
type InnerFile struct { type InnerFile struct {
FileID uuid.UUID `json:"file_id"` FileID uuid.UUID `json:"file_id" example:"550e8400-e29b-41d4-a716-446655440000" description:"UUID файла"`
FileName string `json:"file_name"` FileName string `json:"file_name" example:"header.png" description:"Имя файла"`
FileType string `json:"file_type"` FileType string `json:"file_type" example:"image/png" description:"Тип файла"`
FileLink string `json:"file_link"` FileLink string `json:"file_link" example:"https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000" description:"Публичный URL файла"`
FileSize int `json:"file_size"` FileSize int `json:"file_size" example:"1024" description:"Размер файла в байтах"`
} }
type InnerDonatePageResponse struct { type InnerDonatePageResponse struct {
@ -141,12 +141,12 @@ type Moderation struct {
} }
type OuterDonatePageResponse struct { type OuterDonatePageResponse struct {
Login string `json:"login"` Login string `json:"login" example:"streamer123" description:"Логин или псевдоним стримера"`
OnLine string `json:"online"` OnLine string `json:"online" example:"online" description:"Статус стримера (online/offline)"`
Description string `json:"description"` Description string `json:"description" example:"Поддержи этого стримера" description:"Описание страницы доната"`
BackgroundImg string `json:"background_img"` BackgroundImg string `json:"background_img" example:"https://cdn.example.com/images/background.png" description:"Ссылка на фоновое изображение"`
AvatarImg string `json:"avatar_img"` AvatarImg string `json:"avatar_img" example:"https://cdn.example.com/images/avatar.png" description:"Ссылка на аватар"`
HeadImg string `json:"head_img"` HeadImg string `json:"head_img" example:"https://cdn.example.com/images/header.png" description:"Ссылка на хед-изображение"`
} }
type Filter struct { type Filter struct {

View File

@ -117,7 +117,36 @@ WHERE dp.streamer_id = (@streamer_id);
` `
var GetDonationPageByLogin = ` var GetDonationPageByLogin = `
SELECT * FROM donate_pages WHERE streamer_login = (@streamer_login); SELECT
dp.id,
dp.streamer_id,
dp.description,
dp.text_after_donat,
dp.streamer_login,
-- Поля для хед-изображения
head_img.id AS head_img_id,
head_img.file_name AS head_img_file_name,
head_img.file_type AS head_img_type,
head_img.size AS head_img_size,
-- Поля для аватара
avatar.id AS avatar_id,
avatar.file_name AS avatar_file_name,
avatar.file_type AS avatar_type,
avatar.size AS avatar_img_size,
-- Поля для фона
background_img.id AS background_img_id,
background_img.file_name AS background_img_file_name,
background_img.file_type AS background_img_type,
background_img.size AS background_img_size
FROM donate_pages dp
LEFT JOIN files head_img ON dp.head_img = head_img.id
LEFT JOIN files avatar ON dp.avatar = avatar.id
LEFT JOIN files background_img ON dp.background_img = background_img.id
WHERE dp.streamer_login = (@streamer_login);
` `
var GetWidgetsByStreamerID = ` var GetWidgetsByStreamerID = `