From 15928c06bf1f3cc16f394a59c1e4acf1a78c273e Mon Sep 17 00:00:00 2001 From: Lea Renaux Date: Mon, 18 Nov 2024 10:53:08 +0100 Subject: [PATCH] add last event and last communication dates --- src/types/api.ts | 46 +++++++++++++++++++++++++------ src/ui/Questioning/StatesCard.tsx | 13 +++++++-- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/types/api.ts b/src/types/api.ts index 66d17f2..099cfb4 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -72,9 +72,7 @@ export type APISchemas = { longWording?: string shortWording?: string periodicity?: "X" | "A" | "S" | "T" | "B" | "M" - /* Indicates whether or not you need to use the my surveys portal */ mandatoryMySurveys?: boolean - /* Indicates if the source should be force closed */ forceClose?: boolean messageInfoSurveyOffline?: string messageSurveyOffline?: string @@ -326,6 +324,7 @@ export type APISchemas = { idContact?: string main?: boolean } + QuestioningCommentInputDto: { comment?: string; author?: string } QuestioningEventDto: { /* Format: int64 */ id?: number @@ -810,6 +809,12 @@ export type APISchemas = { messageSurveyOffline?: string messageInfoSurveyOffline?: string } + QuestioningCommentOutputDto: { + comment?: string + author?: string + /* Format: date-time */ + commentDate?: string + } QuestioningCommunicationDto: { /* Format: int64 */ id?: number @@ -829,9 +834,14 @@ export type APISchemas = { surveyUnitIdentificationCode?: string listEvents?: Array lastEvent?: string + /* Format: date-time */ + dateLastEvent?: string listCommunications?: Array lastCommunication?: string /* Format: date-time */ + dateLastCommunication?: string + listComments?: Array + /* Format: date-time */ validationDate?: string readOnlyUrl?: string } @@ -854,16 +864,16 @@ export type APISchemas = { empty?: boolean } SearchQuestioningDto: { - campaignId?: string + surveyUnitId?: string /* Format: int64 */ questioningId?: number - surveyUnitId?: string - surveyUnitIdentificationCode?: string + campaignId?: string listContactIdentifiers?: Array lastEvent?: string lastCommunication?: string /* Format: date-time */ validationDate?: string + surveyUnitIdentificationCode?: string } AssistanceDto: { mailAssistance?: string; surveyUnitId?: string } Address: { @@ -929,6 +939,7 @@ export type APISchemas = { questioningAccreditations?: Array questioningEvents?: Array questioningCommunications?: Array + questioningComments?: Array surveyUnit?: APISchemas["SurveyUnit"] } QuestioningAccreditation: { @@ -941,6 +952,14 @@ export type APISchemas = { questioning?: APISchemas["Questioning"] main?: boolean } + QuestioningComment: { + /* Format: int64 */ + id?: number + comment?: string + author?: string + /* Format: date-time */ + date?: string + } QuestioningCommunication: { /* Format: int64 */ id?: number @@ -997,7 +1016,7 @@ export type APISchemas = { /* Format: int32 */ pnd?: number } - MoogCampaign: { + MoogCampaignDto: { id?: string label?: string /* Format: int64 */ @@ -1017,7 +1036,7 @@ export type APISchemas = { idContact?: string idSu?: string address?: string - campaign?: APISchemas["MoogCampaign"] + campaign?: APISchemas["MoogCampaignDto"] firstName?: string lastname?: string batchNumber?: string @@ -1075,9 +1094,9 @@ export type APISchemas = { listCampaigns?: Array } SearchContactDto: { + email?: string firstName?: string lastName?: string - email?: string identifier?: string } MyQuestioningDto: { @@ -1347,6 +1366,17 @@ export type APIEndpoints = { body: APISchemas["QuestioningAccreditationDto"] } } + "/api/questionings/{id}/comment": { + responses: { post: APISchemas["QuestioningCommentInputDto"] } + requests: { + method: "post" + urlParams: { + /* Format: int64 */ + id: number + } + body: APISchemas["QuestioningCommentInputDto"] + } + } "/api/questionings/questioning-events": { responses: { post: APISchemas["QuestioningEventDto"] } requests: { diff --git a/src/ui/Questioning/StatesCard.tsx b/src/ui/Questioning/StatesCard.tsx index 869ea5d..d388bec 100644 --- a/src/ui/Questioning/StatesCard.tsx +++ b/src/ui/Questioning/StatesCard.tsx @@ -96,7 +96,11 @@ export const StatesCard = ({ questioning, refetch }: Props) => { - TODO DATA + {questioning.dateLastEvent && ( + + {new Date(Date.parse(questioning.dateLastEvent)).toLocaleDateString()} + + )} {questioning.lastCommunication && ( @@ -126,8 +130,11 @@ export const StatesCard = ({ questioning, refetch }: Props) => { "Aucun état" } /> - - TODO DATA + {questioning.dateLastCommunication && ( + + {new Date(Date.parse(questioning.dateLastCommunication)).toLocaleDateString()} + + )} )}