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
+12
-4
@@ -5,7 +5,7 @@ import groupBy from 'lodash/groupBy';
|
||||
import sortBy from 'lodash/sortBy';
|
||||
import { Context } from 'koa';
|
||||
|
||||
import { logAxiosError } from './utils';
|
||||
import { logAxiosError, wantDetails } from './utils';
|
||||
import { Pg } from './pg';
|
||||
|
||||
export enum Status {
|
||||
@@ -65,9 +65,17 @@ export default function createOffers(log: Log, pg: Pg) {
|
||||
}
|
||||
|
||||
async function statusSet(user: User, id: UUID, status: Status) {
|
||||
// check the user actually has this offer
|
||||
const offer = await pg.userOfferFind(user, id);
|
||||
return pg.offerStatusSet(offer.id, status);
|
||||
log.info({ status, id }, 'setting offer status');
|
||||
|
||||
const offer = await pg.offerFindId(id);
|
||||
const update = await pg.offerStatusSet(offer.id, status);
|
||||
|
||||
if (status === Status.Complete) {
|
||||
log.info({ id, status }, 'completed offer, removing want...');
|
||||
await pg.wantRm(offer.wantId);
|
||||
}
|
||||
|
||||
return update;
|
||||
}
|
||||
|
||||
async function bundles() {
|
||||
|
||||
Reference in new issue
Block a user