From 0e785e0c8c27e35910dd2fd07ad6b8412f735876 Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 21 Dec 2022 23:32:57 +1100 Subject: [PATCH] bigint --- TODO.md | 2 -- api/prisma/schema.prisma | 8 ++++---- api/src/offers.ts | 6 ++++-- client/src/routes/acp.tsx | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index d352325..e5ac3c7 100644 --- a/TODO.md +++ b/TODO.md @@ -3,8 +3,6 @@ contact options on landing page move want add to rpc -listing ids overflowing - skip unofficial release status stepper diff --git a/api/prisma/schema.prisma b/api/prisma/schema.prisma index 2b49044..a336aa9 100644 --- a/api/prisma/schema.prisma +++ b/api/prisma/schema.prisma @@ -11,8 +11,8 @@ datasource db { } model Listing { - id Int @id - seller Int + id BigInt @id + seller BigInt data Json wantId String @db.Uuid @@ -43,7 +43,7 @@ model User { model Want { id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - release Int + release BigInt data Json userId String @db.Uuid @@ -71,7 +71,7 @@ model Offer { shipping Decimal @db.Money total Decimal @db.Money - listingId Int + listingId BigInt listing Listing @relation(fields: [listingId], references: [id]) userId String @db.Uuid diff --git a/api/src/offers.ts b/api/src/offers.ts index f250e31..e7a0e11 100644 --- a/api/src/offers.ts +++ b/api/src/offers.ts @@ -112,12 +112,14 @@ export default function createOffers(log: Log, pg: Pg) { const offers = await pg.userOffers(user); const groups = Object.values(groupBy(offers, (o) => o.wantId)) .map(g => { - const offers = sortBy(g, sortOffers); - // the offer status is just the most advanced status // based on sort + const offers = sortBy(g, sortOffers); const status = offers[0].status; + // now actually sort them by price + offers.sort((a, b) => a.total - b.total); + const details = offers[0].want.data; return { diff --git a/client/src/routes/acp.tsx b/client/src/routes/acp.tsx index e59794f..0874e69 100644 --- a/client/src/routes/acp.tsx +++ b/client/src/routes/acp.tsx @@ -77,6 +77,7 @@ function Home() { return (
+
{offers.map(SellerGroup)}