refactor(media-upload): explicitly use public note ID

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-09-18 20:38:50 +02:00 committed by Yannick Bungers
parent 2c1e0517ff
commit 2689f9f3dc
2 changed files with 3 additions and 3 deletions

View file

@ -19,13 +19,13 @@ export class MediaUploadDto extends BaseDto {
url: string;
/**
* The noteId of the note to which the uploaded file is linked to.
* The publicId of the note to which the uploaded file is linked to.
* @example "noteId" TODO how looks a note id?
*/
@IsString()
@IsOptional()
@ApiProperty()
noteId: string | null;
notePublicId: string | null;
/**
* The date when the upload objects was created.

View file

@ -225,7 +225,7 @@ export class MediaService {
async toMediaUploadDto(mediaUpload: MediaUpload): Promise<MediaUploadDto> {
return {
url: mediaUpload.fileUrl,
noteId: (await mediaUpload.note)?.id ?? null,
notePublicId: (await mediaUpload.note)?.publicId ?? null,
createdAt: mediaUpload.createdAt,
username: (await mediaUpload.user).username,
};