From b9464adadaf6a5c7844cb56751f1e0b2384424aa Mon Sep 17 00:00:00 2001 From: Angel Beltran Date: Fri, 23 Jan 2026 20:13:41 -0700 Subject: [PATCH] fix create account link; more dev data --- internal/domains/accounts/accounts.go | 10 ++---- internal/domains/accounts/dev.go | 52 ++++++++++++++------------- templates/pages/index.html.tmpl | 2 +- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/internal/domains/accounts/accounts.go b/internal/domains/accounts/accounts.go index 01bf696..53a9c7d 100644 --- a/internal/domains/accounts/accounts.go +++ b/internal/domains/accounts/accounts.go @@ -287,10 +287,7 @@ func (db *Store) GetUserAndAccountByAccessToken(ctx context.Context, accessToken func (db *Store) GetShops(ctx context.Context, acctID int64) ([]AccountShop, error) { var shops []AccountShop - for _, v := range devShops { - if v.AccountID != acctID { - continue - } + for _, v := range getDevShops(acctID) { shops = append(shops, v) } @@ -299,10 +296,7 @@ func (db *Store) GetShops(ctx context.Context, acctID int64) ([]AccountShop, err func (db *Store) GetListingsForShop(ctx context.Context, acctID int64, platform Platform, shopID string) ([]Listing, error) { var vs []Listing - for _, v := range devListings { - if v.AccountID != acctID { - continue - } + for _, v := range getDevListings(acctID) { if v.Platform != platform { continue } diff --git a/internal/domains/accounts/dev.go b/internal/domains/accounts/dev.go index 3206c86..6063894 100644 --- a/internal/domains/accounts/dev.go +++ b/internal/domains/accounts/dev.go @@ -1,11 +1,11 @@ package accounts -var ( - devShops = []AccountShop{ +func getDevShops(acctID int64) []AccountShop { + return []AccountShop{ AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -15,7 +15,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -25,7 +25,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "8", @@ -35,7 +35,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Tiktok, ShopID: "11", @@ -45,7 +45,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Tiktok, ShopID: "14", @@ -55,7 +55,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Tiktok, ShopID: "17", @@ -65,7 +65,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Wix, ShopID: "20", @@ -75,7 +75,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Wix, ShopID: "23", @@ -85,7 +85,7 @@ var ( AccountShop{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Wix, ShopID: "26", @@ -93,13 +93,15 @@ var ( Name: "Wix 3", }, } +} - devListings = []Listing{ +func getDevListings(acctID int64) []Listing { + return []Listing{ { AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -115,7 +117,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -131,7 +133,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -147,7 +149,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -163,7 +165,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -179,7 +181,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "2", @@ -195,7 +197,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -211,7 +213,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -227,7 +229,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -243,7 +245,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -259,7 +261,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -275,7 +277,7 @@ var ( AccountShopListingIDs: AccountShopListingIDs{ AccountShopIDs: AccountShopIDs{ AccountIDs: AccountIDs{ - AccountID: 6, + AccountID: acctID, }, Platform: Etsy, ShopID: "5", @@ -288,4 +290,4 @@ var ( Count: 62, }, } -) +} diff --git a/templates/pages/index.html.tmpl b/templates/pages/index.html.tmpl index 79e642c..4b40846 100644 --- a/templates/pages/index.html.tmpl +++ b/templates/pages/index.html.tmpl @@ -23,7 +23,7 @@

- + Create an Account