added new table YclientsRules

This commit is contained in:
pasha1coil 2025-10-21 14:54:06 +03:00
parent bed92de45e
commit d661c9039a
3 changed files with 32 additions and 2 deletions

@ -1,5 +1,9 @@
DROP TABLE If EXIST YclientsTokens;
DROP TABLE If EXIST YclientsAccounts; DROP TABLE If EXIST YclientsAccounts;
DROP TABLE If EXIST YclientsAccountUsers; DROP TABLE If EXIST YclientsAccountUsers;
DROP TABLE If EXIST YclientsCompany; -- DROP TABLE If EXIST YclientsCompany;
DROP TABLE If EXIST YclientsServices; DROP TABLE If EXIST YclientsServices;
DROP TABLE If EXIST YclientsTimeSlots; DROP TABLE If EXIST YclientsTimeSlots;
DROP TABLE If EXIST YclientsRules;
DROP INDEX if exist idx_unique_tokens_yclients;

@ -76,6 +76,19 @@ CREATE TABLE IF NOT EXISTS YclientsTimeSlots (
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
); );
CREATE TABLE IF NOT EXISTS YclientsRules (
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
SalonID INT NOT NULL, -- ID компании
QuizID INT NOT NULL, -- ID квиза на которое вешается правило
Services JSONB NOT NULL DEFAULT '{}',
CustomColor text NOT NULL Default '',
RecordLabels text[] NOT NULL DEFAULT '[]',
CustomFields JSONB NOT NULL DEFAULT '{}',
ClientAgreements JSONB NOT NULL DEFAULT '{}',
Deleted BOOLEAN NOT NULL DEFAULT FALSE,
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
DO $$ DO $$
BEGIN BEGIN
IF NOT EXISTS ( IF NOT EXISTS (

@ -426,6 +426,19 @@ type Yclientsaccountuser struct {
Createdat time.Time `db:"createdat" json:"createdat"` Createdat time.Time `db:"createdat" json:"createdat"`
} }
type Yclientsrule struct {
ID int64 `db:"id" json:"id"`
Salonid int32 `db:"salonid" json:"salonid"`
Quizid int32 `db:"quizid" json:"quizid"`
Services json.RawMessage `db:"services" json:"services"`
Customcolor string `db:"customcolor" json:"customcolor"`
Recordlabels []string `db:"recordlabels" json:"recordlabels"`
Customfields json.RawMessage `db:"customfields" json:"customfields"`
Clientagreements json.RawMessage `db:"clientagreements" json:"clientagreements"`
Deleted bool `db:"deleted" json:"deleted"`
Createdat time.Time `db:"createdat" json:"createdat"`
}
type Yclientsservice struct { type Yclientsservice struct {
ID int64 `db:"id" json:"id"` ID int64 `db:"id" json:"id"`
Salonid int32 `db:"salonid" json:"salonid"` Salonid int32 `db:"salonid" json:"salonid"`