From 810204b06c38c9b20c3880f6d7e6d30a9721b292 Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Mon, 9 Oct 2023 10:14:02 +0200 Subject: [PATCH] ONI-173: change insuree head projection --- src/actions.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/actions.js b/src/actions.js index 86c71c3..63f6c43 100644 --- a/src/actions.js +++ b/src/actions.js @@ -11,7 +11,36 @@ import { } from "@openimis/fe-core"; import { INSUREE_ACTIVE_STRING } from "./constants"; -const FAMILY_HEAD_PROJECTION = "headInsuree{id,uuid,chfId,lastName,otherNames,email,phone,dob,gender{code}}"; +//NOTE: Fetching all INSUREE_FULL_PROJECTION fields except family. +const FAMILY_HEAD_PROJECTION = (mm) => [ + "id", + "uuid", + "chfId", + "lastName", + "otherNames", + "dob", + "age", + "validityFrom", + "validityTo", + `photo{id,uuid,date,folder,filename,officerId,photo}`, + "gender{code, gender}", + "education{id}", + "profession{id}", + "marital", + "cardIssued", + "currentVillage" + mm.getProjection("location.Location.FlatProjection"), + "currentAddress", + "typeOfId{code}", + "passport", + "relationship{id}", + "head", + "status", + "statusDate", + "statusReason{code,insureeStatusReason}", + "email", + "phone", + "healthFacility" + mm.getProjection("location.HealthFacilityPicker.projection"), +] const FAMILY_FULL_PROJECTION = (mm) => [ "id", @@ -23,7 +52,7 @@ const FAMILY_FULL_PROJECTION = (mm) => [ "address", "validityFrom", "validityTo", - FAMILY_HEAD_PROJECTION, + `headInsuree{${FAMILY_HEAD_PROJECTION(mm).join(",")}}`, "location" + mm.getProjection("location.Location.FlatProjection"), "clientMutationId", ];