diff --git a/src/features/contribution/contribution.controller.ts b/src/features/contribution/contribution.controller.ts index d91faf55e..a93c0ddd7 100644 --- a/src/features/contribution/contribution.controller.ts +++ b/src/features/contribution/contribution.controller.ts @@ -33,11 +33,16 @@ export class ContributionController { getAvailableContributions(@Req() req: Request) { const panelFlaskUserId = req.headers['panelFlaskUserId']; const panelFlaskTypeId = req.headers['panelFlaskTypeId']; - if ( - !isAuthenticated(panelFlaskUserId, panelFlaskTypeId) || - panelFlaskTypeId !== FlaskUserTypesEnum.SUPER_ADMIN - ) { - throw new ForbiddenException(403, 'You Are not the Super admin'); + const dappFlaskUserId = req.headers['dappFlaskUserId']; + if (panelFlaskUserId) { + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(403, 'You Are not authorized'); + } + } + if (dappFlaskUserId) { + if (!isAuthenticated(dappFlaskUserId, FlaskUserTypesEnum.FAMILY)) { + throw new ForbiddenException(403, 'You Are not authorized'); + } } return this.contributionService.getAvailableContributions(); } diff --git a/src/features/contribution/contribution.service.ts b/src/features/contribution/contribution.service.ts index 27060ff4b..4f25e3ec6 100644 --- a/src/features/contribution/contribution.service.ts +++ b/src/features/contribution/contribution.service.ts @@ -12,7 +12,11 @@ export class ContributionService { ) {} getAvailableContributions(): Promise { - return this.contributionRepository.find(); + return this.contributionRepository.find({ + order: { + createdAt: 'DESC', + }, + }); } async getContribution(contributionId: string): Promise { diff --git a/src/features/midjourney/midjourney.service.ts b/src/features/midjourney/midjourney.service.ts index a06b2cf77..0c6b3de43 100644 --- a/src/features/midjourney/midjourney.service.ts +++ b/src/features/midjourney/midjourney.service.ts @@ -103,8 +103,6 @@ export class MidjourneyService { async getReadyToSignNeeds( options: PaginateQuery, ): Promise> { - console.log(options); - const queryBuilder = this.needRepository .createQueryBuilder('need') .leftJoinAndMapOne( diff --git a/src/features/need/need.service.ts b/src/features/need/need.service.ts index 1ca871cef..a8a001444 100644 --- a/src/features/need/need.service.ts +++ b/src/features/need/need.service.ts @@ -732,15 +732,12 @@ export class NeedService { ]) .cache(60000) .orderBy('need.created', 'ASC'); - console.log('need'); return await queryBuilder.getMany(); } async getDeleteCandidates(): Promise<[Need[], number]> { const date = new Date(); date.setMonth(date.getMonth() - 3); // three months ago - console.log(date); - return this.flaskNeedRepository .createQueryBuilder('need') .leftJoinAndMapOne( diff --git a/src/features/sync/sync.service.ts b/src/features/sync/sync.service.ts index 17fba26b1..2d62eb882 100644 --- a/src/features/sync/sync.service.ts +++ b/src/features/sync/sync.service.ts @@ -478,7 +478,6 @@ export class SyncService { nestReceipts.push(nestReceipt); console.log('\x1b[36m%s\x1b[0m', 'Created a Receipt ...\n'); } else if (nestReceipt) { - console.log(receiptDetails); await this.receiptService .updateReceipt(receiptDetails, nestReceipt) .then(); @@ -569,7 +568,6 @@ export class SyncService { nestPayment = await this.paymentService.getPaymentById( payments[p].id, ); - console.log(nestFamilyMember); console.log('\x1b[36m%s\x1b[0m', 'Payment updated ...\n'); } else { console.log('\x1b[36m%s\x1b[0m', 'Skipped Payment updating ...\n'); diff --git a/src/features/user/user.controller.ts b/src/features/user/user.controller.ts index 734e76dc1..a0b43022e 100644 --- a/src/features/user/user.controller.ts +++ b/src/features/user/user.controller.ts @@ -337,11 +337,6 @@ export class UserController { purchasedCount, deliveredCount, ); - console.log('X_LIMIT2'); - console.log(X_LIMIT); - console.log(X_TAKE); - console.log(limit); - console.log(page); return { page, diff --git a/src/features/wallet/wallet.controller.ts b/src/features/wallet/wallet.controller.ts index c14f45658..c223f0710 100644 --- a/src/features/wallet/wallet.controller.ts +++ b/src/features/wallet/wallet.controller.ts @@ -788,7 +788,6 @@ export class WalletController { ) { const panelFlaskUserId = Number(req.headers['panelFlaskUserId']); - console.log(panelFlaskUserId); if (panelFlaskUserId !== Number(flaskUserId)) { throw new WalletExceptionFilter(401, 'You only can get your signatures'); } diff --git a/src/features/wallet/wallet.service.ts b/src/features/wallet/wallet.service.ts index 0bf397959..4cc9d5a4c 100644 --- a/src/features/wallet/wallet.service.ts +++ b/src/features/wallet/wallet.service.ts @@ -192,7 +192,6 @@ export class WalletService { role = getSAYRolePersian(SAYPlatformRoles.FAMILY).toString(); allRoles.push(SAYPlatformRoles.FAMILY); } - console.log(need); if (!role) { throw new WalletExceptionFilter( diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 43f9eca9c..87bce8635 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -477,7 +477,6 @@ export function ticketNotifications( ), ); // when a user creates a ticket, the participants won't have a view assigned to them - // console.log(t.views); const myView = t.views.find((v) => v.flaskUserId === flaskUserId); const latestView = t.views.find( (v) => diff --git a/src/utils/math.ts b/src/utils/math.ts index f06dbec81..db5ec53bf 100644 --- a/src/utils/math.ts +++ b/src/utils/math.ts @@ -1,6 +1,5 @@ export function median(values: any[]) { - console.log(values); - if (values.length === 0) throw new Error('No inputs'); + if (values.length === 0) throw new Error('No inputs'); values.sort((a, b) => { return a - b; });