Skip to content

Commit

Permalink
Merge pull request #112 from nginformatica/fix/type-importer
Browse files Browse the repository at this point in the history
fix: importer types
  • Loading branch information
danielamarioti authored Jul 18, 2024
2 parents 721d150 + 271c817 commit eb2c309
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/ttalk/schemas/MedicalRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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([
Expand All @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions src/ttalk/schemas/Occupation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -33,6 +32,7 @@ const Exam = t.intersection([
}),
t.partial({
periodicity: Periodicity,
description: t.string,
})
])

Expand All @@ -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<typeof OccupationInfo>
Expand Down
28 changes: 17 additions & 11 deletions src/ttalk/schemas/Risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand All @@ -89,6 +92,7 @@ const Exam = t.intersection([
}),
t.partial({
periodicity: Periodicity,
description: t.string,
})
])

Expand All @@ -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
})
])

Expand Down Expand Up @@ -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<typeof RiskInfo>
Expand Down

0 comments on commit eb2c309

Please sign in to comment.