stylist
This commit is contained in:
@@ -21,6 +21,11 @@ import { AuthUser } from '../auth/interfaces/auth-user.interface';
|
||||
import { PermissionCode } from '../authorization/enums/permission-code.enum';
|
||||
import { UserRole } from '../users/enums/user-role.enum';
|
||||
import { CreateStylistDto } from './dto/create-stylist.dto';
|
||||
import {
|
||||
CreateSalonStylistDto,
|
||||
FindSalonStylistsQueryDto,
|
||||
UpdateSalonStylistDto,
|
||||
} from './dto/salon-stylist.dto';
|
||||
import { UpdateStylistDto } from './dto/update-stylist.dto';
|
||||
import { StylistsService } from './stylists.service';
|
||||
import { ApiPublicEndpoint } from '../swagger/decorators/swagger-auth.decorator';
|
||||
@@ -51,6 +56,62 @@ export class StylistsController {
|
||||
return this.stylistsService.create(createStylistDto, user);
|
||||
}
|
||||
|
||||
@Roles(UserRole.SALON)
|
||||
@Permissions(PermissionCode.STYLISTS_READ)
|
||||
@ApiStandardOkResponse(Stylist, { isArray: true })
|
||||
@Get('salon')
|
||||
findAllForSalon(
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Query() query: FindSalonStylistsQueryDto,
|
||||
) {
|
||||
return this.stylistsService.findAllForSalon(user, query);
|
||||
}
|
||||
|
||||
@Roles(UserRole.SALON)
|
||||
@Permissions(PermissionCode.STYLISTS_WRITE)
|
||||
@ApiStandardOkResponse(Stylist)
|
||||
@Post('salon')
|
||||
createForSalon(
|
||||
@Body() createSalonStylistDto: CreateSalonStylistDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.stylistsService.createForSalon(createSalonStylistDto, user);
|
||||
}
|
||||
|
||||
@Roles(UserRole.SALON)
|
||||
@Permissions(PermissionCode.STYLISTS_READ)
|
||||
@ApiStandardOkResponse(Stylist)
|
||||
@Get('salon/:id')
|
||||
findOneForSalon(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.stylistsService.findOneForSalon(id, user);
|
||||
}
|
||||
|
||||
@Roles(UserRole.SALON)
|
||||
@Permissions(PermissionCode.STYLISTS_WRITE)
|
||||
@ApiStandardOkResponse(Stylist)
|
||||
@Patch('salon/:id')
|
||||
updateForSalon(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Body() updateSalonStylistDto: UpdateSalonStylistDto,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.stylistsService.updateForSalon(id, updateSalonStylistDto, user);
|
||||
}
|
||||
|
||||
@Roles(UserRole.SALON)
|
||||
@Permissions(PermissionCode.STYLISTS_DELETE)
|
||||
@ApiStandardEmptyResponse()
|
||||
@Delete('salon/:id')
|
||||
removeForSalon(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@CurrentUser() user: AuthUser,
|
||||
) {
|
||||
return this.stylistsService.removeForSalon(id, user);
|
||||
}
|
||||
|
||||
@Public()
|
||||
@ApiPublicEndpoint('List stylists, optionally filtered by salon')
|
||||
@ApiQuery({ name: 'salonId', required: false, type: String, format: 'uuid' })
|
||||
|
||||
Reference in New Issue
Block a user