2025-03-23 00:19:19 +05:00

327 lines
19 KiB
Go

package model
import (
"github.com/google/uuid"
"time"
)
type DataFile struct {
ID uuid.UUID `db:"id" json:"id"`
FileType string `db:"file_type" json:"file_type"`
FileName string `db:"file_name" json:"file_name"`
Extension string `db:"extension" json:"extension"`
StreamerID int `db:"streamer_id" json:"streamer_id"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
Size float32 `db:"size" json:"size"`
FileLink string `json:"file_link"`
Entity string `db:"entity"`
}
type GetWidgetDb struct {
ID int `db:"id" json:"id" example:"1" format:"int64" description:"Unique identifier of the widget"`
StreamerID int `db:"streamer_id" json:"streamer_id" example:"1001" format:"int64" description:"ID of the streamer"`
TemplateID int `db:"template_id" json:"template_id" example:"5" format:"int64" description:"ID of the template"`
Name string `db:"name" json:"name" example:"Мой виджет 10" format:"string" description:"Имя виджета"`
Duration int `db:"duration" json:"duration" example:"30" format:"int64" description:"Duration of the widget"`
MinAmount int `db:"min_amount" json:"min_amount" example:"100" format:"int64" description:"Minimum donation amount"`
MaxAmount int `db:"max_amount" json:"max_amount" example:"1000" format:"int64" description:"Maximum donation amount"`
CreatedAt time.Time `db:"created_at" json:"created_at" format:"date-time" example:"2025-03-06T13:37:36Z" description:"Timestamp when the widget was created"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at" format:"date-time" example:"2025-03-07T10:15:30Z" description:"Timestamp when the widget was last updated"`
GroupID int `db:"group_id" json:"group_id" example:"2" format:"int64" description:"Group ID associated with the widget"`
IsActive bool `db:"is_active" json:"is_active" example:"true" description:"Whether or not this widget is active"`
// Поля для изображения
ImageFileId uuid.UUID `db:"image_id" json:"image_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000" description:"UUID of the image file"`
ImageFileName string `db:"image_file_name" json:"image_file_name" example:"background.png" description:"Name of the image file"`
ImageType string `db:"image_type" json:"image_type" example:"image/png" description:"Type of the image file"`
ImageLink string `json:"image_link" example:"https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000" description:"Public URL of the image"`
// Поля для аудио
AudioFileId uuid.UUID `db:"audio_id" json:"audio_id" format:"uuid" example:"123e4567-e89b-12d3-a456-426614174000" description:"UUID of the audio file"`
AudioFileName string `db:"audio_file_name" json:"audio_file_name" example:"alert.mp3" description:"Name of the audio file"`
AudioType string `db:"audio_type" json:"audio_type" example:"audio/mp3" description:"Type of the audio file"`
AudioLink string `json:"audio_link" example:"https://cdn.example.com/audio/123e4567-e89b-12d3-a456-426614174000" description:"Public URL of the audio"`
}
type WidgetWithFileLink struct {
GroupID int `json:"group_id"`
Widgets []*GetWidgetDb `json:"widgets"`
}
type AllWidgets struct {
UrlWidget string `json:"url_widget"`
Widgets []*WidgetWithFileLink `json:"widgets"`
}
type UpdateWidget struct {
IsActive *bool `json:"is_active" example:"true" description:"Indicates whether the widget is active or not"`
Name *string `json:"name" example:"Awesome Widget" description:"Name of the widget"`
Image *uuid.UUID `json:"image" example:"d2c2f03f-3fe5-4bfc-b963-5478a057149e" description:"UUID of the widget image"`
Audio *uuid.UUID `json:"audio" example:"a0f9e244-f61f-4bfe-a7a0-3b5e91fe7364" description:"UUID of the widget audio file"`
Duration *int `json:"duration" example:"120" description:"Duration of the widget in seconds"`
MinAmount *int `json:"min_amount" example:"10" description:"Minimum amount for the widget"`
MaxAmount *int `json:"max_amount" example:"100" description:"Maximum amount for the widget"`
}
type Donat struct {
ID int `db:"id" json:"id" example:"1" description:"Unique identifier of the donation"`
WidgetID int `db:"widget_id" json:"widget_id" example:"5" description:"ID of the widget"`
StreamerID int `db:"streamer_id" json:"-" example:"1" description:"ID of the streamer"`
OrderID string `db:"order_id" json:"order_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000" description:"Unique order identifier"`
TargetID int `db:"target_id" json:"target_id,omitempty" example:"2002" description:"Optional target ID"`
Status string `db:"status" json:"status" example:"pending" description:"Donation status (e.g., pending, accepted, rejected)"`
Text string `db:"text" json:"text" example:"Thank you for the stream!" description:"Donation message text"`
Amount int `db:"amount" json:"amount" example:"500" description:"Donation amount in cents"`
DonatUser string `db:"donat_user" json:"donat_user" example:"Anonymous" description:"Name of the donator (or 'Anonymous')"`
AcceptedTime *time.Time `db:"accepted_time" json:"accepted_time,omitempty" format:"date-time" example:"2025-03-12T15:04:05Z" description:"Timestamp when the donation was accepted"`
ShowName bool `db:"show_name" json:"show_name" example:"true" description:"Whether to show the donator's name"`
ShowText bool `db:"show_text" json:"show_text" example:"true" description:"Whether to show the donation message"`
PlayContent bool `db:"play_content" json:"play_content" example:"true" description:"Whether to play media content (e.g., TTS, sound)"`
ShowedTime *time.Time `db:"showed_time" json:"showed_time" format:"date-time" example:"2025-03-12T15:05:10Z" description:"Timestamp when the donation was displayed on stream"`
CreatedAt time.Time `db:"created_at" json:"-" format:"date-time" example:"2025-03-12T15:04:05Z" description:"Timestamp when the donation was created"`
UpdatedAt time.Time `db:"updated_at" json:"-" format:"date-time" example:"2025-03-12T15:04:05Z" description:"Timestamp when the donation was last updated"`
}
type Target struct {
ID TargetID `db:"id"`
StreamerID StreamerID `db:"streamer_id"`
Text string `db:"text"`
Collected DonatAmount `db:"collected"`
Amount DonatAmount `db:"amount"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
type DonatePage struct {
// Основные поля
ID int `db:"id" json:"id" example:"1" format:"int64" description:"Уникальный идентификатор страницы доната"`
StreamerID int `db:"streamer_id" json:"streamer_id" example:"1001" format:"int64" description:"ID стримера"`
Description string `db:"description" json:"description" example:"Поддержи этого стримера" description:"Описание страницы доната"`
TextAfterDonat string `db:"text_after_donat" json:"text_after_donat" example:"Спасибо за вашу поддержку!" description:"Текст, который отображается после доната"`
StreamerLogin string `db:"streamer_login" json:"streamer_login" example:"streamer123" description:"Логин/псевдоним стримера"`
// Поля для хед-изображения
HeadImgFileId uuid.UUID `db:"head_img_id" json:"head_img_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000" description:"UUID файла хед-изображения"`
HeadImgFileName string `db:"head_img_file_name" json:"head_img_file_name" example:"header.png" description:"Имя файла хед-изображения"`
HeadImgType string `db:"head_img_type" json:"head_img_type" example:"image/png" description:"Тип файла хед-изображения"`
HeadImgLink string `json:"head_img_link" example:"https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000" description:"Публичный URL хед-изображения"`
HeadImgSize int `db:"head_img_size" json:"head_img_size" example:"1024" description:"Размер файла хед-изображения в байтах"`
// Поля для аватара
AvatarFileId uuid.UUID `db:"avatar_id" json:"avatar_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440001" description:"UUID файла аватара"`
AvatarFileName string `db:"avatar_file_name" json:"avatar_file_name" example:"avatar.png" description:"Имя файла аватара"`
AvatarType string `db:"avatar_type" json:"avatar_type" example:"image/png" description:"Тип файла аватара"`
AvatarLink string `json:"avatar_link" example:"https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440001" description:"Публичный URL аватара"`
AvatarImgSize int `db:"avatar_img_size" json:"avatar_img_size" example:"512" description:"Размер файла аватара в байтах"`
// Поля для фона
BackgroundImgFileId uuid.UUID `db:"background_img_id" json:"background_img_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440002" description:"UUID файла фона"`
BackgroundImgFileName string `db:"background_img_file_name" json:"background_img_file_name" example:"background.png" description:"Имя файла фона"`
BackgroundImgType string `db:"background_img_type" json:"background_img_type" example:"image/png" description:"Тип файла фона"`
BackgroundImgLink string `json:"background_img_link" example:"https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440002" description:"Публичный URL фона"`
BackgroundImgSize int `db:"background_img_size" json:"background_img_size" example:"2048" description:"Размер файла фона в байтах"`
}
type InnerFile struct {
FileID uuid.UUID `json:"file_id" example:"550e8400-e29b-41d4-a716-446655440000" description:"UUID файла"`
FileName string `json:"file_name" example:"header.png" description:"Имя файла"`
FileType string `json:"file_type" example:"image/png" description:"Тип файла"`
FileLink string `json:"file_link" example:"https://cdn.example.com/images/550e8400-e29b-41d4-a716-446655440000" description:"Публичный URL файла"`
FileSize int `json:"file_size" example:"1024" description:"Размер файла в байтах"`
}
type InnerDonatePageResponse struct {
Description string `json:"description"`
TextAfterDonat string `json:"text_after_donat"`
HeadImg InnerFile `json:"head_img"`
Avatar InnerFile `json:"avatar"`
BackgroundImg InnerFile `json:"background_img"`
}
type Moderation struct {
ID int `db:"id"`
StreamerID int `db:"streamer_id"`
Enable bool `db:"enable"`
Duration int `db:"duration"`
}
type OuterDonatePageResponse struct {
Login string `json:"login" example:"streamer123" description:"Логин или псевдоним стримера"`
OnLine string `json:"online" example:"online" description:"Статус стримера (online/offline)"`
Description string `json:"description" example:"Поддержи этого стримера" description:"Описание страницы доната"`
BackgroundImg string `json:"background_img" example:"https://cdn.example.com/images/background.png" description:"Ссылка на фоновое изображение"`
AvatarImg string `json:"avatar_img" example:"https://cdn.example.com/images/avatar.png" description:"Ссылка на аватар"`
HeadImg string `json:"head_img" example:"https://cdn.example.com/images/header.png" description:"Ссылка на хед-изображение"`
}
type Filter struct {
ID int `db:"id"`
StreamerID int `db:"streamer_id"`
EnableLinks bool `db:"enable_links"`
}
type FilterWord struct {
ID int `db:"id"`
DonatFilterID int `db:"donat_filter_id"`
Word string `db:"word"`
}
type VoiceSettings struct {
ID int `db:"id"`
StreamerID int `db:"streamer_id"`
VoiceSpeed int `db:"voice_speed"`
Scenery string `db:"scenery"`
VoiceSoundPercent int `db:"voice_sound_percent"`
MinPrice int `db:"min_price"`
}
type VoiceLanguage struct {
ID int `db:"id"`
VoiceSettingID int `db:"voice_setting_id"`
LanguageID int `db:"language_id"`
}
type UpdateDonatPage struct {
ProfileAvatar *bool `json:"profile_avatar,omitempty" form:"profile_avatar" example:"true" description:"Indicates whether the profile avatar is displayed"`
Description *string `json:"description,omitempty" form:"description" example:"A great donation page" description:"Description of the donation page"`
TextAfterDonat *string `json:"text_after_donat,omitempty" form:"text_after_donat" example:"Thank you for your support!" description:"Text displayed after a donation"`
PageBackground *string `json:"page_background,omitempty" form:"page_background" example:"#13161E" description:"Color code"`
}
type Language struct {
ID int `json:"id" db:"language_id"`
ISOCode string `json:"iso_code" db:"iso_code"`
RUName string `json:"ru_name" db:"ru_name"`
ENName string `json:"en_name" db:"en_name"`
}
type VoiceSettingsResponse struct {
VoiceSpeed string `json:"voice_speed" validate:"oneof=low medium high"`
Scenery string `json:"scenery"`
VoiceSoundPercent int `json:"voice_sound_percent"`
MinPrice int `json:"min_price"`
Languages []Language `json:"languages"` // Новое поле
Enable bool `json:"enable"`
}
type UpdateVoiceSettings struct {
Enable *bool `json:"enable"`
VoiceSpeed *string `json:"voice_speed" validate:"oneof=low medium high"`
Scenery *string `json:"scenery"`
VoiceSoundPercent *int `json:"voice_sound_percent"`
MinPrice *int `json:"min_price"`
Languages []string `json:"languages"`
}
type FilterSettingResponse struct {
EnableLinks bool `json:"enable_links"`
FilteredWords []string `json:"filtered_words"`
}
type UpdateFilterSettings struct {
EnableLinks *bool `json:"enable_links"`
AddWords []string `json:"add_words"`
RemoveWords []string `json:"remove_words"`
}
type ModerationResponse struct {
Enable bool `json:"enable"`
Duration int `json:"duration"`
}
type UpdateModeration struct {
Enable *bool `json:"enable"`
Duration *int `json:"duration"`
}
type CreateWidgetResponse struct {
WidgetID WidgetID `json:"widget_id"`
}
// CreateWidgetBody структура для создания виджета
type CreateWidgetBody struct {
TemplateID int `json:"template_id" validate:"required" example:"1"`
Duration int `json:"duration" validate:"required" example:"30"`
IsActive bool `json:"is_active" example:"true"`
Name string `json:"name" validate:"required" example:"My GetWidgetDb"`
Image string `json:"image" validate:"required" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000"`
Audio string `json:"audio" validate:"required" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440001"`
MinAmount int `json:"min_amount" validate:"required" example:"10"`
MaxAmount int `json:"max_amount" validate:"required" example:"100"`
}
type DonatAndWidget struct {
Donat *Donat
Display Display
}
type CreateDonatBody struct {
TargetID int `json:"targetID"`
Amount int `json:"amount"`
Text string `json:"text"`
DonatUser string `json:"donatUser"`
}
type DonationStat struct {
Date time.Time `db:"date"`
AmountCollected int `db:"amount_collected"`
DonationsCount int `db:"donations_count"`
}
type DonationSummary struct {
TotalAmount int `db:"total_amount" json:"total_amount"` // Общая сумма донатов
DonationsCount int `db:"donations_count" json:"donations_count"` // Общее количество донатов
}
type DonationStatResponse struct {
Date time.Time `json:"date"`
AmountCollected int `json:"amount_collected"`
DonationsCount int `json:"donations_count"`
}
type DonationSummaryResponse struct {
DonationSum DonationSummary `json:"donation_sum"`
Donations []DonationStatResponse `json:"donations"`
}
type DonationModeration struct {
ID int `db:"id" json:"id" example:"123"` // Уникальный идентификатор доната
TargetID int `db:"target_id" json:"target_id" example:"0"` // ID цели (если есть)
Status string `db:"status" json:"status" example:"moderation"` // Статус доната (moderation, pending, viewed и т.д.)
Text string `db:"text" json:"text" example:"Пиздатый стрим"` // Текст доната
Amount int `db:"amount" json:"amount" example:"2000"` // Сумма доната
DonatUser string `db:"donat_user" json:"donat_user" example:"Петр"` // Имя пользователя, сделавшего донат
AcceptedTime *time.Time `db:"accepted_time" json:"accepted_time" example:"2025-03-09T12:49:21.75005Z"` // Донат принят на модерации
ShowName bool `db:"show_name" json:"show_name" example:"true"` // Показывать имя пользователя
ShowText bool `db:"show_text" json:"show_text" example:"true"` // Показывать текст доната
PlayContent bool `db:"play_content" json:"play_content" example:"true"` // Проигрывать контент
CreatedAt time.Time `db:"created_at" json:"created_at" example:"2025-03-09T12:49:21.75005Z"` // Дата создания
UpdatedAt time.Time `db:"updated_at" json:"updated_at" example:"2025-03-09T12:49:21.75005Z"` // Дата последнего обновления
}
type ModerationDonat struct {
Accepted *bool `json:"accepted"`
ShowText *bool `json:"show_text"`
PlayContent *bool `json:"play_content"`
ShowName *bool `json:"show_name"`
}
type InitNewStreamerBody struct {
StreamerID int `json:"streamer_id" validate:"required" example:"1"`
Login string `json:"login" validate:"required" example:"admin"`
}
type MarkDonatPaidBody struct {
OrderID string `json:"order_id"`
}
type PlayingDonat struct {
Duration int `json:"duration" example:"30"`
Image *string `json:"image_link"`
Audio *string `json:"audio_link"`
Text string `json:"text"`
Amount int `json:"amount"`
}