Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make country and state a dropdown in shipping info section #88

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions fake-snippets-api/lib/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ export const loginPageSchema = z.object({
})
export type LoginPage = z.infer<typeof loginPageSchema>

const shippingInfoSchema = z.object({
fullName: z.string(),
export const shippingInfoSchema = z.object({
firstName: z.string(),
lastName: z.string(),
companyName: z.string().optional(),
address: z.string(),
apartment: z.string().optional(),
city: z.string(),
state: z.string(),
zipCode: z.string(),
country: z.string(),
phone: z.string(),
})

export const accountSchema = z.object({
Expand Down
8 changes: 6 additions & 2 deletions fake-snippets-api/lib/db/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ export const seed = (db: DbClient) => {
account_id: "account-1234",
github_username: "testuser",
shippingInfo: {
fullName: "Test User",
firstName: "Test",
lastName: "User",
companyName: "Test Company",
address: "123 Test St",
apartment: "Apt 4B",
city: "Testville",
state: "NY",
zipCode: "10001",
country: "United States",
country: "United States of America",
phone: "555-123-4567",
},
})
db.addAccount({
Expand Down
14 changes: 4 additions & 10 deletions fake-snippets-api/routes/api/accounts/update.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { withRouteSpec } from "fake-snippets-api/lib/middleware/with-winter-spec"
import { z } from "zod"
import { accountSchema } from "fake-snippets-api/lib/db/schema"

const shippingInfoSchema = z.object({
fullName: z.string(),
address: z.string(),
city: z.string(),
state: z.string(),
zipCode: z.string(),
country: z.string(),
})
import {
accountSchema,
shippingInfoSchema,
} from "fake-snippets-api/lib/db/schema"

export default withRouteSpec({
methods: ["POST"],
Expand Down
8 changes: 6 additions & 2 deletions fake-snippets-api/tests/fixtures/get-test-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ const seedDatabase = (db: DbClient) => {
const account = db.addAccount({
github_username: "testuser",
shippingInfo: {
fullName: "Test User",
firstName: "Test",
lastName: "User",
companyName: "Test Company",
address: "123 Test St",
apartment: "Apt 4B",
city: "Testville",
state: "NY",
zipCode: "10001",
country: "United States",
country: "United States of America",
phone: "555-123-4567",
},
})
const order = db.addOrder({
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"clsx": "^2.1.1",
"cmdk": "1.0.0",
"codemirror": "^6.0.1",
"country-list": "^2.3.0",
"date-fns": "^4.1.0",
"easyeda": "^0.0.51",
"embla-carousel-react": "^8.3.0",
Expand All @@ -95,6 +96,7 @@
"react-resizable-panels": "^2.1.3",
"recharts": "^2.12.7",
"sonner": "^1.5.0",
"states-us": "^1.1.1",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"use-async-memo": "^1.2.5",
Expand All @@ -110,6 +112,7 @@
"@tscircuit/prompt-benchmarks": "^0.0.14",
"@types/babel__standalone": "^7.1.7",
"@types/bun": "^1.1.10",
"@types/country-list": "^2.1.4",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
Expand Down
Loading
Loading