diff --git a/internal/domains/accounts/mocks.go b/internal/domains/accounts/mocks.go index 6da060e..4101641 100644 --- a/internal/domains/accounts/mocks.go +++ b/internal/domains/accounts/mocks.go @@ -8,6 +8,7 @@ import ( "github.com/google/uuid" "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" ) type ( @@ -354,8 +355,8 @@ func (db *Store) ListMockListingsForShop(ctx context.Context, acctID int64, plat ON TRUE WHERE - account_id = @account_id - AND shop_id = @shop_id + (account_id IS NULL OR account_id = @account_id) + AND (shop_id IS NULL OR shop_id = @shop_id) `, shopTableName, listingsTableName, @@ -371,11 +372,11 @@ func (db *Store) ListMockListingsForShop(ctx context.Context, acctID int64, plat vs, err := pgx.CollectRows(rows, pgx.RowToStructByNameLax[struct { Shop_exists bool - Listing_id string - SKU string - Name string - Description string - Count int64 + Listing_id pgtype.Text + SKU pgtype.Text + Name pgtype.Text + Description pgtype.Text + Count pgtype.Int8 }]) if err != nil { return nil, fmt.Errorf("failed to scan rows: %w", err) @@ -384,9 +385,10 @@ func (db *Store) ListMockListingsForShop(ctx context.Context, acctID int64, plat // check if the shop exists, and confirm there were actually listings (LEFT JOIN) if len(vs) == 0 || !vs[0].Shop_exists { + fmt.Println("TEST") return nil, fmt.Errorf("%w: shop not found", consts.ErrNotFound) } - if vs[0].SKU == "" { + if !vs[0].SKU.Valid { return nil, nil } @@ -401,12 +403,12 @@ func (db *Store) ListMockListingsForShop(ctx context.Context, acctID int64, plat Platform: platform, ShopID: shopID, }, - ListingID: v.Listing_id, + ListingID: v.Listing_id.String, }, - SKU: v.SKU, - Name: v.Name, - Description: v.Description, - Count: v.Count, + SKU: v.SKU.String, + Name: v.Name.String, + Description: v.Description.String, + Count: v.Count.Int64, } } diff --git a/styles/index.css b/styles/index.css index 3c6b0eb..886859d 100644 --- a/styles/index.css +++ b/styles/index.css @@ -265,6 +265,9 @@ .ml-\[1em\] { margin-left: 1em; } + .box-border { + box-sizing: border-box; + } .block { display: block; } @@ -289,15 +292,9 @@ .h-\[2rem\] { height: 2rem; } - .h-\[10em\] { - height: 10em; - } .h-fit { height: fit-content; } - .max-h-\[10em\] { - max-height: 10em; - } .max-h-\[50em\] { max-height: 50em; } @@ -403,6 +400,9 @@ .gap-\[1em\] { gap: 1em; } + .gap-x-\[1em\] { + column-gap: 1em; + } .gap-y-\[2em\] { row-gap: 2em; } @@ -421,9 +421,6 @@ .overflow-y-hidden { overflow-y: hidden; } - .overflow-y-scroll { - overflow-y: scroll; - } .rounded { border-radius: 0.25rem; } @@ -439,6 +436,10 @@ .rounded-sm { border-radius: calc(var(--radius) - 4px); } + .border { + border-style: var(--tw-border-style); + border-width: 1px; + } .border-\[1px\] { border-style: var(--tw-border-style); border-width: 1px; diff --git a/templates/pages/accounts/{acctID.int64}/platforms/{platform}/shops/mocks/{shopID}/index.html.tmpl b/templates/pages/accounts/{acctID.int64}/platforms/{platform}/shops/mocks/{shopID}/index.html.tmpl index 8c4721a..cea1164 100644 --- a/templates/pages/accounts/{acctID.int64}/platforms/{platform}/shops/mocks/{shopID}/index.html.tmpl +++ b/templates/pages/accounts/{acctID.int64}/platforms/{platform}/shops/mocks/{shopID}/index.html.tmpl @@ -29,7 +29,7 @@