@@ -569,43 +569,24 @@ export default class OrganizationsService {
569569 * @param organizationId the organization which the images will be set up
570570 * @param images the images which are being set
571571 */
572- static async setPlatformLogoImage (
573- platformLogoImageId : Express . Multer . File | null ,
574- submitter : User ,
575- organization : Organization
576- ) {
572+ static async setPlatformLogoImage ( platformLogoImage : Express . Multer . File , submitter : User , organization : Organization ) {
577573 if ( ! ( await userHasPermission ( submitter . userId , organization . organizationId , isAdmin ) ) ) {
578574 throw new AccessDeniedAdminOnlyException ( 'update platform logo' ) ;
579575 }
580576
581- const platformLogoImageData = platformLogoImageId ? await uploadFile ( platformLogoImageId ) : null ;
577+ const platformLogoImageData = await uploadFile ( platformLogoImage ) ;
582578
583- const updateData = {
584- ... ( platformLogoImageData && { platformLogoImageId : platformLogoImageData . id } )
585- } ;
579+ if ( ! platformLogoImageData ?. id || ! platformLogoImageData ?. name ) {
580+ throw new HttpException ( 500 , 'Platform logo upload failed' ) ;
581+ }
586582
587583 const newImages = await prisma . organization . update ( {
588584 where : { organizationId : organization . organizationId } ,
589- data : updateData
585+ data : {
586+ platformLogoImageId : platformLogoImageData . id
587+ }
590588 } ) ;
591589
592590 return newImages ;
593591 }
594-
595- /**
596- * Gets platform logo image for the given organization
597- * @param organizationId organization Id of the milestone
598- * @returns all the milestones from the given organization
599- */
600- static async getPlatformLogoImage ( organizationId : string ) {
601- const organization = await prisma . organization . findUnique ( {
602- where : { organizationId }
603- } ) ;
604-
605- if ( ! organization ) {
606- throw new NotFoundException ( 'Organization' , organizationId ) ;
607- }
608-
609- return organization . platformLogoImageId ;
610- }
611592}
0 commit comments