bigint
This commit is contained in:
1 parent
6b73831b51
commit
0e785e0c8c
4 files changed
+9
-8
No files matched your search
@@ -3,8 +3,6 @@ contact options on landing page
|
|||||||
|
|
||||||
move want add to rpc
|
move want add to rpc
|
||||||
|
|
||||||
listing ids overflowing
|
|
||||||
|
|
||||||
skip unofficial release
|
skip unofficial release
|
||||||
|
|
||||||
status stepper
|
status stepper
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ datasource db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Listing {
|
model Listing {
|
||||||
id Int @id
|
id BigInt @id
|
||||||
seller Int
|
seller BigInt
|
||||||
data Json
|
data Json
|
||||||
|
|
||||||
wantId String @db.Uuid
|
wantId String @db.Uuid
|
||||||
@@ -43,7 +43,7 @@ model User {
|
|||||||
|
|
||||||
model Want {
|
model Want {
|
||||||
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||||
release Int
|
release BigInt
|
||||||
data Json
|
data Json
|
||||||
|
|
||||||
userId String @db.Uuid
|
userId String @db.Uuid
|
||||||
@@ -71,7 +71,7 @@ model Offer {
|
|||||||
shipping Decimal @db.Money
|
shipping Decimal @db.Money
|
||||||
total Decimal @db.Money
|
total Decimal @db.Money
|
||||||
|
|
||||||
listingId Int
|
listingId BigInt
|
||||||
listing Listing @relation(fields: [listingId], references: [id])
|
listing Listing @relation(fields: [listingId], references: [id])
|
||||||
|
|
||||||
userId String @db.Uuid
|
userId String @db.Uuid
|
||||||
|
|||||||
+4
-2
@@ -112,12 +112,14 @@ export default function createOffers(log: Log, pg: Pg) {
|
|||||||
const offers = await pg.userOffers(user);
|
const offers = await pg.userOffers(user);
|
||||||
const groups = Object.values(groupBy(offers, (o) => o.wantId))
|
const groups = Object.values(groupBy(offers, (o) => o.wantId))
|
||||||
.map(g => {
|
.map(g => {
|
||||||
const offers = sortBy(g, sortOffers);
|
|
||||||
|
|
||||||
// the offer status is just the most advanced status
|
// the offer status is just the most advanced status
|
||||||
// based on sort
|
// based on sort
|
||||||
|
const offers = sortBy(g, sortOffers);
|
||||||
const status = offers[0].status;
|
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;
|
const details = offers[0].want.data;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ function Home() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<button onClick={sync}> sync listings </button>
|
<button onClick={sync}> sync listings </button>
|
||||||
|
<button onClick={sync}> generate offers </button>
|
||||||
<hr />
|
<hr />
|
||||||
<div class='bundles'>
|
<div class='bundles'>
|
||||||
{offers.map(SellerGroup)}
|
{offers.map(SellerGroup)}
|
||||||
|
|||||||
Reference in new issue
Block a user