Skip to content

Commit

Permalink
fix: forcepay uses default usertype, shop list is available when shop…
Browse files Browse the repository at this point in the history
… is closed
  • Loading branch information
AlbanSdl committed Nov 26, 2021
1 parent d36ef7b commit 4a6643a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/controllers/items/getItems.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NextFunction, Request, Response } from 'express';
import { isShopAllowed } from '../../middlewares/settings';
// import { isShopAllowed } from '../../middlewares/settings';
import { fetchUserItems } from '../../operations/item';
import { filterItem } from '../../utils/filters';
import { success } from '../../utils/responses';
import { getRequestInfo } from '../../utils/users';

export default [
// Middlewares
isShopAllowed,
// Middlewares (commented out to allow users to access the list of their purchases)
// isShopAllowed,

// Controller
async (request: Request, response: Response, next: NextFunction) => {
Expand Down
5 changes: 2 additions & 3 deletions src/operations/carts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ export const forcePay = (user: Pick<RawUser, 'type' | 'id'>) => {
case UserType.spectator:
itemId = `ticket-${user.type}`;
break;
default: {
throw new Error(`Can't pay for ${user.type}`);
}
default:
itemId = `ticket-${UserType.spectator}`;
}

return database.cart.create({
Expand Down

0 comments on commit 4a6643a

Please sign in to comment.