diff --git a/src/modules/files/files.controller.ts b/src/modules/files/files.controller.ts index b723bf57..483fe5bd 100644 --- a/src/modules/files/files.controller.ts +++ b/src/modules/files/files.controller.ts @@ -25,7 +25,7 @@ export class FilesController { const file = await this.filesService.findOne(id); await file.visibility?.init(); - if (await this.filesService.canReadFile(file, req.user as User)) return file; + if (await this.filesService.canReadFile(file, req.user as User)) return file.toObject(); throw new UnauthorizedException(this.t.Errors.File.Unauthorized(file.visibility?.name)); } } diff --git a/src/modules/promotions/entities/promotion-picture.entity.ts b/src/modules/promotions/entities/promotion-picture.entity.ts index 2f7fdc8c..e3961876 100644 --- a/src/modules/promotions/entities/promotion-picture.entity.ts +++ b/src/modules/promotions/entities/promotion-picture.entity.ts @@ -13,7 +13,7 @@ export class PromotionPicture extends File implements PromotionPictur @OneToOne(() => Promotion, (promotion) => promotion.picture, { nullable: true, owner: true }) picture_promotion: Promotion; - @Property({ persist: false }) + @Property({ persist: false, hidden: true }) get owner(): Promotion { return this.picture_promotion; } diff --git a/src/modules/users/entities/user-banner.entity.ts b/src/modules/users/entities/user-banner.entity.ts index 0e853c3e..ff965505 100644 --- a/src/modules/users/entities/user-banner.entity.ts +++ b/src/modules/users/entities/user-banner.entity.ts @@ -13,7 +13,7 @@ export class UserBanner extends File implements UserBannerEntity { @OneToOne(() => User, (user) => user.banner, { nullable: true, owner: true }) banner_user: User; - @Property({ persist: false }) + @Property({ persist: false, hidden: true }) get owner(): User { return this.banner_user; } diff --git a/src/modules/users/entities/user-picture.entity.ts b/src/modules/users/entities/user-picture.entity.ts index 179f32c2..17da711a 100644 --- a/src/modules/users/entities/user-picture.entity.ts +++ b/src/modules/users/entities/user-picture.entity.ts @@ -13,7 +13,7 @@ export class UserPicture extends File implements UserPictureEntity { @OneToOne(() => User, (user) => user.picture, { nullable: true, owner: true }) picture_user: User; - @Property({ persist: false }) + @Property({ persist: false, hidden: true }) get owner(): User { return this.picture_user; } diff --git a/tests/e2e/files.e2e-spec.ts b/tests/e2e/files.e2e-spec.ts index a74d4449..68eb73b6 100644 --- a/tests/e2e/files.e2e-spec.ts +++ b/tests/e2e/files.e2e-spec.ts @@ -120,7 +120,6 @@ describe('Files (e2e)', () => { id: file.id, filename: 'test.png', mimetype: 'image/png', - path: 'test.png', size: 123, visibility: file.visibility.id, description: 'foo bar',