create admin

This commit is contained in:
2025-11-22 12:52:28 +03:30
parent 8e63213f1d
commit 7a53f0fa1b
2 changed files with 4 additions and 9 deletions
@@ -13,7 +13,7 @@ import { AdminId } from 'src/common/decorators/admin-id.decorator';
export class AdminController { export class AdminController {
constructor(private readonly adminService: AdminService) {} constructor(private readonly adminService: AdminService) {}
@Get('my-restaurant-admins') @Get('admins')
@ApiOperation({ summary: 'admin' }) @ApiOperation({ summary: 'admin' })
@ApiResponse({ status: 201, description: 'Admins' }) @ApiResponse({ status: 201, description: 'Admins' })
async getAll(@RestId() restId: string) { async getAll(@RestId() restId: string) {
@@ -21,7 +21,7 @@ export class AdminController {
return admin; return admin;
} }
@Get('me') @Get('profile')
@ApiOperation({ summary: 'admin' }) @ApiOperation({ summary: 'admin' })
@ApiResponse({ status: 201, description: 'Admins' }) @ApiResponse({ status: 201, description: 'Admins' })
async getMe(@AdminId() adminId: string) { async getMe(@AdminId() adminId: string) {
@@ -34,13 +34,13 @@ export class AdminController {
@ApiOperation({ summary: 'Create a new admin' }) @ApiOperation({ summary: 'Create a new admin' })
@ApiBody({ type: CreateAdminDto }) @ApiBody({ type: CreateAdminDto })
@ApiResponse({ status: 201, description: 'Admin created' }) @ApiResponse({ status: 201, description: 'Admin created' })
async create(@Body() dto: CreateAdminDto) { async create(@Body() dto: CreateAdminDto, @RestId() restId: string) {
const admin = await this.adminService.createRestaurantBySuperAdmin({ const admin = await this.adminService.createRestaurantBySuperAdmin({
phone: dto.phone, phone: dto.phone,
firstName: dto.firstName, firstName: dto.firstName,
lastName: dto.lastName, lastName: dto.lastName,
roleId: dto.roleId, roleId: dto.roleId,
restId: dto.restId, restId,
}); });
return admin; return admin;
} }
@@ -21,9 +21,4 @@ export class CreateAdminDto {
@IsNotEmpty() @IsNotEmpty()
@IsString() @IsString()
roleId!: string; roleId!: string;
@ApiProperty({ description: 'Restaurant id' })
@IsNotEmpty()
@IsString()
restId!: string;
} }