feature: phase0 - Global patients + mobile normalization
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Patch,
|
||||
Post,
|
||||
Query,
|
||||
@@ -25,30 +24,27 @@ export class PatientsController {
|
||||
constructor(private readonly patientsService: PatientsService) {}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'Create a patient for current organization' })
|
||||
@ApiOperation({ summary: 'Create or return existing global patient by mobile' })
|
||||
create(@Body() createPatientDto: CreatePatientDto, @Req() req) {
|
||||
const organizationId = this.patientsService.getOrganizationIdFromUser(req.user);
|
||||
return this.patientsService.create(createPatientDto, organizationId);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'List patients with search and pagination' })
|
||||
findAll(@Query() query: ListPatientsDto, @Req() req) {
|
||||
const organizationId = this.patientsService.getOrganizationIdFromUser(req.user);
|
||||
return this.patientsService.findAll(query, organizationId);
|
||||
@ApiOperation({ summary: 'Search all patients globally' })
|
||||
findAll(@Query() query: ListPatientsDto) {
|
||||
return this.patientsService.findAll(query);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@ApiOperation({ summary: 'Get one patient by id' })
|
||||
findOne(@Param('id') id: string, @Req() req) {
|
||||
const organizationId = this.patientsService.getOrganizationIdFromUser(req.user);
|
||||
return this.patientsService.findOne(id, organizationId);
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.patientsService.findOne(id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@ApiOperation({ summary: 'Update patient' })
|
||||
update(@Param('id') id: string, @Body() updatePatientDto: UpdatePatientDto, @Req() req) {
|
||||
const organizationId = this.patientsService.getOrganizationIdFromUser(req.user);
|
||||
return this.patientsService.update(id, updatePatientDto, organizationId);
|
||||
@ApiOperation({ summary: 'Update global patient record' })
|
||||
update(@Param('id') id: string, @Body() updatePatientDto: UpdatePatientDto) {
|
||||
return this.patientsService.update(id, updatePatientDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user