/opt/mawid/apps/api/src/staff
Edit: /opt/mawid/apps/api/src/staff/staff.controller.ts (1294B)
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import {
createStaffSchema,
updateStaffSchema,
type CreateStaffInput,
type UpdateStaffInput,
} from '@mawid/shared';
import { ClinicId } from '../auth/current-user.decorator';
import { ZodValidationPipe } from '../common/zod-validation.pipe';
import { StaffService } from './staff.service';
@Controller('staff')
export class StaffController {
constructor(private readonly staffService: StaffService) {}
@Get()
list(@ClinicId() clinicId: string) {
return this.staffService.list(clinicId);
}
@Get(':id')
get(@ClinicId() clinicId: string, @Param('id') id: string) {
return this.staffService.get(clinicId, id);
}
@Post()
create(
@ClinicId() clinicId: string,
@Body(new ZodValidationPipe(createStaffSchema)) body: CreateStaffInput,
) {
return this.staffService.create(clinicId, body);
}
@Patch(':id')
update(
@ClinicId() clinicId: string,
@Param('id') id: string,
@Body(new ZodValidationPipe(updateStaffSchema)) body: UpdateStaffInput,
) {
return this.staffService.update(clinicId, id, body);
}
@Delete(':id')
remove(@ClinicId() clinicId: string, @Param('id') id: string) {
return this.staffService.remove(clinicId, id);
}
}