/opt/mawid/apps/api/src/services
Edit: /opt/mawid/apps/api/src/services/services.controller.ts (1343B)
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
import {
createServiceSchema,
updateServiceSchema,
type CreateServiceInput,
type UpdateServiceInput,
} from '@mawid/shared';
import { ClinicId } from '../auth/current-user.decorator';
import { ZodValidationPipe } from '../common/zod-validation.pipe';
import { ServicesService } from './services.service';
@Controller('services')
export class ServicesController {
constructor(private readonly servicesService: ServicesService) {}
@Get()
list(@ClinicId() clinicId: string) {
return this.servicesService.list(clinicId);
}
@Get(':id')
get(@ClinicId() clinicId: string, @Param('id') id: string) {
return this.servicesService.get(clinicId, id);
}
@Post()
create(
@ClinicId() clinicId: string,
@Body(new ZodValidationPipe(createServiceSchema)) body: CreateServiceInput,
) {
return this.servicesService.create(clinicId, body);
}
@Patch(':id')
update(
@ClinicId() clinicId: string,
@Param('id') id: string,
@Body(new ZodValidationPipe(updateServiceSchema)) body: UpdateServiceInput,
) {
return this.servicesService.update(clinicId, id, body);
}
@Delete(':id')
remove(@ClinicId() clinicId: string, @Param('id') id: string) {
return this.servicesService.remove(clinicId, id);
}
}