package model import ( "donat-widget/internal/model/api" "github.com/google/uuid" "mime/multipart" ) import ( "context" "github.com/jackc/pgx/v5" "github.com/labstack/echo/v4" ) type WidgetService interface { CheckToken(request echo.Context) (api.CheckTokenResponse, error) CreateWidget(ctx context.Context, streamerID int, templateID int, duration int, minAmount int, maxAmount int, image string, audio string, name string, ) (WidgetID, error) GetWidgetsByStreamer(ctx context.Context, streamerID int) ([]*WidgetWithFileLink, error) UpdateWidget(ctx context.Context, updateWidget UpdateWidget, widgetID, accountID int) error //GetWidgetByID(ctx context.Context, widgetID WidgetID) ([]*GetWidgetDb, error) //GetWidgetHTML(ctx context.Context, streamerID StreamerID) (WidgetHTML, error) //GetMediaFile(ctx context.Context, widgetID WidgetID, mediaType MediaType) (DownloadFile, error) // //SetMediaFile(ctx context.Context, mediaType MediaType, widgetID WidgetID, file UploadFile, filename string, size int64, collection string) error //SetMediaUrl(ctx context.Context, mediaType MediaType, widgetID WidgetID, mediaURL MediaUrl) error } type WidgetRepo interface { CreateWidget(ctx context.Context, streamerID int, templateID int, duration int, minAmount int, maxAmount int, image string, audio string, name string, ) (WidgetID, error) CheckWidgetName(ctx context.Context, streamerID int, name string) (bool, error) GetWidgetsByStreamerID(ctx context.Context, streamerID int) ([]*GetWidgetDb, error) UpdateWidget( ctx context.Context, widgetID int, duration *int, minAmount *int, maxAmount *int, isActive *bool, image *uuid.UUID, audio *uuid.UUID, name *string, ) error WidgetByID(ctx context.Context, widgetID, accountID int) error //GetWidgetByID(ctx context.Context, widgetID WidgetID) ([]*GetWidgetDb, error) //GetAllWidget(ctx context.Context, streamerID StreamerID) ([]*GetWidgetDb, error) //GetMediaFile(fileID FileID) (DownloadFile, error) //GetMediaUrl(ctx context.Context, widgetID WidgetID, mediaType MediaType) (MediaUrl, error) // //SetMediaFile(file UploadFile, filename string, size int64, collection string) (FileID, error) //SetMediaUrl(ctx context.Context, widgetID WidgetID, mediaUrl MediaUrl, mediaType MediaType) error } type DonatService interface { CheckToken(request echo.Context) (api.CheckTokenResponse, error) CreateDonat(ctx context.Context, streamerLogin, text, donatUser string, targetID, amount int) (api.CreatePaymentResponse, error) GetDonatByStreamerID(ctx context.Context, streamerID StreamerID) ([]*Donat, error) GetDonatByOrderID(ctx context.Context, orderID OrderID) (*Donat, error) MarkDonatPaid(ctx context.Context, orderID OrderID) error MarkDonatView(ctx context.Context, DonatID DonatID) error GetInnerDonatPage(ctx context.Context, streamerID StreamerID) (InnerDonatePageResponse, error) GetOuterDonatPage(ctx context.Context, streamerLogin string) (OuterDonatePageResponse, error) UpdateDonatePage( ctx context.Context, streamerID int, updateModel UpdateDonatPage, background multipart.FileHeader, headImg multipart.FileHeader, ) error GetVoiceSettings(ctx context.Context, streamerID int) (VoiceSettingsResponse, error) UpdateVoiceSettings(ctx context.Context, streamerID int, updateModel UpdateVoiceSettings) error GetFiltersSettings(ctx context.Context, streamerID int) (FilterSettingResponse, error) UpdateFiltersSettings(ctx context.Context, streamerID int, updateModel UpdateFilterSettings) error GetModerationSettings(ctx context.Context, streamerID int) (ModerationResponse, error) UpdateModerationSettings(ctx context.Context, streamerID int, updateModel UpdateModeration) error GetDonationsStats(ctx context.Context, streamerID int, period string) ([]DonationStatResponse, error) } type DonatRepo interface { CreateDonat( ctx context.Context, streamerID int, targetID int, widgetID int, orderID uuid.UUID, amount int, text string, donatUser string, ) error GetDonatByStreamerID(ctx context.Context, streamerID StreamerID) ([]*Donat, error) GetDonatByOrderID(ctx context.Context, orderID OrderID) (*Donat, error) MarkDonatPaid(ctx context.Context, orderID OrderID) error MarkDonatView(ctx context.Context, DonatID DonatID) error GetDonatPage(ctx context.Context, streamerID StreamerID) (DonatePage, error) GetDonatPageByLogin(ctx context.Context, streamerLogin string) (DonatePage, error) UpdateDonatePage( ctx context.Context, streamerID int, backgroundFileID *string, headImgFileID *string, description *string, textAfterDonation *string, ) error GetVoiceSettingsByStreamerID(ctx context.Context, streamerID int) (VoiceSettingsResponse, error) UpdateVoiceSettings(ctx context.Context, streamerID int, updateModel UpdateVoiceSettings) error GetLanguagesByStreamerID(ctx context.Context, streamerID int) ([]Language, error) DeleteLanguagesByVoiceSettingID(ctx context.Context, voiceSettingID int) error InsertLanguagesForVoiceSetting(ctx context.Context, voiceSettingID int, languageIDs []int) error GetLanguageIDsByISOCodes(ctx context.Context, isoCodes []string) ([]int, error) GetVoiceSettingIDByStreamerID(ctx context.Context, streamerID int) (int, error) GetFilterSettingsByStreamerID(ctx context.Context, streamerID int) (int, bool, error) GetFilteredWords(ctx context.Context, streamerID int) ([]string, error) UpdateFilterSettings(ctx context.Context, streamerID int, enableLinks *bool) error AddFilteredWords(ctx context.Context, filterID int, words []string) error RemoveFilteredWords(ctx context.Context, filterID int, words []string) error GetFilterIDByStreamer(ctx context.Context, streamerID int) (int, error) GetModeration(ctx context.Context, streamerID int) (ModerationResponse, error) UpdateModeration(ctx context.Context, streamerID int, enable *bool, duration *int) error GetDonationsStats(ctx context.Context, streamerID int, period string) ([]DonationStat, error) } type TargetService interface { CheckToken(request echo.Context) (api.CheckTokenResponse, error) CreateTarget(ctx context.Context, streamerID StreamerID, amount DonatAmount, text string) (TargetID, error) GetAllTarget(ctx context.Context, streamerID StreamerID) ([]*Target, error) AddAmountToTarget(ctx context.Context, targetID TargetID, amount DonatAmount) error } type TargetRepo interface { CreateTarget(ctx context.Context, streamerID StreamerID, amount DonatAmount, text string) (TargetID, error) GetAllTarget(ctx context.Context, streamerID StreamerID) ([]*Target, error) AddAmountToTarget(ctx context.Context, targetID TargetID, amount DonatAmount) error } type Error interface { Error() string } type Storage interface { Upload(file *multipart.FileHeader, streamerID int) (string, error) Download(filename, folder string) ([]byte, error) Delete(filename, extension, filePath string) error DownloadLink(fileId uuid.UUID) string } type PaymentClient interface { CreatePayment(streamerID int, amount int, orderID uuid.UUID) (api.CreatePaymentResponse, error) } type Db interface { Insert(ctx context.Context, query string, args ...interface{}) (any, error) Select(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error) SelectOne(ctx context.Context, query string, args ...interface{}) (pgx.Row, error) Delete(ctx context.Context, query string, args ...interface{}) error Update(ctx context.Context, query string, args ...interface{}) error Exec(ctx context.Context, query string, args ...interface{}) error CreateTable(ctx context.Context, query string) error DropTable(ctx context.Context, query string) error } type AuthClient interface { CheckToken(token Token) (api.CheckTokenResponse, error) VerifyTwoFa(twoFaCode string, streamerID StreamerID) (bool, error) } type FileRepo interface { AddNew( ctx context.Context, streamerID int, file multipart.FileHeader, extension, fileType, entity string, ) (string, error) GetByID(ctx context.Context, fileID string) ([]byte, string, error) WidgetsFiles(ctx context.Context, fileType string, streamerID int) ([]*DataFile, error) } type FileService interface { CheckToken(request echo.Context) (api.CheckTokenResponse, error) AddNewFile( ctx context.Context, file multipart.FileHeader, streamerID int, entity string, ) (string, error) GetByID(ctx context.Context, fileID string) ([]byte, string, error) WidgetsFiles(ctx context.Context, fileType string, streamerID int) ([]*DataFile, error) }