edit image business
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user