/opt/mawid/apps/api/src/patients
NameSizeModeActions
patients.controller.ts14620644editdlrm
patients.gdpr.spec.ts41390644editdlrm
patients.module.ts2690644editdlrm
patients.service.ts42660644editdlrm
Edit: /opt/mawid/apps/api/src/patients/patients.controller.ts (1462B)
import { Body, Controller, Delete, Get, Param, Patch, Query } from '@nestjs/common'; import { updatePatientSchema, type UpdatePatientInput } from '@mawid/shared'; import { ClinicId, CurrentUser, type JwtUser } from '../auth/current-user.decorator'; import { ZodValidationPipe } from '../common/zod-validation.pipe'; import { PatientsService } from './patients.service'; @Controller('patients') export class PatientsController { constructor(private readonly patients: PatientsService) {} @Get() list(@ClinicId() clinicId: string, @Query('search') search?: string) { return this.patients.list(clinicId, search); } @Get(':id') get(@ClinicId() clinicId: string, @Param('id') id: string) { return this.patients.get(clinicId, id); } @Patch(':id') update( @ClinicId() clinicId: string, @Param('id') id: string, @Body(new ZodValidationPipe(updatePatientSchema)) body: UpdatePatientInput, ) { return this.patients.update(clinicId, id, body); } /** KVKK/GDPR: full data export for a patient request. */ @Get(':id/export') export(@ClinicId() clinicId: string, @Param('id') id: string) { return this.patients.exportData(clinicId, id); } /** KVKK/GDPR: delete-on-request — removes the patient and all their data. */ @Delete(':id') remove(@ClinicId() clinicId: string, @Param('id') id: string, @CurrentUser() user: JwtUser) { return this.patients.deleteData(clinicId, id, `owner:${user.sub}`); } }