@@ -230,7 +230,7 @@ export const validateUserIsPartOfFinanceTeam = async (user: User) => {
230230 */
231231export const isUserOnFinanceTeam = async ( user : User ) : Promise < boolean > => {
232232 if ( ! process . env . FINANCE_TEAM_ID ) {
233- console . warn ( 'FINANCE_TEAM_ID not in env' ) ;
233+ throw new Error ( 'FINANCE_TEAM_ID not in env' ) ;
234234 }
235235
236236 const financeTeam = await prisma . team . findUnique ( {
@@ -246,7 +246,7 @@ export const isUserOnFinanceTeam = async (user: User): Promise<boolean> => {
246246 * Determines if a user is lead or head of the finance team.
247247 *
248248 * To be used for Prisma input validation of a plain User, as opposed to
249- * <code>isAuthUserLeadForFinance </code>, which uses the additional fields
249+ * <code>isAuthUserAtLeastLeadForFinance </code>, which uses the additional fields
250250 * produced by authUserQueryArgs that are not in the User type by default.
251251 *
252252 * @param user the user to authenticate
@@ -255,7 +255,7 @@ export const isUserOnFinanceTeam = async (user: User): Promise<boolean> => {
255255 */
256256export const isUserLeadOrHeadOfFinanceTeam = async ( user : User ) : Promise < boolean > => {
257257 if ( ! process . env . FINANCE_TEAM_ID ) {
258- console . error ( 'FINANCE_TEAM_ID not in env' ) ;
258+ throw new Error ( 'FINANCE_TEAM_ID not in env' ) ;
259259 }
260260
261261 const financeTeam = await prisma . team . findUnique ( {
@@ -284,7 +284,7 @@ export const isAuthUserOnFinance = (user: Prisma.UserGetPayload<typeof authUserQ
284284 * @param user the user to check
285285 * @returns Whether they are a finance lead.
286286 */
287- export const isAuthUserLeadForFinance = ( user : Prisma . UserGetPayload < typeof authUserQueryArgs > ) => {
287+ export const isAuthUserAtLeastLeadForFinance = ( user : Prisma . UserGetPayload < typeof authUserQueryArgs > ) => {
288288 if ( ! process . env . FINANCE_TEAM_ID ) return false ;
289289 const financeTeamId = process . env . FINANCE_TEAM_ID ;
290290 const { teamAsHead, teamsAsLead } = user ;
0 commit comments