Skip to content
Snippets Groups Projects
Commit 50d1821d authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

fix(indicator): handle prescripteur profile when storing orientation event

parent 25ad1a1a
No related branches found
No related tags found
2 merge requests!345V2.4.2,!338Mise en place d'indicateurs pour le projet statham - Ajout du prescripteur
......@@ -35,6 +35,7 @@ export class OrientationIndicator {
@Type(() => StructureDto)
origin: {
nom: string;
prescripteur: string;
adresse: Address;
};
......@@ -55,5 +56,5 @@ export class OrientationIndicator {
@IsNumber()
progress: number;
createdAt?: Date;
createdAt: Date;
}
......@@ -35,11 +35,12 @@ export class Type {
export type OrientationIndicatorDocument = OrientationIndicator & Document;
@Schema({ timestamps: true })
@Schema()
export class OrientationIndicator {
@Prop({ type: Object })
origin: {
nom: string;
prescripteur: string;
adresse: Address;
};
......@@ -57,6 +58,9 @@ export class OrientationIndicator {
@Prop({ required: true })
progress: number;
@Prop({ type: Date, default: Date.now })
createdAt: Date;
}
export const OrientationIndicatorSchema = SchemaFactory.createForClass(OrientationIndicator);
......@@ -34,7 +34,7 @@ export class IndicatorService {
const query = {};
if (startDate || endDate) {
query['createdAt'] = {}; // replace 'dateField' with the name of your date attribute in the collection
query['createdAt'] = {};
if (startDate) {
query['createdAt']['$gte'] = new Date(startDate);
}
......
......@@ -3,6 +3,7 @@ import { OrientationIndicator } from '../../../../src/indicator/dto/orientation-
export const mockIndicator: OrientationIndicator = {
origin: {
nom: 'Structure 1',
prescripteur: 'Prescripteur 1',
adresse: {
numero: '1',
street: 'Rue de la structure 1',
......@@ -40,6 +41,7 @@ export const mockIndicators: OrientationIndicator[] = [
{
origin: {
nom: 'Structure 1',
prescripteur: 'Prescripteur 1',
adresse: {
numero: '1',
street: 'Rue de la structure 1',
......@@ -75,6 +77,7 @@ export const mockIndicators: OrientationIndicator[] = [
{
origin: {
nom: 'Structure 3',
prescripteur: 'Prescripteur 3',
adresse: {
numero: '3',
street: 'Rue de la structure 3',
......
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