create admin

This commit is contained in:
2025-11-25 16:22:46 +03:30
parent 1d76bdcd80
commit 89ed4c90de
@@ -31,30 +31,24 @@ export class AdminController {
return admin;
}
// @Post()
// @HttpCode(HttpStatus.CREATED)
// @ApiOperation({ summary: 'Create a new admin' })
// @ApiBody({ type: CreateAdminDto })
// @ApiResponse({ status: 201, description: 'Admin created' })
// async create(@Body() dto: CreateAdminDto, @RestId() restId: string) {
// const admin = await this.adminService.createRestaurantBySuperAdmin({
// phone: dto.phone,
// firstName: dto.firstName,
// lastName: dto.lastName,
// roleId: dto.roleId,
// restId,
// });
// return admin;
// }
@Post()
@HttpCode(HttpStatus.CREATED)
@ApiOperation({ summary: 'Create a new admin' })
@ApiBody({ type: CreateAdminDto })
@ApiResponse({ status: 201, description: 'Admin created' })
async create(@Body() dto: CreateAdminDto, @RestId() restId: string) {
const admin = await this.adminService.createAdminForMyRestaurant(restId, dto);
return admin;
}
@Patch(':id')
@Patch(':adminId')
@ApiOperation({ summary: 'Update an admin' })
@ApiParam({ name: 'id', description: 'Admin ID' })
@ApiParam({ name: 'adminId', description: 'Admin ID' })
@ApiBody({ type: UpdateAdminDto })
@ApiResponse({ status: 200, description: 'Admin updated successfully' })
@ApiResponse({ status: 404, description: 'Admin not found' })
update(@Param('id') id: string, @Body() dto: UpdateAdminDto, @RestId() restId: string): Promise<Admin> {
return this.adminService.update(id, restId, dto);
update(@Param('adminId') adminId: string, @Body() dto: UpdateAdminDto, @RestId() restId: string): Promise<Admin> {
return this.adminService.update(adminId, restId, dto);
}
@Get(':adminId')
@ApiOperation({ summary: 'Get an admin by ID' })