wants wip"

This commit is contained in:
ntr committed 2022-08-16 10:09:36 +10:00
1 parent c99f6fd2b6
commit f5e75f4fe6
7 files changed
+33 -12

No files matched your search

+7
View File
@@ -17,6 +17,7 @@ export interface Pg {
userWants: (user: User) => Promise<Want[]>,
wantUpsert: (want: Want, user: User) => Promise<Want>,
wantFind: (user: User) => Promise<Want[]>,
listingUpsert: (listing: Listing, want: Want) => Promise<Listing>,
listingFind: (id: DiscogsListing) => Promise<Listing>,
listingRmUnlisted: (want: Want, ids: DiscogsListing[]) => Promise<number>,
@@ -53,6 +54,12 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
});
}
async function wantList(user: User) {
return prisma.want.findMany({
where: { userId: user.id },
});
}
async function wantUpsert(dcWant, user) {
const values: { userId: UUID, release: DiscogsListing, data: any } = {
data: dcWant,