diff --git a/database_migrations/000024_mock_sync_group_editing.down.sql b/database_migrations/000024_mock_sync_group_editing.down.sql
new file mode 100644
index 0000000..3c9a304
--- /dev/null
+++ b/database_migrations/000024_mock_sync_group_editing.down.sql
@@ -0,0 +1,21 @@
+BEGIN;
+
+
+DROP TABLE mock.shop_amazon_sync_group_editing_listings;
+DROP TABLE mock.shop_big_cartel_sync_group_editing_listings;
+DROP TABLE mock.shop_ebay_sync_group_editing_listings;
+DROP TABLE mock.shop_ecwid_sync_group_editing_listings;
+DROP TABLE mock.shop_etsy_sync_group_editing_listings;
+DROP TABLE mock.shop_shopify_sync_group_editing_listings;
+DROP TABLE mock.shop_square_online_sync_group_editing_listings;
+DROP TABLE mock.shop_squarespace_sync_group_editing_listings;
+DROP TABLE mock.shop_tiktok_sync_group_editing_listings;
+DROP TABLE mock.shop_walmart_marketplace_sync_group_editing_listings;
+DROP TABLE mock.shop_wix_sync_group_editing_listings;
+DROP TABLE mock.shop_woo_commerce_sync_group_editing_listings;
+DROP TABLE mock.shop_zoho_sync_group_editing_listings;
+DROP TABLE mock.sync_group_editing_listing_order_indexes;
+DROP TABLE mock.sync_group_editing;
+
+
+COMMIT;
diff --git a/database_migrations/000024_mock_sync_group_editing.up.sql b/database_migrations/000024_mock_sync_group_editing.up.sql
new file mode 100644
index 0000000..9e88900
--- /dev/null
+++ b/database_migrations/000024_mock_sync_group_editing.up.sql
@@ -0,0 +1,187 @@
+BEGIN;
+
+
+CREATE TABLE mock.sync_group_editing (
+ account_id INTEGER PRIMARY KEY REFERENCES mock.accounts ON DELETE CASCADE,
+ sync_group_id INTEGER NOT NULL REFERENCES mock.sync_groups ON DELETE CASCADE,
+
+ UNIQUE (account_id, sync_group_id),
+ UNIQUE (sync_group_id)
+);
+
+CREATE TABLE mock.sync_group_editing_listing_order_indexes (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL CHECK (order_index >= 0),
+
+ PRIMARY KEY (account_id, order_index)
+);
+
+CREATE TABLE mock.shop_amazon_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_amazon ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_big_cartel_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_big_cartel ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_ebay_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_ebay ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_ecwid_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_ecwid ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_etsy_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_etsy ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_shopify_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_shopify ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_square_online_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_square_online ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_squarespace_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_squarespace ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_tiktok_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_tiktok ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_walmart_marketplace_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_walmart_marketplace ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_wix_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_wix ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_woo_commerce_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_woo_commerce ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+CREATE TABLE mock.shop_zoho_sync_group_editing_listings (
+ account_id INTEGER NOT NULL REFERENCES mock.sync_group_editing ON DELETE CASCADE,
+ order_index INTEGER NOT NULL,
+ shop_id TEXT NOT NULL,
+ listing_id TEXT,
+
+ PRIMARY KEY (account_id, order_index),
+ UNIQUE (account_id, shop_id),
+ FOREIGN KEY (account_id, shop_id) REFERENCES mock.shop_zoho ON DELETE CASCADE,
+ FOREIGN KEY (account_id, order_index) REFERENCES mock.sync_group_editing_listing_order_indexes ON DELETE CASCADE
+);
+
+
+
+GRANT ALL ON SCHEMA mock TO PUBLIC;
+
+
+
+
+
+
+
+
+
+COMMIT;
diff --git a/domains/accounts/accounts.go b/domains/accounts/accounts.go
index 3224a5f..16011f6 100644
--- a/domains/accounts/accounts.go
+++ b/domains/accounts/accounts.go
@@ -39,6 +39,7 @@ type (
Listing struct {
AccountShopListingIDs
+ ShopName string
SKU string
Name string
Description string
@@ -362,17 +363,23 @@ func (db *Store) GetMockListingsForShop(ctx context.Context, acctID int64, platf
fmt.Sprintf(
`
SELECT
- listing_id,
- sku,
- name,
- description,
- "count"
+ sh.name as shop_name,
+ li.listing_id,
+ li.sku,
+ li.name,
+ li.description,
+ li."count"
FROM
- %s
+ %s as sh
+ JOIN
+ %s as li
+ USING
+ (account_id, shop_id)
WHERE
account_id = @account_id
AND shop_id = @shop_id
`,
+ in.shopTable,
in.listingsTable,
),
pgx.NamedArgs{
@@ -385,6 +392,7 @@ func (db *Store) GetMockListingsForShop(ctx context.Context, acctID int64, platf
}
vs, err := pgx.CollectRows(rows, pgx.RowToStructByNameLax[struct {
+ Shop_name string
Listing_id string
SKU string
Name string
@@ -401,6 +409,7 @@ func (db *Store) GetMockListingsForShop(ctx context.Context, acctID int64, platf
AccountShopListingIDs: NewAccountIDs(acctID).
ShopID(in.platform, shopID).
ListingID(v.Listing_id),
+ ShopName: v.Shop_name,
SKU: v.SKU,
Name: v.Name,
Description: v.Description,
@@ -422,17 +431,23 @@ func (db *Store) GetMockListing(ctx context.Context, acctID int64, platform Plat
fmt.Sprintf(
`
SELECT
- name,
- count,
- sku,
- description
+ sh.name as shop_name,
+ li.name,
+ li.count,
+ li.sku,
+ li.description
FROM
- %s
+ %s AS sh
+ JOIN
+ %s AS li
+ USING
+ (account_id, shop_id)
WHERE
account_id = @account_id
AND shop_id = @shop_id
AND listing_id = @listing_id
`,
+ in.shopTable,
in.listingsTable,
),
pgx.NamedArgs{
@@ -446,6 +461,7 @@ func (db *Store) GetMockListing(ctx context.Context, acctID int64, platform Plat
}
v, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByNameLax[struct {
+ Shop_name string
Name string
Count int64
Sku string
@@ -469,6 +485,7 @@ func (db *Store) GetMockListing(ctx context.Context, acctID int64, platform Plat
},
ListingID: listingID,
},
+ ShopName: v.Shop_name,
SKU: v.Sku,
Name: v.Name,
Description: v.Name,
@@ -502,7 +519,13 @@ func (db *Store) DeleteMockSyncGroup(ctx context.Context, acctID, syncGroupID in
}
func (db *Store) StartEditingMockSyncGroup(ctx context.Context, acctID, syncGroupID int64) (prevSyncGroupID int64, prevSyncGroupExists bool, err error) {
- rows, err := db.db.Query(
+ tx, err := db.db.Begin(ctx)
+ if err != nil {
+ return 0, false, fmt.Errorf("failed to begin transaction: %w", err)
+ }
+ defer tx.Rollback(ctx)
+
+ rows, err := tx.Query(
ctx,
`
WITH deleted_row AS (
@@ -551,13 +574,77 @@ func (db *Store) StartEditingMockSyncGroup(ctx context.Context, acctID, syncGrou
}
v, err := pgx.CollectExactlyOneRow(rows, pgx.RowTo[pgtype.Int8])
- if err != nil {
- if errors.Is(err, pgx.ErrNoRows) {
- return 0, false, nil
- }
+ if err != nil && !errors.Is(err, pgx.ErrNoRows) {
return 0, false, fmt.Errorf("failed to scan rows: %w", err)
}
+ // insert the mock sync group listings into the draft table
+
+ for _, in := range getAllMockShopSchemaInfos() {
+ _, err := tx.Exec(
+ ctx,
+ fmt.Sprintf(
+ `
+ WITH existing_listings AS (
+ SELECT
+ shop_id,
+ listing_id,
+ order_index
+ FROM
+ %s
+ WHERE
+ account_id = @account_id
+ AND sync_group_id = @sync_group_id
+ ), inserted_order_indexes AS (
+ INSERT INTO
+ mock.sync_group_editing_listing_order_indexes (
+ account_id,
+ order_index
+ )
+ SELECT
+ @account_id,
+ order_index
+ FROM
+ existing_listings
+ RETURNING
+ order_index
+ )
+ INSERT INTO
+ %s (
+ account_id,
+ shop_id,
+ listing_id,
+ order_index
+ )
+ SELECT
+ @account_id,
+ shop_id,
+ listing_id,
+ order_index
+ FROM
+ existing_listings
+ JOIN
+ inserted_order_indexes
+ USING
+ (order_index)
+ `,
+ in.syncGroupListingsTable,
+ in.syncGroupEditingListingTable,
+ ),
+ pgx.NamedArgs{
+ "account_id": acctID,
+ "sync_group_id": syncGroupID,
+ },
+ )
+ if err != nil {
+ return 0, false, fmt.Errorf("failed to insert into editing listings table: %w", err)
+ }
+ }
+
+ if err := tx.Commit(ctx); err != nil {
+ return 0, false, fmt.Errorf("failed to commit transaction: %w", err)
+ }
+
return v.Int64, v.Valid, nil
}
diff --git a/domains/accounts/dev.go b/domains/accounts/dev.go
index 6063894..b2c939e 100644
--- a/domains/accounts/dev.go
+++ b/domains/accounts/dev.go
@@ -108,6 +108,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "1",
},
+ ShopName: "Etsy 1",
SKU: "sku 1",
Name: "name 1",
Description: "description 1",
@@ -124,6 +125,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "2",
},
+ ShopName: "Etsy 1",
SKU: "sku 2",
Name: "name 2",
Description: "description 2",
@@ -140,6 +142,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "3",
},
+ ShopName: "Etsy 1",
SKU: "sku 3",
Name: "name 3",
Description: "description 3",
@@ -156,6 +159,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "4",
},
+ ShopName: "Etsy 1",
SKU: "sku 4",
Name: "name 4",
Description: "description 4",
@@ -172,6 +176,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "5",
},
+ ShopName: "Etsy 1",
SKU: "sku 5",
Name: "name 5",
Description: "description 5",
@@ -188,6 +193,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "6",
},
+ ShopName: "Etsy 1",
SKU: "sku 6",
Name: "name 6",
Description: "description 6",
@@ -204,6 +210,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "7",
},
+ ShopName: "Etsy 2",
SKU: "sku 7",
Name: "name 7",
Description: "description 7",
@@ -220,6 +227,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "8",
},
+ ShopName: "Etsy 2",
SKU: "sku 8",
Name: "name 8",
Description: "description 8",
@@ -236,6 +244,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "9",
},
+ ShopName: "Etsy 2",
SKU: "sku 9",
Name: "name 9",
Description: "description 9",
@@ -252,6 +261,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "10",
},
+ ShopName: "Etsy 2",
SKU: "sku 10",
Name: "name 10",
Description: "description 10",
@@ -268,6 +278,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "11",
},
+ ShopName: "Etsy 2",
SKU: "sku 11",
Name: "name 11",
Description: "description 11",
@@ -284,6 +295,7 @@ func getDevListings(acctID int64) []Listing {
},
ListingID: "12",
},
+ ShopName: "Etsy 2",
SKU: "sku 12",
Name: "name 12",
Description: "description 12",
diff --git a/domains/accounts/mocks.go b/domains/accounts/mocks.go
index 7b201fc..ccd39bf 100644
--- a/domains/accounts/mocks.go
+++ b/domains/accounts/mocks.go
@@ -523,11 +523,12 @@ func getMockShopTableName(platform Platform) (string, error) {
}
type mockShopSchemaInfo struct {
- platform Platform
- shopTable string
- listingsTable string
- syncGroupListingsTable string
- syncGroupListingDraftsTable string
+ platform Platform
+ shopTable string
+ listingsTable string
+ syncGroupListingsTable string
+ syncGroupListingDraftsTable string
+ syncGroupEditingListingTable string
}
func getMockShopSchemaInfo(platform Platform) (mockShopSchemaInfo, bool) {
@@ -543,95 +544,108 @@ func getMockShopSchemaInfo(platform Platform) (mockShopSchemaInfo, bool) {
func getAllMockShopSchemaInfos() []mockShopSchemaInfo {
return []mockShopSchemaInfo{
{
- platform: Amazon,
- shopTable: "mock.shop_amazon",
- listingsTable: "mock.shop_amazon_listings",
- syncGroupListingsTable: "mock.shop_amazon_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_amazon_sync_group_listing_drafts",
+ platform: Amazon,
+ shopTable: "mock.shop_amazon",
+ listingsTable: "mock.shop_amazon_listings",
+ syncGroupListingsTable: "mock.shop_amazon_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_amazon_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_amazon_sync_group_editing_listings",
},
{
- platform: BigCartel,
- shopTable: "mock.shop_big_cartel",
- listingsTable: "mock.shop_big_cartel_listings",
- syncGroupListingsTable: "mock.shop_big_cartel_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_big_cartel_sync_group_listing_drafts",
+ platform: BigCartel,
+ shopTable: "mock.shop_big_cartel",
+ listingsTable: "mock.shop_big_cartel_listings",
+ syncGroupListingsTable: "mock.shop_big_cartel_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_big_cartel_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_big_cartel_sync_group_editing_listings",
},
{
- platform: Ebay,
- shopTable: "mock.shop_ebay",
- listingsTable: "mock.shop_ebay_listings",
- syncGroupListingsTable: "mock.shop_ebay_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_ebay_sync_group_listing_drafts",
+ platform: Ebay,
+ shopTable: "mock.shop_ebay",
+ listingsTable: "mock.shop_ebay_listings",
+ syncGroupListingsTable: "mock.shop_ebay_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_ebay_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_ebay_sync_group_editing_listings",
},
{
- platform: Ecwid,
- shopTable: "mock.shop_ecwid",
- listingsTable: "mock.shop_ecwid_listings",
- syncGroupListingsTable: "mock.shop_ecwid_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_ecwid_sync_group_listing_drafts",
+ platform: Ecwid,
+ shopTable: "mock.shop_ecwid",
+ listingsTable: "mock.shop_ecwid_listings",
+ syncGroupListingsTable: "mock.shop_ecwid_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_ecwid_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_ecwid_sync_group_editing_listings",
},
{
- platform: Etsy,
- shopTable: "mock.shop_etsy",
- listingsTable: "mock.shop_etsy_listings",
- syncGroupListingsTable: "mock.shop_etsy_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_etsy_sync_group_listing_drafts",
+ platform: Etsy,
+ shopTable: "mock.shop_etsy",
+ listingsTable: "mock.shop_etsy_listings",
+ syncGroupListingsTable: "mock.shop_etsy_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_etsy_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_etsy_sync_group_editing_listings",
},
{
- platform: Shopify,
- shopTable: "mock.shop_shopify",
- listingsTable: "mock.shop_shopify_listings",
- syncGroupListingsTable: "mock.shop_shopify_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_shopify_sync_group_listing_drafts",
+ platform: Shopify,
+ shopTable: "mock.shop_shopify",
+ listingsTable: "mock.shop_shopify_listings",
+ syncGroupListingsTable: "mock.shop_shopify_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_shopify_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_shopify_sync_group_editing_listings",
},
{
- platform: SquareOnline,
- shopTable: "mock.shop_square_online",
- listingsTable: "mock.shop_square_online_listings",
- syncGroupListingsTable: "mock.shop_square_online_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_square_online_sync_group_listing_drafts",
+ platform: SquareOnline,
+ shopTable: "mock.shop_square_online",
+ listingsTable: "mock.shop_square_online_listings",
+ syncGroupListingsTable: "mock.shop_square_online_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_square_online_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_square_online_sync_group_editing_listings",
},
{
- platform: Squarespace,
- shopTable: "mock.shop_squarespace",
- listingsTable: "mock.shop_squarespace_listings",
- syncGroupListingsTable: "mock.shop_squarespace_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_squarespace_sync_group_listing_drafts",
+ platform: Squarespace,
+ shopTable: "mock.shop_squarespace",
+ listingsTable: "mock.shop_squarespace_listings",
+ syncGroupListingsTable: "mock.shop_squarespace_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_squarespace_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_squarespace_sync_group_editing_listings",
},
{
- platform: Tiktok,
- shopTable: "mock.shop_tiktok",
- listingsTable: "mock.shop_tiktok_listings",
- syncGroupListingsTable: "mock.shop_tiktok_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_tiktok_sync_group_listing_drafts",
+ platform: Tiktok,
+ shopTable: "mock.shop_tiktok",
+ listingsTable: "mock.shop_tiktok_listings",
+ syncGroupListingsTable: "mock.shop_tiktok_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_tiktok_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_tiktok_sync_group_editing_listings",
},
{
- platform: WalmartMarketplace,
- shopTable: "mock.shop_walmart_marketplace",
- listingsTable: "mock.shop_walmart_marketplace_listings",
- syncGroupListingsTable: "mock.shop_walmart_marketplace_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_walmart_marketplace_sync_group_listing_drafts",
+ platform: WalmartMarketplace,
+ shopTable: "mock.shop_walmart_marketplace",
+ listingsTable: "mock.shop_walmart_marketplace_listings",
+ syncGroupListingsTable: "mock.shop_walmart_marketplace_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_walmart_marketplace_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_walmart_marketplace_sync_group_editing_listings",
},
{
- platform: Wix,
- shopTable: "mock.shop_wix",
- listingsTable: "mock.shop_wix_listings",
- syncGroupListingsTable: "mock.shop_wix_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_wix_sync_group_listing_drafts",
+ platform: Wix,
+ shopTable: "mock.shop_wix",
+ listingsTable: "mock.shop_wix_listings",
+ syncGroupListingsTable: "mock.shop_wix_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_wix_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_wix_sync_group_editing_listings",
},
{
- platform: WooCommerce,
- shopTable: "mock.shop_woo_commerce",
- listingsTable: "mock.shop_woo_commerce_listings",
- syncGroupListingsTable: "mock.shop_woo_commerce_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_woo_commerce_sync_group_listing_drafts",
+ platform: WooCommerce,
+ shopTable: "mock.shop_woo_commerce",
+ listingsTable: "mock.shop_woo_commerce_listings",
+ syncGroupListingsTable: "mock.shop_woo_commerce_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_woo_commerce_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_woo_commerce_sync_group_editing_listings",
},
{
- platform: Zoho,
- shopTable: "mock.shop_zoho",
- listingsTable: "mock.shop_zoho_listings",
- syncGroupListingsTable: "mock.shop_zoho_sync_group_listings",
- syncGroupListingDraftsTable: "mock.shop_zoho_sync_group_listing_drafts",
+ platform: Zoho,
+ shopTable: "mock.shop_zoho",
+ listingsTable: "mock.shop_zoho_listings",
+ syncGroupListingsTable: "mock.shop_zoho_sync_group_listings",
+ syncGroupListingDraftsTable: "mock.shop_zoho_sync_group_listing_drafts",
+ syncGroupEditingListingTable: "mock.shop_zoho_sync_group_editing_listings",
},
}
}
diff --git a/styles/index.css b/styles/index.css
index 7f52acb..08a19fc 100644
--- a/styles/index.css
+++ b/styles/index.css
@@ -220,79 +220,10 @@
}
}
}
- .grid-table-\[minmax\(20vw\,80vw\)_1fr_1fr_1fr_1fr_1fr\] {
+ .grid-table-\[1fr_1fr_1fr_1fr_1fr_1fr_1fr\] {
&:is(table) {
display: grid;
- grid-template-columns: minmax(20vw,80vw) 1fr 1fr 1fr 1fr 1fr;
- & > :is(thead, tbody, tfoot) {
- grid-column-start: 1;
- grid-column-end: -1;
- display: grid;
- grid-template-columns: subgrid;
- & > tr {
- grid-column-start: 1;
- grid-column-end: -1;
- display: grid;
- grid-template-columns: subgrid;
- & > th, & > td {
- grid-column: span 1;
- align-content: center;
- text-align: center;
- }
- }
- }
- }
- }
- .grid-table-\[minmax\(20vw\,max-content\)_1fr_1fr_1fr_1fr_1fr\] {
- &:is(table) {
- display: grid;
- grid-template-columns: minmax(20vw,max-content) 1fr 1fr 1fr 1fr 1fr;
- & > :is(thead, tbody, tfoot) {
- grid-column-start: 1;
- grid-column-end: -1;
- display: grid;
- grid-template-columns: subgrid;
- & > tr {
- grid-column-start: 1;
- grid-column-end: -1;
- display: grid;
- grid-template-columns: subgrid;
- & > th, & > td {
- grid-column: span 1;
- align-content: center;
- text-align: center;
- }
- }
- }
- }
- }
- .grid-table-\[minmax\(auto\,80vw\)_1fr_1fr_1fr_1fr_1fr\] {
- &:is(table) {
- display: grid;
- grid-template-columns: minmax(auto,80vw) 1fr 1fr 1fr 1fr 1fr;
- & > :is(thead, tbody, tfoot) {
- grid-column-start: 1;
- grid-column-end: -1;
- display: grid;
- grid-template-columns: subgrid;
- & > tr {
- grid-column-start: 1;
- grid-column-end: -1;
- display: grid;
- grid-template-columns: subgrid;
- & > th, & > td {
- grid-column: span 1;
- align-content: center;
- text-align: center;
- }
- }
- }
- }
- }
- .grid-table-\[minmax\(min-content\,80vw\)_1fr_1fr_1fr_1fr_1fr\] {
- &:is(table) {
- display: grid;
- grid-template-columns: minmax(min-content,80vw) 1fr 1fr 1fr 1fr 1fr;
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
& > :is(thead, tbody, tfoot) {
grid-column-start: 1;
grid-column-end: -1;
@@ -363,15 +294,9 @@
.my-\[0\.5em\] {
margin-block: 0.5em;
}
- .my-\[1em\] {
- margin-block: 1em;
- }
.my-\[1rem\] {
margin-block: 1rem;
}
- .mt-\[0\.5em\] {
- margin-top: 0.5em;
- }
.mt-\[0\.25em\] {
margin-top: 0.25em;
}
@@ -384,18 +309,9 @@
.mt-\[3em\] {
margin-top: 3em;
}
- .mb-\[-0\.5em\] {
- margin-bottom: -0.5em;
- }
- .mb-\[-1em\] {
- margin-bottom: -1em;
- }
.mb-\[0\.5em\] {
margin-bottom: 0.5em;
}
- .mb-\[0\] {
- margin-bottom: 0;
- }
.mb-\[1\.25rem\] {
margin-bottom: 1.25rem;
}
@@ -453,9 +369,6 @@
.w-full {
width: 100%;
}
- .max-w-\[10px\] {
- max-width: 10px;
- }
.max-w-\[50\%\] {
max-width: 50%;
}
@@ -471,9 +384,6 @@
.flex-shrink {
flex-shrink: 1;
}
- .flex-grow {
- flex-grow: 1;
- }
.flex-grow-\[1\] {
flex-grow: 1;
}
@@ -489,12 +399,6 @@
.basis-full {
flex-basis: 100%;
}
- .border-collapse {
- border-collapse: collapse;
- }
- .transform {
- transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
- }
.animate-pulse {
animation: var(--animate-pulse);
}
@@ -616,12 +520,6 @@
.bg-card {
background-color: var(--card);
}
- .bg-foreground {
- background-color: var(--foreground);
- }
- .bg-primary {
- background-color: var(--primary);
- }
.p-\[0\.5em\] {
padding: 0.5em;
}
@@ -661,9 +559,6 @@
.font-display {
font-family: var(--display-family);
}
- .font-text {
- font-family: var(--text-family);
- }
.text-lg {
font-size: var(--text-lg);
line-height: var(--tw-leading, var(--text-lg--line-height));
@@ -687,9 +582,6 @@
.text-nowrap {
text-wrap: nowrap;
}
- .text-wrap {
- text-wrap: wrap;
- }
.capitalize {
text-transform: capitalize;
}
@@ -699,10 +591,6 @@
.underline {
text-decoration-line: underline;
}
- .outline {
- outline-style: var(--tw-outline-style);
- outline-width: 1px;
- }
.outline-1 {
outline-style: var(--tw-outline-style);
outline-width: 1px;
@@ -1277,26 +1165,6 @@
}
}
}
-@property --tw-rotate-x {
- syntax: "*";
- inherits: false;
-}
-@property --tw-rotate-y {
- syntax: "*";
- inherits: false;
-}
-@property --tw-rotate-z {
- syntax: "*";
- inherits: false;
-}
-@property --tw-skew-x {
- syntax: "*";
- inherits: false;
-}
-@property --tw-skew-y {
- syntax: "*";
- inherits: false;
-}
@property --tw-border-style {
syntax: "*";
inherits: false;
@@ -1379,6 +1247,26 @@
inherits: false;
initial-value: 1;
}
+@property --tw-rotate-x {
+ syntax: "*";
+ inherits: false;
+}
+@property --tw-rotate-y {
+ syntax: "*";
+ inherits: false;
+}
+@property --tw-rotate-z {
+ syntax: "*";
+ inherits: false;
+}
+@property --tw-skew-x {
+ syntax: "*";
+ inherits: false;
+}
+@property --tw-skew-y {
+ syntax: "*";
+ inherits: false;
+}
@property --tw-content {
syntax: "*";
initial-value: "";
@@ -1396,11 +1284,6 @@
@layer properties {
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
*, ::before, ::after, ::backdrop {
- --tw-rotate-x: initial;
- --tw-rotate-y: initial;
- --tw-rotate-z: initial;
- --tw-skew-x: initial;
- --tw-skew-y: initial;
--tw-border-style: solid;
--tw-font-weight: initial;
--tw-outline-style: solid;
@@ -1420,6 +1303,11 @@
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-scale-z: 1;
+ --tw-rotate-x: initial;
+ --tw-rotate-y: initial;
+ --tw-rotate-z: initial;
+ --tw-skew-x: initial;
+ --tw-skew-y: initial;
--tw-content: "";
--tw-leading: initial;
}
diff --git a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/listings/{orderIndex.int}.html.tmpl b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/listings/{orderIndex.int}.html.tmpl
index c363ca7..f44b508 100644
--- a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/listings/{orderIndex.int}.html.tmpl
+++ b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/listings/{orderIndex.int}.html.tmpl
@@ -2,7 +2,10 @@
{{- $acctID := .PathParams.acctID }}
{{- $orderIndex := .PathParams.orderIndex }}
-{{- $entry := .Accounts.GetMockSyncGroupListingDraft $acctID $orderIndex }}
+{{- $entry := .Entry }}
+{{- if not $entry }}
+ {{- $entry = .Accounts.GetMockSyncGroupListingDraft $acctID $orderIndex }}
+{{- end }}
{{- $selectedShopPlatform := $entry.Platform }}
{{- $selectedShopID := $entry.ShopID }}
{{- $selectedListingID := $entry.ListingID }}
@@ -31,7 +34,7 @@
call setFilledOut(false)
"
>
-
+ |
{{/* TODO: filter out shops that are already selected */}}
{{- $shops := .Accounts.GetMockShops $acctID -}}
|
+
+ {{if $selectedListing}}{{$selectedListing.Count}}{{else}}-{{end}}
+ |
+
{{ component "button"
"HXDelete" (printf "/api/accounts/%d/inventory/sync-groups/mock/draft/listings/%d" $acctID $orderIndex)
diff --git a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/table/index.html.tmpl b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/table/index.html.tmpl
index 0617a71..0f34753 100644
--- a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/table/index.html.tmpl
+++ b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/draft/table/index.html.tmpl
@@ -10,7 +10,7 @@
class="
max-w-full overflow-x-auto
- grid-table-[1fr_1fr_1fr_1fr_1fr_1fr]
+ grid-table-[1fr_1fr_1fr_1fr_1fr_1fr_1fr]
max-h-[50vh]
"
hx-get="{{ printf "/ui/accounts/%d/inventory/sync-groups/mock/draft/table" $acctID }}"
@@ -35,6 +35,9 @@
|
Description
|
+
+ Count
+ |
|
@@ -67,6 +70,7 @@
{{- range $listing := $listings }}
{{- component (printf "accounts/%d/inventory/sync-groups/mock/draft/listings/%d" $acctID $listing.OrderIndex)
"Listings" $listings
+ "Entry" $listing
}}
{{- end }}
@@ -88,6 +92,9 @@
Description
|
+
+ Count
+ |
|
diff --git a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/{syncGroupID.int64}/list-item.html.tmpl b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/{syncGroupID.int64}/list-item.html.tmpl
index 1ee3fbe..77e551c 100644
--- a/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/{syncGroupID.int64}/list-item.html.tmpl
+++ b/templates/components/accounts/{acctID.int64}/inventory/sync-groups/mock/{syncGroupID.int64}/list-item.html.tmpl
@@ -45,6 +45,12 @@
+ |
+ Shop
+ |
+
+ Platform
+ |
Name
|
@@ -64,13 +70,19 @@
{{- range $listing := .Group.Listings }}
{{- $val := $dot.Accounts.GetMockListing $acctID $listing.Platform $listing.ShopID $listing.ListingID }}
+ |
+ {{ $val.ShopName }}
+ |
+ {{ $val.Platform }}
+ |
+
{{ $val.Name }}
|
-
+ |
{{ $val.SKU }}
|
-
+ |
{{ $val.Description }}
|
@@ -109,6 +121,12 @@
|