From c83cd66e188a9f1880346678fa2bbe6b5ad52b7b Mon Sep 17 00:00:00 2001 From: Jack Meyer Date: Mon, 4 May 2020 20:54:43 -0500 Subject: [PATCH 1/3] feat(appointment): add appointment schema --- src/model/appointment.ts | 20 ++++++++++++++++++++ src/model/elements/appointment-type.ts | 13 +++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/model/appointment.ts create mode 100644 src/model/elements/appointment-type.ts diff --git a/src/model/appointment.ts b/src/model/appointment.ts new file mode 100644 index 0000000..f1ffb10 --- /dev/null +++ b/src/model/appointment.ts @@ -0,0 +1,20 @@ +import { Type, Static } from '@sinclair/typebox' + +import { BaseModelSchema } from './base' +import { DateTimeSchema } from './primitives/date-time' +import { PatientTypeSchema } from './elements/patient-type' + +export const AppointmentSchema = Type.Intersect([ + BaseModelSchema, + Type.Object({ + resourceType: Type.Literal('appointment'), + type: PatientTypeSchema, + startDateTime: DateTimeSchema, + endDateTime: DateTimeSchema, + location: Type.String(), + reason: Type.String(), + patientId: Type.String(), + }), +]) + +export type Patient = Static diff --git a/src/model/elements/appointment-type.ts b/src/model/elements/appointment-type.ts new file mode 100644 index 0000000..f99f9a0 --- /dev/null +++ b/src/model/elements/appointment-type.ts @@ -0,0 +1,13 @@ +import { Type, Static } from '@sinclair/typebox' + +export const AppointmentTypeSchema = Type.Union( + [Type.Literal('checkup'), + Type.Literal('in-patient'), + Type.Literal('emergency'), + Type.Literal('follow up'), + Type.Literal('routine'), + Type.Literal('walk in'), + ], +) + +export type PatientType = Static From 96dfd29cab3d781a448c78dea0fa69e26c2485a7 Mon Sep 17 00:00:00 2001 From: Jack Meyer Date: Mon, 4 May 2020 21:07:05 -0500 Subject: [PATCH 2/3] chore(eslint): fix eslint config --- .eslintrc.js | 9 ++------- package.json | 4 ++++ src/model/elements/appointment-type.ts | 17 ++++++++--------- src/model/incident.ts | 21 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 src/model/incident.ts diff --git a/.eslintrc.js b/.eslintrc.js index 7756a1e..390740d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,10 +3,9 @@ module.exports = { env: { browser: true, es6: true, - 'jest/globals': true, }, extends: [ - 'airbnb', + 'airbnb/base', 'plugin:@typescript-eslint/recommended', 'prettier', 'prettier/@typescript-eslint', @@ -28,7 +27,7 @@ module.exports = { }, }, }, - plugins: ['react', '@typescript-eslint', 'prettier', 'jest'], + plugins: ['@typescript-eslint', 'prettier'], ignorePatterns: ['node_modules/'], rules: { '@typescript-eslint/member-delimiter-style': 'off', @@ -39,10 +38,6 @@ module.exports = { '@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: true }], '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }], 'import/extensions': 'off', - 'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }], - 'react/jsx-one-expression-per-line': 'off', - 'react/jsx-wrap-multilines': 'off', - 'react/jsx-props-no-spreading': 'off', 'arrow-body-style': ['warn', 'as-needed'], 'no-param-reassign': ['error', { props: false }], 'import/prefer-default-export': 'off', diff --git a/package.json b/package.json index c56dadd..8b19335 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "test": "echo \"Error: no test specified\" && exit 0", "build": "tsc", "prepare": "npm run build", + "lint": "eslint \"src/**/*.{js,ts}\"", + "lint:fix": "eslint \"src/**/*.{js,ts}\" --fix", "semantic-release": "semantic-release" }, "repository": { @@ -43,7 +45,9 @@ "cz-conventional-changelog": "^3.0.2", "dateformat": "~3.0.3", "eslint": "^6.8.0", + "eslint-config-airbnb": "^18.1.0", "eslint-config-prettier": "^6.10.0", + "eslint-plugin-import": "^2.20.2", "eslint-plugin-prettier": "^3.1.2", "husky": "~4.2.0", "pouchdb": "^7.1.1", diff --git a/src/model/elements/appointment-type.ts b/src/model/elements/appointment-type.ts index f99f9a0..abe5e89 100644 --- a/src/model/elements/appointment-type.ts +++ b/src/model/elements/appointment-type.ts @@ -1,13 +1,12 @@ import { Type, Static } from '@sinclair/typebox' -export const AppointmentTypeSchema = Type.Union( - [Type.Literal('checkup'), - Type.Literal('in-patient'), - Type.Literal('emergency'), - Type.Literal('follow up'), - Type.Literal('routine'), - Type.Literal('walk in'), - ], -) +export const AppointmentTypeSchema = Type.Union([ + Type.Literal('checkup'), + Type.Literal('in-patient'), + Type.Literal('emergency'), + Type.Literal('follow up'), + Type.Literal('routine'), + Type.Literal('walk in'), +]) export type PatientType = Static diff --git a/src/model/incident.ts b/src/model/incident.ts new file mode 100644 index 0000000..64d99cb --- /dev/null +++ b/src/model/incident.ts @@ -0,0 +1,21 @@ +import { Type, Static } from '@sinclair/typebox' + +import { BaseModelSchema } from './base' +import { DateTimeSchema } from './primitives/date-time' + +export const IncidentSchema = Type.Intersect([ + BaseModelSchema, + Type.Object({ + resourceType: Type.Literal('incident'), + reportedBy: Type.String(), + reportedOn: DateTimeSchema, + code: Type.String(), + date: DateTimeSchema, + department: Type.String(), + category: Type.String(), + categoryItem: Type.String(), + description: Type.String(), + }), +]) + +export type Patient = Static From 6bfe96235713d78cfd3da230e8c226d5cd541cba Mon Sep 17 00:00:00 2001 From: Jack Meyer Date: Sat, 16 May 2020 17:36:27 -0500 Subject: [PATCH 3/3] chore(package): fix typescript to 3.8.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b19335..346d203 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "pouchdb": "^7.1.1", "prettier": "^2.0.2", "semantic-release": "^17.0.4", - "typescript": "^3.7.5" + "typescript": "3.8.3" }, "husky": { "hooks": {