@rinse-dental/open-dental 2.4.3 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/transformerTypes/visitTypes.d.ts +5 -5
- package/dist/transformerTypes/visitTypes.d.ts.map +1 -1
- package/dist/transformers/visit.d.ts.map +1 -1
- package/dist/transformers/visit.js +7 -5
- package/package.json +1 -1
- package/src/transformerTypes/visitTypes.ts +5 -5
- package/src/transformers/visit.ts +8 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Timestamp } from
|
|
1
|
+
import { Timestamp, DocumentReference } from 'firebase-admin/firestore';
|
|
2
2
|
/**
|
|
3
3
|
* Represents an visit in firebase.
|
|
4
4
|
* Transformer for appointment
|
|
@@ -6,7 +6,7 @@ import { Timestamp } from "firebase-admin/firestore";
|
|
|
6
6
|
export interface Visit {
|
|
7
7
|
serverDateTime?: string;
|
|
8
8
|
AptNum?: number;
|
|
9
|
-
docRef?:
|
|
9
|
+
docRef?: DocumentReference;
|
|
10
10
|
PatNum?: number;
|
|
11
11
|
AptStatus?: AptStatus;
|
|
12
12
|
Pattern?: string;
|
|
@@ -46,9 +46,9 @@ export type Appendix = {
|
|
|
46
46
|
duration?: number;
|
|
47
47
|
status?: string;
|
|
48
48
|
ProvNum?: number;
|
|
49
|
-
ProviderDocRef?:
|
|
50
|
-
VisitTypeDocRef?:
|
|
51
|
-
OpDocRef?:
|
|
49
|
+
ProviderDocRef?: DocumentReference;
|
|
50
|
+
VisitTypeDocRef?: DocumentReference;
|
|
51
|
+
OpDocRef?: DocumentReference;
|
|
52
52
|
date?: string;
|
|
53
53
|
dateTime?: string;
|
|
54
54
|
firestoreTimestamp?: Timestamp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitTypes.d.ts","sourceRoot":"","sources":["../../src/transformerTypes/visitTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,C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WAAW,GACX,UAAU,GACV,aAAa,GACb,MAAM,GACN,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/transformers/visit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/transformers/visit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAOvD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CA4C1D"}
|
|
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.appointmentToVisit = appointmentToVisit;
|
|
7
7
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
8
|
+
const firebase_admin_1 = __importDefault(require("firebase-admin"));
|
|
8
9
|
const firestore_1 = require("firebase-admin/firestore");
|
|
10
|
+
const db = firebase_admin_1.default.firestore();
|
|
9
11
|
function appointmentToVisit(apt) {
|
|
10
12
|
const moment_aptDateTime = moment_timezone_1.default.tz(apt.AptDateTime, 'YYYY-MM-DD HH:mm:ss', 'America/Los_Angeles');
|
|
11
13
|
let firestoreTimestamp;
|
|
@@ -17,9 +19,9 @@ function appointmentToVisit(apt) {
|
|
|
17
19
|
}
|
|
18
20
|
const duration = (apt.Pattern?.length || 0) * 5;
|
|
19
21
|
const location = 'NF6YVFAXyRVXGi5nItqV';
|
|
20
|
-
const display_ProvNum = apt.IsHygiene ? apt.ProvHyg : apt.ProvNum;
|
|
22
|
+
const display_ProvNum = apt.IsHygiene == 'true' ? apt.ProvHyg : apt.ProvNum;
|
|
21
23
|
return {
|
|
22
|
-
docRef: `/patients/${apt.PatNum}/patientVisits/${apt.AptNum}
|
|
24
|
+
docRef: db.doc(`/patients/${apt.PatNum}/patientVisits/${apt.AptNum}`),
|
|
23
25
|
...apt,
|
|
24
26
|
TimeLocked: apt.TimeLocked === 'true',
|
|
25
27
|
IsHygiene: apt.IsHygiene == 'true',
|
|
@@ -27,9 +29,9 @@ function appointmentToVisit(apt) {
|
|
|
27
29
|
appendix: {
|
|
28
30
|
duration: duration,
|
|
29
31
|
ProvNum: display_ProvNum,
|
|
30
|
-
ProviderDocRef: display_ProvNum != 0 ? `/providers/${display_ProvNum}` : undefined,
|
|
31
|
-
VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? `/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}` : undefined,
|
|
32
|
-
OpDocRef: apt.Op != 0 ? `/locations/${location}/locationOperatories/${apt.Op}` : undefined,
|
|
32
|
+
ProviderDocRef: display_ProvNum != 0 ? db.doc(`/providers/${display_ProvNum}`) : undefined,
|
|
33
|
+
VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? db.doc(`/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}`) : undefined,
|
|
34
|
+
OpDocRef: apt.Op != 0 ? db.doc(`/locations/${location}/locationOperatories/${apt.Op}`) : undefined,
|
|
33
35
|
date: moment_aptDateTime.format('YYYY-MM-DD'),
|
|
34
36
|
dateTime: moment_aptDateTime.format(),
|
|
35
37
|
firestoreTimestamp: firestoreTimestamp,
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Timestamp } from
|
|
1
|
+
import { Timestamp, DocumentReference } from 'firebase-admin/firestore';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents an visit in firebase.
|
|
@@ -7,7 +7,7 @@ import { Timestamp } from "firebase-admin/firestore";
|
|
|
7
7
|
export interface Visit {
|
|
8
8
|
serverDateTime?: string; // Server timestamp of the appointment; returned by some endpoints
|
|
9
9
|
AptNum?: number; // Unique identifier for the appointment
|
|
10
|
-
docRef?:
|
|
10
|
+
docRef?: DocumentReference; // docRef of this visit.
|
|
11
11
|
PatNum?: number; // Unique identifier for the patient
|
|
12
12
|
AptStatus?: AptStatus; // Status of the appointment (Scheduled, Complete, etc.)
|
|
13
13
|
Pattern?: string; // Time pattern in 5-minute increments, e.g., "/XX/" for 20 minutes
|
|
@@ -48,9 +48,9 @@ export interface Visit {
|
|
|
48
48
|
duration?: number; // pattern * 5
|
|
49
49
|
status?: string; //
|
|
50
50
|
ProvNum?: number; // ProvNum or ProvHyg depending on IsHygiene
|
|
51
|
-
ProviderDocRef?:
|
|
52
|
-
VisitTypeDocRef?:
|
|
53
|
-
OpDocRef?:
|
|
51
|
+
ProviderDocRef?: DocumentReference; //
|
|
52
|
+
VisitTypeDocRef?: DocumentReference; //
|
|
53
|
+
OpDocRef?: DocumentReference; //
|
|
54
54
|
date?: string; //
|
|
55
55
|
dateTime?: string; //
|
|
56
56
|
firestoreTimestamp?: Timestamp; // admin.firestore.Timestamp.fromDate(moment_aptDateTime.toDate()),
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Appointment } from '../types/appointmentTypes';
|
|
2
2
|
import { Visit } from '../transformerTypes/visitTypes';
|
|
3
3
|
import moment from 'moment-timezone';
|
|
4
|
+
import admin from 'firebase-admin';
|
|
4
5
|
import { Timestamp } from 'firebase-admin/firestore';
|
|
5
6
|
|
|
7
|
+
const db = admin.firestore();
|
|
8
|
+
|
|
6
9
|
export function appointmentToVisit(apt: Appointment): Visit {
|
|
7
10
|
const moment_aptDateTime = moment.tz(apt.AptDateTime, 'YYYY-MM-DD HH:mm:ss', 'America/Los_Angeles');
|
|
8
11
|
|
|
@@ -15,10 +18,10 @@ export function appointmentToVisit(apt: Appointment): Visit {
|
|
|
15
18
|
|
|
16
19
|
const duration = (apt.Pattern?.length || 0) * 5;
|
|
17
20
|
const location = 'NF6YVFAXyRVXGi5nItqV';
|
|
18
|
-
const display_ProvNum = apt.IsHygiene ? apt.ProvHyg : apt.ProvNum;
|
|
21
|
+
const display_ProvNum = apt.IsHygiene == 'true' ? apt.ProvHyg : apt.ProvNum;
|
|
19
22
|
|
|
20
23
|
return {
|
|
21
|
-
docRef: `/patients/${apt.PatNum}/patientVisits/${apt.AptNum}
|
|
24
|
+
docRef: db.doc(`/patients/${apt.PatNum}/patientVisits/${apt.AptNum}`),
|
|
22
25
|
...apt,
|
|
23
26
|
TimeLocked: apt.TimeLocked === 'true',
|
|
24
27
|
IsHygiene: apt.IsHygiene == 'true',
|
|
@@ -26,9 +29,9 @@ export function appointmentToVisit(apt: Appointment): Visit {
|
|
|
26
29
|
appendix: {
|
|
27
30
|
duration: duration,
|
|
28
31
|
ProvNum: display_ProvNum,
|
|
29
|
-
ProviderDocRef: display_ProvNum != 0 ? `/providers/${display_ProvNum}` : undefined,
|
|
30
|
-
VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? `/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}` : undefined,
|
|
31
|
-
OpDocRef: apt.Op != 0 ? `/locations/${location}/locationOperatories/${apt.Op}` : undefined,
|
|
32
|
+
ProviderDocRef: display_ProvNum != 0 ? db.doc(`/providers/${display_ProvNum}`) : undefined,
|
|
33
|
+
VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? db.doc(`/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}`) : undefined,
|
|
34
|
+
OpDocRef: apt.Op != 0 ? db.doc(`/locations/${location}/locationOperatories/${apt.Op}`) : undefined,
|
|
32
35
|
date: moment_aptDateTime.format('YYYY-MM-DD'),
|
|
33
36
|
dateTime: moment_aptDateTime.format(),
|
|
34
37
|
firestoreTimestamp: firestoreTimestamp,
|