Add business registration requests with approval flow, SMS notifications, and owner businesses endpoint.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,6 +48,13 @@ export class BusinessesController {
|
||||
});
|
||||
}
|
||||
|
||||
@Get('mine')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(UserRole.ADMIN, UserRole.BUSINESS_OWNER)
|
||||
findMine(@CurrentUser() user: AuthUser): Promise<BusinessEntity[]> {
|
||||
return this.service.findMine(user.id);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string): Promise<BusinessEntity> {
|
||||
return this.service.findOne(id);
|
||||
|
||||
@@ -70,6 +70,14 @@ export class BusinessesService {
|
||||
return business;
|
||||
}
|
||||
|
||||
async findMine(ownerId: string): Promise<BusinessEntity[]> {
|
||||
return this.repo.find({
|
||||
where: { ownerId },
|
||||
relations: { category: true, images: true },
|
||||
order: { createdAt: 'DESC' },
|
||||
});
|
||||
}
|
||||
|
||||
async create(payload: CreateBusinessDto): Promise<BusinessEntity> {
|
||||
const slugTaken = await this.repo.findOne({ where: { slug: payload.slug } });
|
||||
if (slugTaken) {
|
||||
|
||||
Reference in New Issue
Block a user