improvement: task assignment flow added. cases and tasks feature updated accordingly.

This commit is contained in:
2026-07-13 15:47:32 +03:30
parent 0d073f1ec0
commit a391eee15f
21 changed files with 357 additions and 35 deletions

View File

@@ -14,7 +14,7 @@ import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { LabOrgGuard } from '../../common/guards/lab-org.guard';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { CasesService } from './cases.service';
import { ListLabCasesDto, UpdateLabCaseImportantDto } from './dto/cases.dto';
import { ListLabCasesDto, UpdateLabCaseImportantDto, AssignLabCaseTaskDto } from './dto/cases.dto';
@ApiTags('cases')
@ApiBearerAuth('JWT-auth')
@@ -30,6 +30,13 @@ export class CasesController {
return this.casesService.list(organizationId, req.user.id, query);
}
@Get('assignable-staff')
@ApiOperation({ summary: 'Staff who can be assigned lab tasks' })
listAssignableStaff(@Req() req) {
const organizationId = this.casesService.getOrganizationIdFromUser(req.user);
return this.casesService.listAssignableStaff(organizationId, req.user.id);
}
@Get('filter-options')
@ApiOperation({ summary: 'Clinics and treatment types for inbox filters' })
listFilterOptions(@Req() req) {
@@ -74,4 +81,23 @@ export class CasesController {
const organizationId = this.casesService.getOrganizationIdFromUser(req.user);
return this.casesService.setCaseImportant(id, dto, organizationId, req.user.id, req.user.language);
}
@Patch(':caseId/tasks/:taskId/assign')
@ApiOperation({ summary: 'Assign or unassign a task to lab staff' })
assignTask(
@Param('caseId') caseId: string,
@Param('taskId') taskId: string,
@Body() dto: AssignLabCaseTaskDto,
@Req() req,
) {
const organizationId = this.casesService.getOrganizationIdFromUser(req.user);
return this.casesService.assignTask(
caseId,
taskId,
dto,
organizationId,
req.user.id,
req.user.language,
);
}
}