add page background and avatar bool fields
This commit is contained in:
parent
1850ea21ee
commit
219ff21340
@ -398,7 +398,7 @@ const docTemplate = `{
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/donat-widget_internal_model.MarDonatViewed"
|
"$ref": "#/definitions/donat-widget_internal_model.MarkDonatViewed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -1837,6 +1837,12 @@ const docTemplate = `{
|
|||||||
"head_img": {
|
"head_img": {
|
||||||
"$ref": "#/definitions/donat-widget_internal_model.InnerFile"
|
"$ref": "#/definitions/donat-widget_internal_model.InnerFile"
|
||||||
},
|
},
|
||||||
|
"page_background": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"profile_avatar": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"text_after_donat": {
|
"text_after_donat": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@ -1884,7 +1890,7 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"donat-widget_internal_model.MarDonatViewed": {
|
"donat-widget_internal_model.MarkDonatPaidBody": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"order_id": {
|
"order_id": {
|
||||||
@ -1892,7 +1898,7 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"donat-widget_internal_model.MarkDonatPaidBody": {
|
"donat-widget_internal_model.MarkDonatViewed": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"order_id": {
|
"order_id": {
|
||||||
|
@ -391,7 +391,7 @@
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/donat-widget_internal_model.MarDonatViewed"
|
"$ref": "#/definitions/donat-widget_internal_model.MarkDonatViewed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -1830,6 +1830,12 @@
|
|||||||
"head_img": {
|
"head_img": {
|
||||||
"$ref": "#/definitions/donat-widget_internal_model.InnerFile"
|
"$ref": "#/definitions/donat-widget_internal_model.InnerFile"
|
||||||
},
|
},
|
||||||
|
"page_background": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"profile_avatar": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"text_after_donat": {
|
"text_after_donat": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@ -1877,7 +1883,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"donat-widget_internal_model.MarDonatViewed": {
|
"donat-widget_internal_model.MarkDonatPaidBody": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"order_id": {
|
"order_id": {
|
||||||
@ -1885,7 +1891,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"donat-widget_internal_model.MarkDonatPaidBody": {
|
"donat-widget_internal_model.MarkDonatViewed": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"order_id": {
|
"order_id": {
|
||||||
|
@ -306,6 +306,10 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
head_img:
|
head_img:
|
||||||
$ref: '#/definitions/donat-widget_internal_model.InnerFile'
|
$ref: '#/definitions/donat-widget_internal_model.InnerFile'
|
||||||
|
page_background:
|
||||||
|
type: string
|
||||||
|
profile_avatar:
|
||||||
|
type: boolean
|
||||||
text_after_donat:
|
text_after_donat:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
@ -338,12 +342,12 @@ definitions:
|
|||||||
ru_name:
|
ru_name:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
donat-widget_internal_model.MarDonatViewed:
|
donat-widget_internal_model.MarkDonatPaidBody:
|
||||||
properties:
|
properties:
|
||||||
order_id:
|
order_id:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
donat-widget_internal_model.MarkDonatPaidBody:
|
donat-widget_internal_model.MarkDonatViewed:
|
||||||
properties:
|
properties:
|
||||||
order_id:
|
order_id:
|
||||||
type: string
|
type: string
|
||||||
@ -800,7 +804,7 @@ paths:
|
|||||||
name: request
|
name: request
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/donat-widget_internal_model.MarDonatViewed'
|
$ref: '#/definitions/donat-widget_internal_model.MarkDonatViewed'
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
|
@ -143,6 +143,8 @@ type DonatRepo interface {
|
|||||||
headImgFileID *string,
|
headImgFileID *string,
|
||||||
description *string,
|
description *string,
|
||||||
textAfterDonation *string,
|
textAfterDonation *string,
|
||||||
|
profileAvatar *bool,
|
||||||
|
pageBackground *string,
|
||||||
) error
|
) error
|
||||||
GetVoiceSettingsByStreamerID(ctx context.Context, streamerID int) (VoiceSettingsResponse, error)
|
GetVoiceSettingsByStreamerID(ctx context.Context, streamerID int) (VoiceSettingsResponse, error)
|
||||||
UpdateVoiceSettings(ctx context.Context, streamerID int, updateModel UpdateVoiceSettings) error
|
UpdateVoiceSettings(ctx context.Context, streamerID int, updateModel UpdateVoiceSettings) error
|
||||||
|
@ -101,6 +101,8 @@ type DonatePage struct {
|
|||||||
Description string `db:"description" json:"description" example:"Поддержи этого стримера" description:"Описание страницы доната"`
|
Description string `db:"description" json:"description" example:"Поддержи этого стримера" description:"Описание страницы доната"`
|
||||||
TextAfterDonat string `db:"text_after_donat" json:"text_after_donat" 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:"Логин/псевдоним стримера"`
|
StreamerLogin string `db:"streamer_login" json:"streamer_login" example:"streamer123" description:"Логин/псевдоним стримера"`
|
||||||
|
ProfileAvatar bool `db:"profile_avatar" json:"profile_avatar" example:"true" description:"Использовать ли аватар из профиля."`
|
||||||
|
PageBackground string `db:"page_background" json:"page_background" example:"#13161E" description:"Цвет фона на странице доната"`
|
||||||
|
|
||||||
// Поля для хед-изображения
|
// Поля для хед-изображения
|
||||||
HeadImgFileId uuid.UUID `db:"head_img_id" json:"head_img_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000" description:"UUID файла хед-изображения"`
|
HeadImgFileId uuid.UUID `db:"head_img_id" json:"head_img_id" format:"uuid" example:"550e8400-e29b-41d4-a716-446655440000" description:"UUID файла хед-изображения"`
|
||||||
@ -138,6 +140,8 @@ type InnerDonatePageResponse struct {
|
|||||||
HeadImg InnerFile `json:"head_img"`
|
HeadImg InnerFile `json:"head_img"`
|
||||||
Avatar InnerFile `json:"avatar"`
|
Avatar InnerFile `json:"avatar"`
|
||||||
BackgroundImg InnerFile `json:"background_img"`
|
BackgroundImg InnerFile `json:"background_img"`
|
||||||
|
ProfileAvatar bool `json:"profile_avatar"`
|
||||||
|
PageBackground string `json:"page_background"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Moderation struct {
|
type Moderation struct {
|
||||||
|
@ -79,6 +79,8 @@ CREATE TABLE IF NOT EXISTS donate_pages (
|
|||||||
avatar UUID REFERENCES files(id) ON DELETE CASCADE,
|
avatar UUID REFERENCES files(id) ON DELETE CASCADE,
|
||||||
background_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
background_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
||||||
head_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
head_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
||||||
|
profile_avatar BOOLEAN NOT NULL DEFAULT 'true',
|
||||||
|
page_background TEXT DEFAULT '#13161E'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ SELECT
|
|||||||
dp.description,
|
dp.description,
|
||||||
dp.text_after_donat,
|
dp.text_after_donat,
|
||||||
dp.streamer_login,
|
dp.streamer_login,
|
||||||
|
dp.profile_avatar,
|
||||||
|
dp.page_background,
|
||||||
|
|
||||||
-- Поля для хед-изображения
|
-- Поля для хед-изображения
|
||||||
head_img.id AS head_img_id,
|
head_img.id AS head_img_id,
|
||||||
|
@ -199,6 +199,8 @@ func (repoDonat *RepoDonat) UpdateDonatePage(
|
|||||||
headImgFileID *string,
|
headImgFileID *string,
|
||||||
description *string,
|
description *string,
|
||||||
textAfterDonation *string,
|
textAfterDonation *string,
|
||||||
|
profileAvatar *bool,
|
||||||
|
pageBackground *string,
|
||||||
) error {
|
) error {
|
||||||
args := pgx.NamedArgs{
|
args := pgx.NamedArgs{
|
||||||
"streamer_id": streamerID,
|
"streamer_id": streamerID,
|
||||||
@ -216,6 +218,12 @@ func (repoDonat *RepoDonat) UpdateDonatePage(
|
|||||||
if textAfterDonation != nil {
|
if textAfterDonation != nil {
|
||||||
args["text_after_donat"] = *textAfterDonation
|
args["text_after_donat"] = *textAfterDonation
|
||||||
}
|
}
|
||||||
|
if pageBackground != nil {
|
||||||
|
args["page_background"] = *pageBackground
|
||||||
|
}
|
||||||
|
if profileAvatar != nil {
|
||||||
|
args["profile_avatar"] = *profileAvatar
|
||||||
|
}
|
||||||
|
|
||||||
err := repoDonat.db.Update(ctx, sql.UpdateDonatePage, args)
|
err := repoDonat.db.Update(ctx, sql.UpdateDonatePage, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -224,6 +224,8 @@ func (donatService *ServiceDonat) GetInnerDonatPage(
|
|||||||
innerDonatePageResponse := model.InnerDonatePageResponse{
|
innerDonatePageResponse := model.InnerDonatePageResponse{
|
||||||
Description: donatePage.Description,
|
Description: donatePage.Description,
|
||||||
TextAfterDonat: donatePage.TextAfterDonat,
|
TextAfterDonat: donatePage.TextAfterDonat,
|
||||||
|
ProfileAvatar: donatePage.ProfileAvatar,
|
||||||
|
PageBackground: donatePage.PageBackground,
|
||||||
HeadImg: headImgFile,
|
HeadImg: headImgFile,
|
||||||
Avatar: avatarFile,
|
Avatar: avatarFile,
|
||||||
BackgroundImg: backgroundImgFile,
|
BackgroundImg: backgroundImgFile,
|
||||||
@ -298,6 +300,8 @@ func (donatService *ServiceDonat) UpdateDonatePage(
|
|||||||
headImgFileID,
|
headImgFileID,
|
||||||
updateModel.Description,
|
updateModel.Description,
|
||||||
updateModel.TextAfterDonat,
|
updateModel.TextAfterDonat,
|
||||||
|
updateModel.ProfileAvatar,
|
||||||
|
updateModel.PageBackground,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(err.Error())
|
slog.Error(err.Error())
|
||||||
|
18
sql/init.sql
18
sql/init.sql
@ -66,7 +66,9 @@ CREATE TABLE IF NOT EXISTS donate_pages (
|
|||||||
text_after_donat TEXT DEFAULT '',
|
text_after_donat TEXT DEFAULT '',
|
||||||
avatar UUID REFERENCES files(id) ON DELETE CASCADE,
|
avatar UUID REFERENCES files(id) ON DELETE CASCADE,
|
||||||
background_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
background_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
||||||
head_img UUID REFERENCES files(id) ON DELETE CASCADE
|
head_img UUID REFERENCES files(id) ON DELETE CASCADE,
|
||||||
|
profile_avatar BOOLEAN NOT NULL DEFAULT 'true',
|
||||||
|
page_background TEXT DEFAULT '#13161E'
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS moderation (
|
CREATE TABLE IF NOT EXISTS moderation (
|
||||||
@ -175,3 +177,17 @@ VALUES (
|
|||||||
512,
|
512,
|
||||||
'donat_page'
|
'donat_page'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO languages (id, iso_code, ru_name, en_name)
|
||||||
|
VALUES
|
||||||
|
(1, 'en', 'Английский', 'English'),
|
||||||
|
(2, 'ru', 'Русский', 'Russian'),
|
||||||
|
(3, 'es', 'Испанский', 'Spanish'),
|
||||||
|
(4, 'fr', 'Французский', 'French'),
|
||||||
|
(5, 'de', 'Немецкий', 'German'),
|
||||||
|
(6, 'zh', 'Китайский', 'Chinese'),
|
||||||
|
(7, 'ja', 'Японский', 'Japanese'),
|
||||||
|
(8, 'it', 'Итальянский', 'Italian'),
|
||||||
|
(9, 'pt', 'Португальский', 'Portuguese'),
|
||||||
|
(10, 'ar', 'Арабский', 'Arabic');
|
Loading…
x
Reference in New Issue
Block a user