File tree Expand file tree Collapse file tree
src/api/project-showcase-post Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export class CreateProjectShowcasePostDto {
4646 @IsUUID ( '4' , { each : true } )
4747 challengeIds ?: string [ ] ;
4848
49- @ApiPropertyOptional ( { type : [ Object ] } )
49+ @ApiPropertyOptional ( { type : [ ProjectShowcasePostMediaInputDto ] } )
5050 @IsOptional ( )
5151 @IsArray ( )
5252 @ValidateNested ( { each : true } )
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ export class ProjectShowcasePostService {
211211 create : ( dto . media || [ ] ) . map ( ( asset ) => ( {
212212 type : asset . type ,
213213 url : asset . url ,
214- createdBy : auditUserId ,
214+ createdBy : BigInt ( auditUserId ) ,
215215 } ) ) ,
216216 } ,
217217 } ,
@@ -297,13 +297,14 @@ export class ProjectShowcasePostService {
297297 } ;
298298 }
299299
300- if ( typeof dto . media !== 'undefined' ) {
300+ if ( typeof dto . media !== 'undefined' && Array . isArray ( dto . media ) ) {
301+ const auditUserId = BigInt ( getAuditUserId ( user ) ) ;
301302 updateData . media = {
302303 deleteMany : { } ,
303304 create : dto . media . map ( ( mediaItem ) => ( {
304305 type : mediaItem . type ,
305306 url : mediaItem . url ,
306- createdBy : getAuditUserId ( user ) ,
307+ createdBy : auditUserId ,
307308 } ) ) ,
308309 } ;
309310 }
@@ -458,7 +459,13 @@ export class ProjectShowcasePostService {
458459 post : ProjectShowcasePost & {
459460 industries : { industry : { id : bigint ; name : string } } [ ] ;
460461 categories : { category : { id : bigint ; name : string } } [ ] ;
461- media : { id : bigint ; type : string ; url : string ; createdAt : Date ; createdBy : bigint } [ ] ;
462+ media : {
463+ id : bigint ;
464+ type : string ;
465+ url : string ;
466+ createdAt : Date ;
467+ createdBy : bigint ;
468+ } [ ] ;
462469 } ,
463470 ) : ProjectShowcasePostResponseDto {
464471 return {
You can’t perform that action at this time.
0 commit comments