prod nginx changes and remove want on offer complete
This commit is contained in:
1 parent
2c66c47163
commit
644398319d
6 files changed
+52
-18
No files matched your search
@@ -27,12 +27,14 @@ export interface Pg {
|
||||
wantCreate: (discogsWant: any, user: User) => Promise<Want>,
|
||||
wantList: (user: User) => Promise<Want[]>,
|
||||
wantsToSync: () => Promise<Want[]>,
|
||||
wantRm: (id: UUID) => Promise<void>,
|
||||
|
||||
bundleCandidates: () => Promise<Listing[][]>,
|
||||
|
||||
offersCreate: (offers: Offer[]) => Promise<Offer[]>,
|
||||
offerStatusSet: (id: UUID, status: Status) => Promise<Offer>,
|
||||
offersAdmin: () => Promise<Offer[]>,
|
||||
offerFindId: (id: UUID) => Promise<Offer>,
|
||||
}
|
||||
|
||||
export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
@@ -60,6 +62,15 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
});
|
||||
}
|
||||
|
||||
async function offerFindId(id: UUID) {
|
||||
return prisma.offer.findFirstOrThrow({
|
||||
where: { id },
|
||||
include: {
|
||||
want: true,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function userOfferFind(user: User, id: UUID) {
|
||||
return prisma.offer.findFirstOrThrow({
|
||||
where: {
|
||||
@@ -86,6 +97,9 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
});
|
||||
}
|
||||
|
||||
// userUpdate({ email: 'jen@vdk.com', password: 'jen' });
|
||||
// userUpdate({ email: 'james@mcd', password: 'james' });
|
||||
|
||||
async function userUpdate(params: UserCreateParams) {
|
||||
const hashRounds = 10;
|
||||
const password = await bcrypt.hash(params.password, hashRounds);
|
||||
@@ -111,6 +125,12 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
return prisma.want.findMany({});
|
||||
}
|
||||
|
||||
async function wantRm(id: UUID) {
|
||||
await prisma.want.delete({
|
||||
where: { id },
|
||||
});
|
||||
}
|
||||
|
||||
async function wantCreate(discogsRelease, user) {
|
||||
const data: { userId: UUID, release: DiscogsListing, data: any } = {
|
||||
data: discogsRelease,
|
||||
@@ -286,6 +306,8 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
wantCreate,
|
||||
wantList,
|
||||
wantsToSync,
|
||||
wantRm,
|
||||
|
||||
listingUpsert,
|
||||
listingFind,
|
||||
listingRmUnlisted,
|
||||
@@ -296,5 +318,6 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
offersCreate,
|
||||
offerStatusSet,
|
||||
offersAdmin,
|
||||
offerFindId,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user