Skip to content
Snippets Groups Projects
Commit f6069f3b authored by Etienne LOUPIAS's avatar Etienne LOUPIAS
Browse files

wip inProgress / history

parent cf4eac0d
No related branches found
No related tags found
1 merge request!479Draft: feat(dashboard) : create dashboard !
Pipeline #123756 passed
......@@ -136,8 +136,8 @@ export class OrientationDto {
@Type(() => customStructureDto)
structureOrientator: string | customStructureDto;
@ApiProperty({ enum: ['pending', 'acknowledged', 'completed'] })
@ApiProperty({ enum: ['pending', 'acknowledged', 'completed', 'uncompleted', 'expired'] })
@IsNotEmpty()
@IsEnum(['pending', 'acknowledged', 'completed'])
status: 'pending' | 'acknowledged' | 'completed';
@IsEnum(['pending', 'acknowledged', 'completed', 'uncompleted', 'expired'])
status: 'pending' | 'acknowledged' | 'completed' | 'uncompleted' | 'expired';
}
......@@ -98,7 +98,11 @@ export class Orientation {
@Prop({ type: mongoose.Schema.Types.Mixed })
structureOrientator: string | customStructure;
@Prop({ required: true, enum: ['pending', 'acknowledged', 'completed'], default: 'pending' })
@Prop({
required: true,
enum: ['pending', 'acknowledged', 'completed', 'uncompleted', 'expired'],
default: 'pending',
})
status: string;
}
......
......@@ -39,6 +39,7 @@ export class OrientationService {
public async find(userId: string, structureId: string = null): Promise<any> {
try {
const historyStatus = ['completed', 'uncompleted', 'expired'];
let myOrientationsFilters;
let todoOrientationsFilters;
......@@ -58,8 +59,14 @@ export class OrientationService {
}
return {
myOrientations: await this.findWithFilters(myOrientationsFilters),
todoOrientations: await this.findWithFilters(todoOrientationsFilters),
myOrientations: {
inProgress: await this.findWithFilters({ ...myOrientationsFilters, status: { $nin: historyStatus } }),
history: await this.findWithFilters({ ...myOrientationsFilters, status: { $in: historyStatus } }),
},
todoOrientations: {
inProgress: await this.findWithFilters({ ...todoOrientationsFilters, status: { $nin: historyStatus } }),
history: await this.findWithFilters({ ...todoOrientationsFilters, status: { $in: historyStatus } }),
},
};
} catch (e) {
this.logger.error(`Error fetching orientations with details: ${e.message}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment