From 271c817fb2f3041413b815e7b7063011da138fad Mon Sep 17 00:00:00 2001 From: Daniela Marioti Date: Thu, 18 Jul 2024 20:32:22 -0300 Subject: [PATCH] fix: importer types --- package.json | 2 +- src/ttalk/schemas/MedicalRecord.ts | 5 ++++- src/ttalk/schemas/Occupation.ts | 6 +++--- src/ttalk/schemas/Risk.ts | 28 +++++++++++++++++----------- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 451fbd6..307f345 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quirons-broker", - "version": "0.0.1-alpha.127", + "version": "0.0.1-alpha.128", "description": "A small library to expose the broker types", "main": "index.ts", "typings": "index.d.ts", diff --git a/src/ttalk/schemas/MedicalRecord.ts b/src/ttalk/schemas/MedicalRecord.ts index 89e9014..567886c 100644 --- a/src/ttalk/schemas/MedicalRecord.ts +++ b/src/ttalk/schemas/MedicalRecord.ts @@ -90,6 +90,7 @@ export const MedicalRecordInfo = t.intersection([ t.literal(8), t.literal(9), t.literal(10), + t.null ]), /** Cor dos Cabelos */ hairColor: t.union([ @@ -101,6 +102,7 @@ export const MedicalRecordInfo = t.intersection([ t.literal(5), t.literal(6), t.literal(7), + t.null ]), /** Cor da Pele */ skinColor: t.union([ @@ -109,13 +111,14 @@ export const MedicalRecordInfo = t.intersection([ t.literal(2), t.literal(3), t.literal(4), + t.null ]), /** Tempo tabagista */ tamagistPeriod: t.number, /** Quantidade de cigarros por dia */ amountConsumed: t.number, /** Histórico */ - historic: t.string, + historic: t.union([t.string, t.null]), /** Última medição sistólica */ systolicPressure: t.number, /** Última medição diastólica */ diff --git a/src/ttalk/schemas/Occupation.ts b/src/ttalk/schemas/Occupation.ts index 9590a70..9fbda82 100644 --- a/src/ttalk/schemas/Occupation.ts +++ b/src/ttalk/schemas/Occupation.ts @@ -12,7 +12,6 @@ const Periodicity = t.type({ const Exam = t.intersection([ t.type({ - description: t.string, type: t.union([ t.literal(0), t.literal(1), @@ -33,6 +32,7 @@ const Exam = t.intersection([ }), t.partial({ periodicity: Periodicity, + description: t.string, }) ]) @@ -44,12 +44,12 @@ export const OccupationInfo = t.intersection([ branchId: t.string, /** Chave única */ erpId: t.string, + }), + t.partial({ /** EPIs */ ipe: t.array(t.string), /** Exames */ exams: t.array(Exam), - }), - t.partial({ }) ]) export type OccupationInfo = t.TypeOf diff --git a/src/ttalk/schemas/Risk.ts b/src/ttalk/schemas/Risk.ts index 0de35b8..f6227dc 100644 --- a/src/ttalk/schemas/Risk.ts +++ b/src/ttalk/schemas/Risk.ts @@ -30,11 +30,15 @@ const Person = t.type({ gender: t.union([t.literal(0), t.literal(1)]), }) -const Measurement = t.type({ - date: datetime, - value: t.number, - instrument: t.string, -}) +const Measurement = t.intersection([ + t.type({ + value: t.number, + instrument: t.string, + }), + t.partial({ + date:datetime, + }) +]) const ControlMeasure = t.type({ description: t.string, @@ -68,7 +72,6 @@ const Periodicity = t.type({ const Exam = t.intersection([ t.type({ - description: t.string, type: t.union([ t.literal(0), t.literal(1), @@ -89,6 +92,7 @@ const Exam = t.intersection([ }), t.partial({ periodicity: Periodicity, + description: t.string, }) ]) @@ -106,16 +110,16 @@ const RiskAgent = t.intersection([ t.literal(5), t.literal(6), t.literal(7), - ]), + ]) + }), + t.partial({ + /** Código do Agente de Risco no eSocial */ + eSocialCode: t.string, /** Avaliação */ evaluation: t.union([ t.literal(0), t.literal(1), ]), - }), - t.partial({ - /** Código do Agente de Risco no eSocial */ - eSocialCode: t.string }) ]) @@ -158,6 +162,8 @@ export const RiskInfo = t.intersection([ icd: t.string, /** Observações */ observation: t.string, + /**Data de eliminação do risco */ + eliminationDate: datetime, }) ]) export type RiskInfo = t.TypeOf