edit image business

This commit is contained in:
2026-06-13 12:39:35 +03:30
parent 4e33d3f8e1
commit 1d685b3338
3 changed files with 145 additions and 11 deletions
@@ -92,6 +92,19 @@ export class BusinessImagesService {
return saved;
}
async setCover(businessId: string, imageId: string): Promise<BusinessImageEntity> {
const image = await this.imageRepo.findOne({
where: { id: imageId, businessId },
});
if (!image) {
throw new NotFoundException('Image not found');
}
await this.imageRepo.update({ businessId }, { isCover: false });
image.isCover = true;
return this.imageRepo.save(image);
}
async remove(businessId: string, imageId: string): Promise<void> {
const image = await this.imageRepo.findOne({
where: { id: imageId, businessId },