improvement: all demo bugs fixed. give me more baby.
This commit is contained in:
@@ -25,7 +25,14 @@ export class UpdateLabTaskDto {
|
||||
status: LabTaskStatus;
|
||||
}
|
||||
|
||||
export type TaskSortField = 'date' | 'status' | 'clinic' | 'patient' | 'important';
|
||||
export type TaskSortField =
|
||||
| 'date'
|
||||
| 'status'
|
||||
| 'clinic'
|
||||
| 'patient'
|
||||
| 'important'
|
||||
| 'prosthesis'
|
||||
| 'taskType';
|
||||
|
||||
export class ListLabTasksDto {
|
||||
@IsOptional()
|
||||
@@ -59,7 +66,7 @@ export class ListLabTasksDto {
|
||||
sentTo?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(['date', 'status', 'clinic', 'patient', 'important'])
|
||||
@IsIn(['date', 'status', 'clinic', 'patient', 'important', 'prosthesis', 'taskType'])
|
||||
sortBy?: TaskSortField;
|
||||
|
||||
@IsOptional()
|
||||
|
||||
@@ -188,9 +188,9 @@ export class TasksService {
|
||||
? { treatment: { organizationId: query.clinicOrganizationId } }
|
||||
: {}),
|
||||
...(query.q?.trim() ? { treatment: this.buildSearchWhere(query.q.trim()) } : {}),
|
||||
...(query.important !== undefined ? { isImportant: query.important } : {}),
|
||||
},
|
||||
...(status !== undefined ? { status } : {}),
|
||||
...(query.important !== undefined ? { isImportant: query.important } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -229,15 +229,24 @@ export class TasksService {
|
||||
{ id: 'asc' },
|
||||
];
|
||||
case 'important':
|
||||
return [{ isImportant: dir }, { createdAt: 'desc' }, { id: 'asc' }];
|
||||
return [{ labCase: { isImportant: dir } }, { createdAt: 'desc' }, { id: 'asc' }];
|
||||
case 'prosthesis':
|
||||
return [{ prosthesisTypeCode: dir }, { createdAt: 'desc' }, { id: 'asc' }];
|
||||
case 'taskType':
|
||||
return [
|
||||
{ workflowStepCode: dir },
|
||||
{ stepOrder: 'asc' },
|
||||
{ createdAt: 'desc' },
|
||||
{ id: 'asc' },
|
||||
];
|
||||
case 'date':
|
||||
default:
|
||||
// date / caseId / taskId / stepId — newest first by default.
|
||||
return [
|
||||
{ labCase: { sentAt: dir } },
|
||||
{ labCaseId: 'asc' },
|
||||
{ treatmentDetailId: 'asc' },
|
||||
{ stepOrder: 'asc' },
|
||||
{ id: 'asc' },
|
||||
{ labCaseId: dir },
|
||||
{ id: dir },
|
||||
{ stepOrder: dir },
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -259,7 +268,7 @@ export class TasksService {
|
||||
stepOrder: task.stepOrder,
|
||||
stepLabel: task.stepLabel,
|
||||
status: task.status,
|
||||
isImportant: task.isImportant,
|
||||
isImportant: task.labCase.isImportant,
|
||||
lastStatusChangedAt: task.lastStatusChangedAt?.toISOString() ?? null,
|
||||
lastStatusChangedBy: task.lastStatusChangedBy
|
||||
? { id: task.lastStatusChangedBy.id, name: task.lastStatusChangedBy.name }
|
||||
|
||||
Reference in New Issue
Block a user