added new field in table YclientsRules
This commit is contained in:
parent
f1da78811b
commit
14d08909a7
@ -1620,12 +1620,12 @@ SELECT 1;
|
||||
SELECT * FROM YclientsRules WHERE QuizID = $1 AND Deleted = false;
|
||||
|
||||
-- name: SetYclientsQuizSettings :one
|
||||
INSERT INTO YclientsRules (SalonID, QuizID, Services,FieldsRule, CustomColor)
|
||||
SELECT ya.SalonID, $1 AS QuizID, $2 AS Services, $3 AS FieldsRule, $4 AS CustomColor
|
||||
INSERT INTO YclientsRules (SalonID, QuizID, Services,FieldsRule, CustomColor,StaffID)
|
||||
SELECT ya.SalonID, $1 AS QuizID, $2 AS Services, $3 AS FieldsRule, $4 AS CustomColor,$6 AS StaffID
|
||||
FROM YclientsAccounts ya WHERE ya.AccountID = $5 AND ya.Deleted = false
|
||||
RETURNING id;
|
||||
|
||||
-- name: ChangeYclientsQuizSettings :one
|
||||
UPDATE YclientsRules SET Services = $1, CustomColor = $2,FieldsRule = $3
|
||||
UPDATE YclientsRules SET Services = $1, CustomColor = $2,FieldsRule = $3,StaffID=$6
|
||||
WHERE SalonID = (SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $4 AND YclientsAccounts.Deleted = false)
|
||||
AND QuizID = $5 AND Deleted = false RETURNING id;
|
||||
@ -80,6 +80,7 @@ CREATE TABLE IF NOT EXISTS YclientsRules (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
QuizID INT NOT NULL, -- ID квиза на которое вешается правило
|
||||
StaffID INT NOT NULL,
|
||||
Services JSONB NOT NULL DEFAULT '{}',
|
||||
FieldsRule JSONB NOT NULL DEFAULT '{}',
|
||||
CustomColor text NOT NULL Default '',
|
||||
|
||||
@ -430,6 +430,7 @@ type Yclientsrule struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Staffid int32 `db:"staffid" json:"staffid"`
|
||||
Services json.RawMessage `db:"services" json:"services"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Customcolor string `db:"customcolor" json:"customcolor"`
|
||||
|
||||
@ -342,7 +342,7 @@ func (q *Queries) ChangeQuizSettings(ctx context.Context, arg ChangeQuizSettings
|
||||
}
|
||||
|
||||
const changeYclientsQuizSettings = `-- name: ChangeYclientsQuizSettings :one
|
||||
UPDATE YclientsRules SET Services = $1, CustomColor = $2,FieldsRule = $3
|
||||
UPDATE YclientsRules SET Services = $1, CustomColor = $2,FieldsRule = $3,StaffID=$6
|
||||
WHERE SalonID = (SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $4 AND YclientsAccounts.Deleted = false)
|
||||
AND QuizID = $5 AND Deleted = false RETURNING id
|
||||
`
|
||||
@ -353,6 +353,7 @@ type ChangeYclientsQuizSettingsParams struct {
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Staffid int32 `db:"staffid" json:"staffid"`
|
||||
}
|
||||
|
||||
func (q *Queries) ChangeYclientsQuizSettings(ctx context.Context, arg ChangeYclientsQuizSettingsParams) (int64, error) {
|
||||
@ -362,6 +363,7 @@ func (q *Queries) ChangeYclientsQuizSettings(ctx context.Context, arg ChangeYcli
|
||||
arg.Fieldsrule,
|
||||
arg.Accountid,
|
||||
arg.Quizid,
|
||||
arg.Staffid,
|
||||
)
|
||||
var id int64
|
||||
err := row.Scan(&id)
|
||||
@ -4793,7 +4795,7 @@ func (q *Queries) GetUsersYclientsWithPagination(ctx context.Context, arg GetUse
|
||||
}
|
||||
|
||||
const getYclientsQuizRule = `-- name: GetYclientsQuizRule :one
|
||||
SELECT id, salonid, quizid, services, fieldsrule, customcolor, deleted, createdat FROM YclientsRules WHERE QuizID = $1 AND Deleted = false
|
||||
SELECT id, salonid, quizid, staffid, services, fieldsrule, customcolor, deleted, createdat FROM YclientsRules WHERE QuizID = $1 AND Deleted = false
|
||||
`
|
||||
|
||||
func (q *Queries) GetYclientsQuizRule(ctx context.Context, quizid int32) (Yclientsrule, error) {
|
||||
@ -4803,6 +4805,7 @@ func (q *Queries) GetYclientsQuizRule(ctx context.Context, quizid int32) (Yclien
|
||||
&i.ID,
|
||||
&i.Salonid,
|
||||
&i.Quizid,
|
||||
&i.Staffid,
|
||||
&i.Services,
|
||||
&i.Fieldsrule,
|
||||
&i.Customcolor,
|
||||
@ -5706,8 +5709,8 @@ func (q *Queries) SetQuizSettings(ctx context.Context, arg SetQuizSettingsParams
|
||||
}
|
||||
|
||||
const setYclientsQuizSettings = `-- name: SetYclientsQuizSettings :one
|
||||
INSERT INTO YclientsRules (SalonID, QuizID, Services,FieldsRule, CustomColor)
|
||||
SELECT ya.SalonID, $1 AS QuizID, $2 AS Services, $3 AS FieldsRule, $4 AS CustomColor
|
||||
INSERT INTO YclientsRules (SalonID, QuizID, Services,FieldsRule, CustomColor,StaffID)
|
||||
SELECT ya.SalonID, $1 AS QuizID, $2 AS Services, $3 AS FieldsRule, $4 AS CustomColor,$6 AS StaffID
|
||||
FROM YclientsAccounts ya WHERE ya.AccountID = $5 AND ya.Deleted = false
|
||||
RETURNING id
|
||||
`
|
||||
@ -5718,6 +5721,7 @@ type SetYclientsQuizSettingsParams struct {
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Customcolor string `db:"customcolor" json:"customcolor"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Staffid int32 `db:"staffid" json:"staffid"`
|
||||
}
|
||||
|
||||
func (q *Queries) SetYclientsQuizSettings(ctx context.Context, arg SetYclientsQuizSettingsParams) (int64, error) {
|
||||
@ -5727,6 +5731,7 @@ func (q *Queries) SetYclientsQuizSettings(ctx context.Context, arg SetYclientsQu
|
||||
arg.Fieldsrule,
|
||||
arg.Customcolor,
|
||||
arg.Accountid,
|
||||
arg.Staffid,
|
||||
)
|
||||
var id int64
|
||||
err := row.Scan(&id)
|
||||
|
||||
@ -130,6 +130,7 @@ type YclientsRule struct {
|
||||
ID int64 `json:"id"`
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
QuizID int32 `json:"quizID"` // ID квиза на которое вешается правило
|
||||
StaffID int32 `json:"staffID"`
|
||||
Services ServiceYclientsRule `json:"services"`
|
||||
FieldsRule YclientsFieldRule `json:"fields_rule"`
|
||||
CustomColor string `json:"custom_color"`
|
||||
|
||||
@ -629,6 +629,7 @@ func (r *YclientsRepository) GettingQuizRules(ctx context.Context, quizID int32)
|
||||
CustomColor: row.Customcolor,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
StaffID: row.Staffid,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -643,6 +644,7 @@ func (r *YclientsRepository) SetQuizSettings(ctx context.Context, rule model.Ycl
|
||||
}
|
||||
_, err = r.queries.SetYclientsQuizSettings(ctx, sqlcgen.SetYclientsQuizSettingsParams{
|
||||
Quizid: rule.QuizID,
|
||||
Staffid: rule.StaffID,
|
||||
Services: jsonServices,
|
||||
Fieldsrule: jsonFieldsRule,
|
||||
Customcolor: rule.CustomColor,
|
||||
@ -667,6 +669,7 @@ func (r *YclientsRepository) ChangeQuizSettings(ctx context.Context, rule model.
|
||||
}
|
||||
_, err = r.queries.ChangeYclientsQuizSettings(ctx, sqlcgen.ChangeYclientsQuizSettingsParams{
|
||||
Quizid: rule.QuizID,
|
||||
Staffid: rule.StaffID,
|
||||
Services: jsonServices,
|
||||
Fieldsrule: jsonFieldsRule,
|
||||
Customcolor: rule.CustomColor,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user