Skip to content

Commit 70b4b58

Browse files
committed
Election committe now able to see applications from the law committee
1 parent b0d377f commit 70b4b58

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

backend/controllers/committeeController.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextFunction, Request, Response } from 'express'
22
import { CustomError, UnauthorizedUserError } from 'ntnui-tools/customError'
33
import { CommitteeModel } from '../models/Committee'
4-
import { ELECTION_COMMITTEE_ID, MAIN_BOARD_ID } from '../utils/constants'
4+
import { ELECTION_COMMITTEE_ID, MAIN_BOARD_ID, LAW_COMMITTEE_ID } from '../utils/constants'
55
import { RequestWithNtnuiNo } from '../utils/request'
66
import { getUserRoleInCommitteeByUserId } from '../utils/userCommittee'
77

@@ -32,9 +32,11 @@ async function acceptAdmissions(
3232
// If user is organizer, allow toggle of all except main board
3333
(userCommittee.committee === MAIN_BOARD_ID &&
3434
committee._id !== MAIN_BOARD_ID) ||
35-
// If user part of election committee, allow toggle of own and main board
35+
// If user part of election committee, allow toggle of own, main board and the law committee
3636
(userCommittee.committee === ELECTION_COMMITTEE_ID &&
37-
committee._id === MAIN_BOARD_ID) ||
37+
committee._id === userCommittee.committee ||
38+
committee._id === MAIN_BOARD_ID ||
39+
committee._id === LAW_COMMITTEE_ID) ||
3840
// If user is board member of the committee and is not in the main board
3941
(userCommittee.committee === committee._id &&
4042
committee._id !== MAIN_BOARD_ID)

backend/utils/constants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
/* eslint-disable no-console */
1+
/* eslint-disable no-console */
22
const MAIN_BOARD_ID = Number(process.env.MAIN_BOARD_ID) || 52
33
const ELECTION_COMMITTEE_ID = Number(process.env.ELECTION_COMMITTEE_ID) || 71
4+
const LAW_COMMITTEE_ID = Number(process.env.ELECTION_COMMITTEE_ID) || 72
45

56
console.log(`🔗 MAIN_BOARD_ID set to ${MAIN_BOARD_ID}`)
67
console.log(`🔗 ELECTION_COMMITTEE_ID set to ${ELECTION_COMMITTEE_ID}`)
8+
console.log(`🔗 LAW_COMMITTEE_ID set to ${LAW_COMMITTEE_ID}`)
79

8-
export { MAIN_BOARD_ID, ELECTION_COMMITTEE_ID }
10+
export { MAIN_BOARD_ID, ELECTION_COMMITTEE_ID, LAW_COMMITTEE_ID }

0 commit comments

Comments
 (0)