@@ -29,10 +29,12 @@ import {
2929import linkQueryArgs from '../prisma-query-args/links.query-args' ;
3030import linkTypeQueryArgs from '../prisma-query-args/link-types.query-args' ;
3131import manufacturerQueryArgs from '../prisma-query-args/manufacturers.query-args' ;
32+ import materialTypeQueryArgs from '../prisma-query-args/material-type.query-args' ;
3233import { linkTypeTransformer } from '../transformers/links.transformer' ;
3334import { updateLinks , linkToChangeListValue } from '../utils/links.utils' ;
3435import { manufacturerTransformer } from '../transformers/manufacturer.transformer' ;
3536import { isUserPartOfTeams } from '../utils/teams.utils' ;
37+ import { materialTypeTransformer } from '../transformers/material-type.transformer' ;
3638
3739export default class ProjectsService {
3840 /**
@@ -760,7 +762,7 @@ export default class ProjectsService {
760762 return assembly ;
761763 }
762764
763- /*
765+ /**
764766 * Creates a new Manufacturer
765767 * @param submitter the user who's creating the manufacturer
766768 * @param name the name of the manufacturer
@@ -787,6 +789,7 @@ export default class ProjectsService {
787789
788790 /**
789791 * Get all the manufacturers in the database.
792+ * @param submitter the user who's getting all manufacturers
790793 * @returns all the manufacturers
791794 */
792795 static async getAllManufacturers ( submitter : User ) : Promise < Manufacturer [ ] > {
@@ -801,6 +804,23 @@ export default class ProjectsService {
801804 ) . map ( manufacturerTransformer ) ;
802805 }
803806
807+ /**
808+ * Get all the material types in the database.
809+ * @param submitter the user who's getting all material types
810+ * @returns all the material types
811+ */
812+ static async getAllMaterialTypes ( submitter : User ) : Promise < Material_Type [ ] > {
813+ if ( submitter . role === Role . GUEST ) {
814+ throw new AccessDeniedGuestException ( 'Get Material Types' ) ;
815+ }
816+
817+ return (
818+ await prisma . material_Type . findMany ( {
819+ ...materialTypeQueryArgs
820+ } )
821+ ) . map ( materialTypeTransformer ) ;
822+ }
823+
804824 /**
805825 * Create a new material type
806826 * @param name the name of the new material type
0 commit comments