Add Wildberries product fetching and rate limiting functionality
This commit is contained in:
@@ -14,4 +14,5 @@ type Marketplace struct {
|
||||
Name string
|
||||
AuthData pgtype.Text
|
||||
WarehouseID pgtype.Text
|
||||
AuthDataJson []byte
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
const getMarketplaceByID = `-- name: GetMarketplaceByID :one
|
||||
SELECT id, base_marketplace, name, auth_data, warehouse_id FROM marketplaces
|
||||
SELECT id, base_marketplace, name, auth_data, warehouse_id, auth_data_json FROM marketplaces
|
||||
WHERE id = $1 LIMIT 1
|
||||
`
|
||||
|
||||
@@ -23,6 +23,7 @@ func (q *Queries) GetMarketplaceByID(ctx context.Context, id int32) (Marketplace
|
||||
&i.Name,
|
||||
&i.AuthData,
|
||||
&i.WarehouseID,
|
||||
&i.AuthDataJson,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
create table marketplaces
|
||||
(
|
||||
id serial
|
||||
id serial
|
||||
primary key,
|
||||
base_marketplace integer not null,
|
||||
name varchar not null,
|
||||
auth_data varchar,
|
||||
warehouse_id varchar
|
||||
base_marketplace integer not null,
|
||||
name varchar not null,
|
||||
auth_data varchar,
|
||||
warehouse_id varchar,
|
||||
auth_data_json jsonb generated always as (
|
||||
CASE
|
||||
WHEN ((auth_data)::text IS JSON) THEN (auth_data)::jsonb
|
||||
ELSE NULL::jsonb
|
||||
END) stored
|
||||
);
|
||||
Reference in New Issue
Block a user