File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 AccessDeniedGuestException ,
1010 HttpException ,
1111 NotFoundException ,
12- DeletedException
12+ DeletedException ,
13+ AccessDeniedException
1314} from '../utils/errors.utils' ;
1415import {
1516 addDescriptionBullets ,
@@ -610,7 +611,8 @@ export default class ProjectsService {
610611 * @throws if the submitter is not a leader or the material type with the given name already exists
611612 */
612613 static async createMaterialType ( name : string , submitter : User ) : Promise < Material_Type > {
613- if ( ! isLeadership ( submitter . role ) ) throw new AccessDeniedAdminOnlyException ( 'create material type' ) ;
614+ if ( ! isLeadership ( submitter . role ) )
615+ throw new AccessDeniedException ( 'Only leadership or above can create a material type' ) ;
614616
615617 const materialType = await prisma . material_Type . findUnique ( {
616618 where : {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import * as projectTransformer from '../src/transformers/projects.transformer';
99import ProjectsService from '../src/services/projects.services' ;
1010import {
1111 AccessDeniedAdminOnlyException ,
12+ AccessDeniedException ,
1213 DeletedException ,
1314 HttpException ,
1415 NotFoundException
@@ -258,7 +259,7 @@ describe('Projects', () => {
258259 describe ( 'materialType' , ( ) => {
259260 test ( 'Create material type fails if user is not leader' , async ( ) => {
260261 await expect ( ProjectsService . createMaterialType ( 'Tools' , wonderwoman ) ) . rejects . toThrow (
261- new AccessDeniedAdminOnlyException ( ' create material type')
262+ new AccessDeniedException ( 'Only leadership or above can create a material type')
262263 ) ;
263264 } ) ;
264265
You can’t perform that action at this time.
0 commit comments