logo set
This commit is contained in:
@@ -22,6 +22,7 @@ import { BusinessImageEntity } from '../../entities/business-image.entity';
|
||||
import { UserEntity, UserRole } from '../../entities/user.entity';
|
||||
import { AuthUser } from '../auth/auth.types';
|
||||
import { BusinessImagesService } from './business-images.service';
|
||||
import { BusinessLogosService } from './business-logos.service';
|
||||
import { AssignBusinessOwnerDto } from './dto/assign-business-owner.dto';
|
||||
import { CreateBusinessDto } from './dto/create-business.dto';
|
||||
import { SetAvailabilityDto } from './dto/set-availability.dto';
|
||||
@@ -49,6 +50,7 @@ export class BusinessesService {
|
||||
private readonly reviewRepo: Repository<BookingReviewEntity>,
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly images: BusinessImagesService,
|
||||
private readonly logos: BusinessLogosService,
|
||||
) {}
|
||||
|
||||
async findAll(filters: FindAllFilters): Promise<BusinessEntity[]> {
|
||||
@@ -199,7 +201,7 @@ export class BusinessesService {
|
||||
}
|
||||
|
||||
async remove(id: string): Promise<void> {
|
||||
await this.findOne(id);
|
||||
const business = await this.findOne(id);
|
||||
|
||||
const imageUrls = await this.images.listUrlsForBusiness(id);
|
||||
|
||||
@@ -208,6 +210,7 @@ export class BusinessesService {
|
||||
});
|
||||
|
||||
this.images.deleteFiles(imageUrls);
|
||||
this.logos.deleteLogoFiles(business);
|
||||
}
|
||||
|
||||
async getAvailability(businessId: string) {
|
||||
@@ -424,6 +427,23 @@ export class BusinessesService {
|
||||
return this.images.upload(business.id, files);
|
||||
}
|
||||
|
||||
async uploadMyLogo(
|
||||
variant: 'light' | 'dark',
|
||||
file: Express.Multer.File,
|
||||
actor: AuthUser,
|
||||
): Promise<BusinessEntity> {
|
||||
const business = await this.requireOwnedBusiness(actor);
|
||||
return this.logos.upload(business.id, variant, file, actor);
|
||||
}
|
||||
|
||||
async removeMyLogo(
|
||||
variant: 'light' | 'dark',
|
||||
actor: AuthUser,
|
||||
): Promise<BusinessEntity> {
|
||||
const business = await this.requireOwnedBusiness(actor);
|
||||
return this.logos.remove(business.id, variant, actor);
|
||||
}
|
||||
|
||||
async removeImage(
|
||||
id: string,
|
||||
imageId: string,
|
||||
|
||||
Reference in New Issue
Block a user