Skip to content

Commit 9ed7b7b

Browse files
committed
pr feedback
1 parent dbd0d19 commit 9ed7b7b

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/api/project-showcase-post/dto/create-project-showcase-post.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 })

src/api/project-showcase-post/project-showcase-post.service.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)