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; 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? * @example "noteId" TODO how looks a note id?
*/ */
@IsString() @IsString()
@IsOptional() @IsOptional()
@ApiProperty() @ApiProperty()
noteId: string | null; notePublicId: string | null;
/** /**
* The date when the upload objects was created. * The date when the upload objects was created.

View file

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