update yclients table,queries,repository methods,models
This commit is contained in:
parent
0f50c86b1a
commit
86d8476caf
@ -1495,45 +1495,59 @@ WHERE quiz_id = $1 AND privilege_id = $2;
|
||||
UPDATE quiz_privilege_usage SET used_count = 0, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE quiz_id = $1 AND privilege_id = $2;
|
||||
|
||||
-- Yclients
|
||||
|
||||
-- name: GetCurrentYclientsCompany :one
|
||||
SELECT * FROM YclientsAccounts WHERE AccountID = $1 AND Deleted = false;
|
||||
|
||||
-- name: GetUsersYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.*, COUNT(*) OVER() as total_count
|
||||
FROM YclientsAccountUsers u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3;
|
||||
|
||||
-- name: GetCompanyYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.*, COUNT(*) OVER() as total_count
|
||||
FROM YclientsCompany u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3;
|
||||
|
||||
-- name: GetServicesYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.*, COUNT(*) OVER() as total_count
|
||||
FROM YclientsServices u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3;
|
||||
|
||||
-- name: GetTimeslotsYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.*, COUNT(*) OVER() as total_count
|
||||
FROM YclientsTimeSlots u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3;
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3;
|
||||
|
||||
-- name: InsertYclientsTokens :one
|
||||
insert into YclientsTokens (AccountID,SalonID) values($1,$2) RETURNING *;
|
||||
|
||||
-- name: UpdateYclientsTokensAccessToken :one
|
||||
update YclientsTokens set AccessToken = $1, Active = true where AccountID = $2 and SalonID = $3 and Expiration = false RETURNING *;
|
||||
|
||||
-- name: UpdateYclientsTokensExpiration :one
|
||||
update YclientsTokens set Expiration=$1, Active = $2 where AccountID = $3 RETURNING *;
|
||||
|
||||
-- name: GetYclientsUserToken :one
|
||||
select * from YclientsTokens where AccountID = $1 and Expiration=false and Active = true;
|
||||
@ -1,18 +1,27 @@
|
||||
CREATE TABLE IF NOT EXISTS YclientsTokens (
|
||||
AccountID VARCHAR(30) PRIMARY KEY, -- связь с users AccountID неявная посредством join
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
AccessToken TEXT NOT NULL DEFAULT '',
|
||||
Active BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
Expiration BOOLEAN NOT NULL DEFAULT FALSE, -- флаг истек ли токен
|
||||
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
create UNIQUE INDEX idx_unique_tokens_yclients ON YclientsTokens (SalonID, AccountID) WHERE Active = false and Expiration = false;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS YclientsAccounts (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
AccountID VARCHAR(30) NOT NULL DEFAULT '', -- ID аккаунта у нас
|
||||
YclientsID INT NOT NULL, -- ID "аккаунта который ГЛАВНЫЙ"
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
Name VARCHAR(512) NOT NULL DEFAULT '',
|
||||
Country VARCHAR(50) NOT NULL DEFAULT '',
|
||||
Deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
Subdomain VARCHAR(50) NOT NULL DEFAULT '' -- поддомен - пример https://penadigitaltech.amocrm.ru
|
||||
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS YclientsAccountUsers (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
YclientsID INT NOT NULL, -- ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID INT NOT NULL, -- ID компании
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
YclientsUserID INT NOT NULL, -- ID пользователя в Yclients
|
||||
Name VARCHAR(512) NOT NULL DEFAULT '',
|
||||
Role INT NOT NULL DEFAULT 0, -- position
|
||||
@ -22,8 +31,7 @@ CREATE TABLE IF NOT EXISTS YclientsAccountUsers (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS YclientsCompany (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
YclientsID INT NOT NULL, -- ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID INT NOT NULL,
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
Title text NOT NULL,
|
||||
ShortDecription text NOT NULL,
|
||||
Active INT NOT NULL,
|
||||
@ -35,8 +43,7 @@ CREATE TABLE IF NOT EXISTS YclientsCompany (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS YclientsServices (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
YclientsID INT NOT NULL, -- ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID INT NOT NULL, -- ID компании
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
ServiceID INT NOT NULL,
|
||||
Title text NOT NULL,
|
||||
CategoryID INT NOT NULL,
|
||||
@ -52,8 +59,7 @@ CREATE TABLE IF NOT EXISTS YclientsServices (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS YclientsTimeSlots (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
YclientsID INT NOT NULL, -- ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID INT NOT NULL, -- ID компании
|
||||
SalonID INT NOT NULL, -- ID компании
|
||||
IsEnabled BOOLEAN NOT NULL DEFAULT false,
|
||||
WeekdaysSettings JSONB NOT NULL DEFAULT '[]',
|
||||
DatesSettings JSONB NOT NULL DEFAULT '{}',
|
||||
|
||||
@ -400,64 +400,68 @@ type Usersamo struct {
|
||||
}
|
||||
|
||||
type Yclientsaccount struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
type Yclientsaccountuser struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Yclientsuserid int32 `db:"yclientsuserid" json:"yclientsuserid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Yclientsuserid int32 `db:"yclientsuserid" json:"yclientsuserid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
type Yclientscompany struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Shortdecription string `db:"shortdecription" json:"shortdecription"`
|
||||
Active int32 `db:"active" json:"active"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Grouppriority int32 `db:"grouppriority" json:"grouppriority"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Shortdecription string `db:"shortdecription" json:"shortdecription"`
|
||||
Active int32 `db:"active" json:"active"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Grouppriority int32 `db:"grouppriority" json:"grouppriority"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
type Yclientsservice struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Serviceid int32 `db:"serviceid" json:"serviceid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Categoryid int32 `db:"categoryid" json:"categoryid"`
|
||||
Pricemin string `db:"pricemin" json:"pricemin"`
|
||||
Pricemax string `db:"pricemax" json:"pricemax"`
|
||||
Discount string `db:"discount" json:"discount"`
|
||||
Comment string `db:"comment" json:"comment"`
|
||||
Active string `db:"active" json:"active"`
|
||||
Apiid string `db:"apiid" json:"apiid"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Serviceid int32 `db:"serviceid" json:"serviceid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Categoryid int32 `db:"categoryid" json:"categoryid"`
|
||||
Pricemin string `db:"pricemin" json:"pricemin"`
|
||||
Pricemax string `db:"pricemax" json:"pricemax"`
|
||||
Discount string `db:"discount" json:"discount"`
|
||||
Comment string `db:"comment" json:"comment"`
|
||||
Active string `db:"active" json:"active"`
|
||||
Apiid string `db:"apiid" json:"apiid"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
type Yclientstimeslot struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Isenabled bool `db:"isenabled" json:"isenabled"`
|
||||
Weekdayssettings json.RawMessage `db:"weekdayssettings" json:"weekdayssettings"`
|
||||
Datessettings json.RawMessage `db:"datessettings" json:"datessettings"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Isenabled bool `db:"isenabled" json:"isenabled"`
|
||||
Weekdayssettings json.RawMessage `db:"weekdayssettings" json:"weekdayssettings"`
|
||||
Datessettings json.RawMessage `db:"datessettings" json:"datessettings"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
type Yclientstoken struct {
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Accesstoken string `db:"accesstoken" json:"accesstoken"`
|
||||
Active bool `db:"active" json:"active"`
|
||||
Expiration bool `db:"expiration" json:"expiration"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
@ -2385,11 +2385,11 @@ func (q *Queries) GetBitrixTokenById(ctx context.Context, accountid string) (Bit
|
||||
|
||||
const getCompanyYclientsWithPagination = `-- name: GetCompanyYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.id, u.yclientsid, u.yclientscompanyid, u.title, u.shortdecription, u.active, u.country, u.grouppriority, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
SELECT u.id, u.salonid, u.title, u.shortdecription, u.active, u.country, u.grouppriority, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
FROM YclientsCompany u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3
|
||||
`
|
||||
@ -2401,17 +2401,16 @@ type GetCompanyYclientsWithPaginationParams struct {
|
||||
}
|
||||
|
||||
type GetCompanyYclientsWithPaginationRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Shortdecription string `db:"shortdecription" json:"shortdecription"`
|
||||
Active int32 `db:"active" json:"active"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Grouppriority int32 `db:"grouppriority" json:"grouppriority"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Shortdecription string `db:"shortdecription" json:"shortdecription"`
|
||||
Active int32 `db:"active" json:"active"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Grouppriority int32 `db:"grouppriority" json:"grouppriority"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetCompanyYclientsWithPagination(ctx context.Context, arg GetCompanyYclientsWithPaginationParams) ([]GetCompanyYclientsWithPaginationRow, error) {
|
||||
@ -2425,8 +2424,7 @@ func (q *Queries) GetCompanyYclientsWithPagination(ctx context.Context, arg GetC
|
||||
var i GetCompanyYclientsWithPaginationRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Yclientsid,
|
||||
&i.Yclientscompanyid,
|
||||
&i.Salonid,
|
||||
&i.Title,
|
||||
&i.Shortdecription,
|
||||
&i.Active,
|
||||
@ -2489,21 +2487,22 @@ func (q *Queries) GetCurrentCompany(ctx context.Context, accountid string) (Acco
|
||||
}
|
||||
|
||||
const getCurrentYclientsCompany = `-- name: GetCurrentYclientsCompany :one
|
||||
SELECT id, accountid, yclientsid, name, country, deleted, createdat, subdomain FROM YclientsAccounts WHERE AccountID = $1 AND Deleted = false
|
||||
|
||||
SELECT id, accountid, salonid, name, country, deleted, createdat FROM YclientsAccounts WHERE AccountID = $1 AND Deleted = false
|
||||
`
|
||||
|
||||
// Yclients
|
||||
func (q *Queries) GetCurrentYclientsCompany(ctx context.Context, accountid string) (Yclientsaccount, error) {
|
||||
row := q.db.QueryRowContext(ctx, getCurrentYclientsCompany, accountid)
|
||||
var i Yclientsaccount
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Accountid,
|
||||
&i.Yclientsid,
|
||||
&i.Salonid,
|
||||
&i.Name,
|
||||
&i.Country,
|
||||
&i.Deleted,
|
||||
&i.Createdat,
|
||||
&i.Subdomain,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -3654,11 +3653,11 @@ func (q *Queries) GetResultAnswers(ctx context.Context, id int64) ([]GetResultAn
|
||||
|
||||
const getServicesYclientsWithPagination = `-- name: GetServicesYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.id, u.yclientsid, u.yclientscompanyid, u.serviceid, u.title, u.categoryid, u.pricemin, u.pricemax, u.discount, u.comment, u.active, u.apiid, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
SELECT u.id, u.salonid, u.serviceid, u.title, u.categoryid, u.pricemin, u.pricemax, u.discount, u.comment, u.active, u.apiid, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
FROM YclientsServices u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3
|
||||
`
|
||||
@ -3670,21 +3669,20 @@ type GetServicesYclientsWithPaginationParams struct {
|
||||
}
|
||||
|
||||
type GetServicesYclientsWithPaginationRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Serviceid int32 `db:"serviceid" json:"serviceid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Categoryid int32 `db:"categoryid" json:"categoryid"`
|
||||
Pricemin string `db:"pricemin" json:"pricemin"`
|
||||
Pricemax string `db:"pricemax" json:"pricemax"`
|
||||
Discount string `db:"discount" json:"discount"`
|
||||
Comment string `db:"comment" json:"comment"`
|
||||
Active string `db:"active" json:"active"`
|
||||
Apiid string `db:"apiid" json:"apiid"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Serviceid int32 `db:"serviceid" json:"serviceid"`
|
||||
Title string `db:"title" json:"title"`
|
||||
Categoryid int32 `db:"categoryid" json:"categoryid"`
|
||||
Pricemin string `db:"pricemin" json:"pricemin"`
|
||||
Pricemax string `db:"pricemax" json:"pricemax"`
|
||||
Discount string `db:"discount" json:"discount"`
|
||||
Comment string `db:"comment" json:"comment"`
|
||||
Active string `db:"active" json:"active"`
|
||||
Apiid string `db:"apiid" json:"apiid"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetServicesYclientsWithPagination(ctx context.Context, arg GetServicesYclientsWithPaginationParams) ([]GetServicesYclientsWithPaginationRow, error) {
|
||||
@ -3698,8 +3696,7 @@ func (q *Queries) GetServicesYclientsWithPagination(ctx context.Context, arg Get
|
||||
var i GetServicesYclientsWithPaginationRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Yclientsid,
|
||||
&i.Yclientscompanyid,
|
||||
&i.Salonid,
|
||||
&i.Serviceid,
|
||||
&i.Title,
|
||||
&i.Categoryid,
|
||||
@ -3863,11 +3860,11 @@ func (q *Queries) GetTagsWithPagination(ctx context.Context, arg GetTagsWithPagi
|
||||
|
||||
const getTimeslotsYclientsWithPagination = `-- name: GetTimeslotsYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.id, u.yclientsid, u.yclientscompanyid, u.isenabled, u.weekdayssettings, u.datessettings, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
SELECT u.id, u.salonid, u.isenabled, u.weekdayssettings, u.datessettings, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
FROM YclientsTimeSlots u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3
|
||||
`
|
||||
@ -3879,15 +3876,14 @@ type GetTimeslotsYclientsWithPaginationParams struct {
|
||||
}
|
||||
|
||||
type GetTimeslotsYclientsWithPaginationRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Isenabled bool `db:"isenabled" json:"isenabled"`
|
||||
Weekdayssettings json.RawMessage `db:"weekdayssettings" json:"weekdayssettings"`
|
||||
Datessettings json.RawMessage `db:"datessettings" json:"datessettings"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Isenabled bool `db:"isenabled" json:"isenabled"`
|
||||
Weekdayssettings json.RawMessage `db:"weekdayssettings" json:"weekdayssettings"`
|
||||
Datessettings json.RawMessage `db:"datessettings" json:"datessettings"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetTimeslotsYclientsWithPagination(ctx context.Context, arg GetTimeslotsYclientsWithPaginationParams) ([]GetTimeslotsYclientsWithPaginationRow, error) {
|
||||
@ -3901,8 +3897,7 @@ func (q *Queries) GetTimeslotsYclientsWithPagination(ctx context.Context, arg Ge
|
||||
var i GetTimeslotsYclientsWithPaginationRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Yclientsid,
|
||||
&i.Yclientscompanyid,
|
||||
&i.Salonid,
|
||||
&i.Isenabled,
|
||||
&i.Weekdayssettings,
|
||||
&i.Datessettings,
|
||||
@ -4447,11 +4442,11 @@ func (q *Queries) GetUsersWithPagination(ctx context.Context, arg GetUsersWithPa
|
||||
|
||||
const getUsersYclientsWithPagination = `-- name: GetUsersYclientsWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT YclientsID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
SELECT SalonID FROM YclientsAccounts WHERE YclientsAccounts.AccountID = $1 AND YclientsAccounts.Deleted = false
|
||||
)
|
||||
SELECT u.id, u.yclientsid, u.yclientscompanyid, u.yclientsuserid, u.name, u.role, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
SELECT u.id, u.salonid, u.yclientsuserid, u.name, u.role, u.deleted, u.createdat, COUNT(*) OVER() as total_count
|
||||
FROM YclientsAccountUsers u
|
||||
JOIN user_data a ON u.YclientsID = a.YclientsID
|
||||
JOIN user_data a ON u.SalonID = a.SalonID
|
||||
WHERE u.Deleted = false
|
||||
ORDER BY u.ID OFFSET ($2 - 1) * $3 LIMIT $3
|
||||
`
|
||||
@ -4463,15 +4458,14 @@ type GetUsersYclientsWithPaginationParams struct {
|
||||
}
|
||||
|
||||
type GetUsersYclientsWithPaginationRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Yclientsid int32 `db:"yclientsid" json:"yclientsid"`
|
||||
Yclientscompanyid int32 `db:"yclientscompanyid" json:"yclientscompanyid"`
|
||||
Yclientsuserid int32 `db:"yclientsuserid" json:"yclientsuserid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Yclientsuserid int32 `db:"yclientsuserid" json:"yclientsuserid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUsersYclientsWithPagination(ctx context.Context, arg GetUsersYclientsWithPaginationParams) ([]GetUsersYclientsWithPaginationRow, error) {
|
||||
@ -4485,8 +4479,7 @@ func (q *Queries) GetUsersYclientsWithPagination(ctx context.Context, arg GetUse
|
||||
var i GetUsersYclientsWithPaginationRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Yclientsid,
|
||||
&i.Yclientscompanyid,
|
||||
&i.Salonid,
|
||||
&i.Yclientsuserid,
|
||||
&i.Name,
|
||||
&i.Role,
|
||||
@ -4507,6 +4500,24 @@ func (q *Queries) GetUsersYclientsWithPagination(ctx context.Context, arg GetUse
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getYclientsUserToken = `-- name: GetYclientsUserToken :one
|
||||
select accountid, salonid, accesstoken, active, expiration, createdat from YclientsTokens where AccountID = $1 and Expiration=false and Active = true
|
||||
`
|
||||
|
||||
func (q *Queries) GetYclientsUserToken(ctx context.Context, accountid string) (Yclientstoken, error) {
|
||||
row := q.db.QueryRowContext(ctx, getYclientsUserToken, accountid)
|
||||
var i Yclientstoken
|
||||
err := row.Scan(
|
||||
&i.Accountid,
|
||||
&i.Salonid,
|
||||
&i.Accesstoken,
|
||||
&i.Active,
|
||||
&i.Expiration,
|
||||
&i.Createdat,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const gettingAmoUsersTrueResults = `-- name: GettingAmoUsersTrueResults :many
|
||||
SELECT a.quiz_id,a.id,a.result,a.question_id,a.content,a.session,
|
||||
COALESCE((SELECT a2.utm
|
||||
@ -5002,6 +5013,29 @@ func (q *Queries) InsertQuizPrivilegeUsage(ctx context.Context, arg InsertQuizPr
|
||||
return i, err
|
||||
}
|
||||
|
||||
const insertYclientsTokens = `-- name: InsertYclientsTokens :one
|
||||
insert into YclientsTokens (AccountID,SalonID) values($1,$2) RETURNING accountid, salonid, accesstoken, active, expiration, createdat
|
||||
`
|
||||
|
||||
type InsertYclientsTokensParams struct {
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
}
|
||||
|
||||
func (q *Queries) InsertYclientsTokens(ctx context.Context, arg InsertYclientsTokensParams) (Yclientstoken, error) {
|
||||
row := q.db.QueryRowContext(ctx, insertYclientsTokens, arg.Accountid, arg.Salonid)
|
||||
var i Yclientstoken
|
||||
err := row.Scan(
|
||||
&i.Accountid,
|
||||
&i.Salonid,
|
||||
&i.Accesstoken,
|
||||
&i.Active,
|
||||
&i.Expiration,
|
||||
&i.Createdat,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const moveToHistory = `-- name: MoveToHistory :one
|
||||
INSERT INTO question(
|
||||
quiz_id, title, description, questiontype, required,
|
||||
@ -5849,6 +5883,54 @@ func (q *Queries) UpdateTags(ctx context.Context, dollar_1 json.RawMessage) erro
|
||||
return err
|
||||
}
|
||||
|
||||
const updateYclientsTokensAccessToken = `-- name: UpdateYclientsTokensAccessToken :one
|
||||
update YclientsTokens set AccessToken = $1, Active = true where AccountID = $2 and SalonID = $3 and Expiration = false RETURNING accountid, salonid, accesstoken, active, expiration, createdat
|
||||
`
|
||||
|
||||
type UpdateYclientsTokensAccessTokenParams struct {
|
||||
Accesstoken string `db:"accesstoken" json:"accesstoken"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateYclientsTokensAccessToken(ctx context.Context, arg UpdateYclientsTokensAccessTokenParams) (Yclientstoken, error) {
|
||||
row := q.db.QueryRowContext(ctx, updateYclientsTokensAccessToken, arg.Accesstoken, arg.Accountid, arg.Salonid)
|
||||
var i Yclientstoken
|
||||
err := row.Scan(
|
||||
&i.Accountid,
|
||||
&i.Salonid,
|
||||
&i.Accesstoken,
|
||||
&i.Active,
|
||||
&i.Expiration,
|
||||
&i.Createdat,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateYclientsTokensExpiration = `-- name: UpdateYclientsTokensExpiration :one
|
||||
update YclientsTokens set Expiration=$1, Active = $2 where AccountID = $3 RETURNING accountid, salonid, accesstoken, active, expiration, createdat
|
||||
`
|
||||
|
||||
type UpdateYclientsTokensExpirationParams struct {
|
||||
Expiration bool `db:"expiration" json:"expiration"`
|
||||
Active bool `db:"active" json:"active"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateYclientsTokensExpiration(ctx context.Context, arg UpdateYclientsTokensExpirationParams) (Yclientstoken, error) {
|
||||
row := q.db.QueryRowContext(ctx, updateYclientsTokensExpiration, arg.Expiration, arg.Active, arg.Accountid)
|
||||
var i Yclientstoken
|
||||
err := row.Scan(
|
||||
&i.Accountid,
|
||||
&i.Salonid,
|
||||
&i.Accesstoken,
|
||||
&i.Active,
|
||||
&i.Expiration,
|
||||
&i.Createdat,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updatingDealAmoStatus = `-- name: UpdatingDealAmoStatus :exec
|
||||
UPDATE amoCRMStatuses SET Status = $1
|
||||
WHERE DealID = $2 AND AccountID = (SELECT u.AmoID FROM tokens AS t JOIN accountsAmo AS u ON t.AccountID = u.AccountID WHERE t.AccessToken = $3 AND u.Deleted = false)
|
||||
|
||||
@ -2,27 +2,34 @@ package model
|
||||
|
||||
import "time"
|
||||
|
||||
type YclientsToken struct {
|
||||
AccountID string `json:"accountID"` // ID аккаунта нас
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
AccessToken string `json:"access_token"`
|
||||
Active bool `json:"active"`
|
||||
Expiration bool `json:"expiration"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type YclientsAccount struct {
|
||||
ID int64 `json:"id"`
|
||||
AccountID string `json:"accountID"` // ID аккаунта нас
|
||||
YclientsID int32 `json:"yclientsID"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Subdomain string `json:"subdomain"`
|
||||
Stale bool `json:"stale"`
|
||||
ID int64 `json:"id"`
|
||||
AccountID string `json:"accountID"` // ID аккаунта нас
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Stale bool `json:"stale"`
|
||||
}
|
||||
|
||||
type YclientsAccountUser struct {
|
||||
ID int64 `json:"id"`
|
||||
YclientsID int32 `json:"yclientsID"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID int32 `json:"yclientsCompanyID"` // ID компании
|
||||
YclientsUserID int32 `json:"yclientsUserID"`
|
||||
Name string `json:"name"`
|
||||
Role int32 `json:"role"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID int64 `json:"id"`
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsUserID int32 `json:"yclientsUserID"`
|
||||
Name string `json:"name"`
|
||||
Role int32 `json:"role"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type UserListYclientsResp struct {
|
||||
@ -31,16 +38,15 @@ type UserListYclientsResp struct {
|
||||
}
|
||||
|
||||
type YclientsCompany struct {
|
||||
ID int64 `json:"id"`
|
||||
YclientsID int32 `json:"yclientsID"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID int32 `json:"yclientsCompanyID"`
|
||||
Title string `json:"title"`
|
||||
ShortDecription string `json:"shortDecription"`
|
||||
Active int32 `json:"active"`
|
||||
Country string `json:"country"`
|
||||
GroupPriority int32 `json:"groupPriority"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID int64 `json:"id"`
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
Title string `json:"title"`
|
||||
ShortDecription string `json:"shortDecription"`
|
||||
Active int32 `json:"active"`
|
||||
Country string `json:"country"`
|
||||
GroupPriority int32 `json:"groupPriority"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type CompanyListYclientsResp struct {
|
||||
@ -49,20 +55,19 @@ type CompanyListYclientsResp struct {
|
||||
}
|
||||
|
||||
type YclientsServices struct {
|
||||
ID int64 `json:"id"`
|
||||
YclientsID int32 `json:"yclientsID"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID int32 `json:"yclientsCompanyID"` // ID компании
|
||||
ServiceID int32 `json:"serviceID"`
|
||||
Title string `json:"title"`
|
||||
CategoryID int32 `json:"categoryID"`
|
||||
PriceMin string `json:"priceMin"`
|
||||
PriceMax string `json:"priceMax"`
|
||||
Discount string `json:"discount"`
|
||||
Comment string `json:"comment"`
|
||||
Active string `json:"active"`
|
||||
ApiID string `json:"apiID"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID int64 `json:"id"`
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
ServiceID int32 `json:"serviceID"`
|
||||
Title string `json:"title"`
|
||||
CategoryID int32 `json:"categoryID"`
|
||||
PriceMin string `json:"priceMin"`
|
||||
PriceMax string `json:"priceMax"`
|
||||
Discount string `json:"discount"`
|
||||
Comment string `json:"comment"`
|
||||
Active string `json:"active"`
|
||||
ApiID string `json:"apiID"`
|
||||
Deleted bool `json:"deleted"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
type ServicesListYclientsResp struct {
|
||||
@ -71,9 +76,8 @@ type ServicesListYclientsResp struct {
|
||||
}
|
||||
|
||||
type Timeslots struct {
|
||||
ID int64 `json:"id"`
|
||||
YclientsID int32 `json:"yclientsID"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
YclientsCompanyID int32 `json:"yclientsCompanyID"` // ID компании
|
||||
ID int64 `json:"id"`
|
||||
SalonID int32 `json:"salon_id"` // ID "аккаунта который ГЛАВНЫЙ"
|
||||
// ниже то что используется в запросе
|
||||
IsEnabled bool `json:"is_enabled"`
|
||||
WeekdaysSettings []WeekdaySetting `json:"weekdays_settings"`
|
||||
|
||||
@ -25,6 +25,70 @@ func NewYclientsRepository(deps Deps) *YclientsRepository {
|
||||
}
|
||||
}
|
||||
|
||||
// tokens
|
||||
|
||||
func (r *YclientsRepository) InsertYclientsTokens(ctx context.Context, accountID string, salonID int32) error {
|
||||
_, err := r.queries.InsertYclientsTokens(ctx, sqlcgen.InsertYclientsTokensParams{
|
||||
Accountid: accountID,
|
||||
Salonid: salonID,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *YclientsRepository) UpdateYclientsTokensAccessToken(ctx context.Context, accountID string, salonID int32, yclientsAccessToken string) (*model.YclientsToken, error) {
|
||||
row, err := r.queries.UpdateYclientsTokensAccessToken(ctx, sqlcgen.UpdateYclientsTokensAccessTokenParams{
|
||||
Accountid: accountID,
|
||||
Salonid: salonID,
|
||||
Accesstoken: yclientsAccessToken,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &model.YclientsToken{
|
||||
AccountID: row.Accountid,
|
||||
SalonID: row.Salonid,
|
||||
AccessToken: row.Accesstoken,
|
||||
Active: row.Active,
|
||||
Expiration: row.Expiration,
|
||||
CreatedAt: row.Createdat,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *YclientsRepository) UpdateYclientsTokensExpiration(ctx context.Context, accountID string, active, expiration bool) error {
|
||||
_, err := r.queries.UpdateYclientsTokensExpiration(ctx, sqlcgen.UpdateYclientsTokensExpirationParams{
|
||||
Accountid: accountID,
|
||||
Active: active,
|
||||
Expiration: expiration,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *YclientsRepository) GetYclientsUserToken(ctx context.Context, accountID string) (*model.YclientsToken, error) {
|
||||
row, err := r.queries.GetYclientsUserToken(ctx, accountID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &model.YclientsToken{
|
||||
AccountID: row.Accountid,
|
||||
SalonID: row.Salonid,
|
||||
AccessToken: row.Accesstoken,
|
||||
Active: row.Active,
|
||||
Expiration: row.Expiration,
|
||||
CreatedAt: row.Createdat,
|
||||
}, err
|
||||
}
|
||||
|
||||
// users
|
||||
func (r *YclientsRepository) GetCurrentAccount(ctx context.Context, accountID string) (*model.YclientsAccount, error) {
|
||||
row, err := r.queries.GetCurrentYclientsCompany(ctx, accountID)
|
||||
if err != nil {
|
||||
@ -32,14 +96,13 @@ func (r *YclientsRepository) GetCurrentAccount(ctx context.Context, accountID st
|
||||
}
|
||||
|
||||
user := model.YclientsAccount{
|
||||
ID: row.ID,
|
||||
AccountID: row.Accountid,
|
||||
YclientsID: row.Yclientsid,
|
||||
Name: row.Name,
|
||||
Country: row.Country,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
Subdomain: row.Subdomain,
|
||||
ID: row.ID,
|
||||
AccountID: row.Accountid,
|
||||
SalonID: row.Salonid,
|
||||
Name: row.Name,
|
||||
Country: row.Country,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
}
|
||||
|
||||
//_, err = r.queries.CheckExpiredYclientsToken(ctx, accountID)
|
||||
@ -77,14 +140,13 @@ func (r *YclientsRepository) GettingUserWithPagination(ctx context.Context, req
|
||||
var count int64
|
||||
for _, row := range rows {
|
||||
users = append(users, model.YclientsAccountUser{
|
||||
ID: row.ID,
|
||||
YclientsID: row.Yclientsid,
|
||||
YclientsCompanyID: row.Yclientscompanyid,
|
||||
YclientsUserID: row.Yclientsuserid,
|
||||
Name: row.Name,
|
||||
Role: row.Role,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
ID: row.ID,
|
||||
SalonID: row.Salonid,
|
||||
YclientsUserID: row.Yclientsuserid,
|
||||
Name: row.Name,
|
||||
Role: row.Role,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
})
|
||||
count = row.TotalCount
|
||||
}
|
||||
@ -112,16 +174,15 @@ func (r *YclientsRepository) GettingCompanyWithPagination(ctx context.Context, r
|
||||
var count int64
|
||||
for _, row := range rows {
|
||||
users = append(users, model.YclientsCompany{
|
||||
ID: row.ID,
|
||||
YclientsID: row.Yclientsid,
|
||||
YclientsCompanyID: row.Yclientscompanyid,
|
||||
Title: row.Title,
|
||||
ShortDecription: row.Shortdecription,
|
||||
Active: row.Active,
|
||||
Country: row.Country,
|
||||
GroupPriority: row.Grouppriority,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
ID: row.ID,
|
||||
SalonID: row.Salonid,
|
||||
Title: row.Title,
|
||||
ShortDecription: row.Shortdecription,
|
||||
Active: row.Active,
|
||||
Country: row.Country,
|
||||
GroupPriority: row.Grouppriority,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
})
|
||||
count = row.TotalCount
|
||||
}
|
||||
@ -154,20 +215,19 @@ func (r *YclientsRepository) GettingServicesWithPagination(ctx context.Context,
|
||||
var count int64
|
||||
for _, row := range rows {
|
||||
users = append(users, model.YclientsServices{
|
||||
ID: row.ID,
|
||||
YclientsID: row.Yclientsid,
|
||||
YclientsCompanyID: row.Yclientscompanyid,
|
||||
ServiceID: row.Serviceid,
|
||||
Title: row.Title,
|
||||
CategoryID: row.Categoryid,
|
||||
PriceMin: row.Pricemin,
|
||||
PriceMax: row.Pricemax,
|
||||
Discount: row.Discount,
|
||||
Comment: row.Comment,
|
||||
Active: row.Active,
|
||||
ApiID: row.Apiid,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
ID: row.ID,
|
||||
SalonID: row.Salonid,
|
||||
ServiceID: row.Serviceid,
|
||||
Title: row.Title,
|
||||
CategoryID: row.Categoryid,
|
||||
PriceMin: row.Pricemin,
|
||||
PriceMax: row.Pricemax,
|
||||
Discount: row.Discount,
|
||||
Comment: row.Comment,
|
||||
Active: row.Active,
|
||||
ApiID: row.Apiid,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
})
|
||||
count = row.TotalCount
|
||||
}
|
||||
@ -212,14 +272,13 @@ func (r *YclientsRepository) GettingTimeslotsWithPagination(ctx context.Context,
|
||||
}
|
||||
|
||||
users = append(users, model.Timeslots{
|
||||
ID: row.ID,
|
||||
YclientsID: row.Yclientsid,
|
||||
YclientsCompanyID: row.Yclientscompanyid,
|
||||
IsEnabled: row.Isenabled,
|
||||
WeekdaysSettings: weekdaysSettings,
|
||||
DatesSettings: datesSettings,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
ID: row.ID,
|
||||
SalonID: row.Salonid,
|
||||
IsEnabled: row.Isenabled,
|
||||
WeekdaysSettings: weekdaysSettings,
|
||||
DatesSettings: datesSettings,
|
||||
Deleted: row.Deleted,
|
||||
CreatedAt: row.Createdat,
|
||||
})
|
||||
count = row.TotalCount
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user