forked from ashikaShameera/PatientDataManagementSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.js
116 lines (111 loc) · 3.62 KB
/
schemas.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const Joi = require('joi');
const { number } = require('joi');
module.exports.patientSchema = Joi.object({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
email: Joi.string().email().required(),
dateOfBirth: Joi.date().iso().required(),
gender: Joi.string().valid('Male', 'Female', 'Other').required(),
contactNumber: Joi.string().required(),
nic: Joi.string().required(),
address: Joi.object({
number: Joi.string().required(),
street: Joi.string().required(),
city: Joi.string().required(),
state: Joi.string().required(),
postalCode: Joi.string().required(),
}).required(),
medicalHistory: Joi.object({
allergies: Joi.string().required(),
conditions: Joi.string().required(),
medications: Joi.string().required(),
}).required(),
emergencyContact: Joi.object({
EmgName: Joi.string().required(),
EmgRelationship: Joi.string().required(),
EmgContactNumber: Joi.string().required(),
}).required(),
password: Joi.string()
});
module.exports.doctorSchema = Joi.object({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
nic: Joi.string().required(),
dateOfBirth: Joi.date().required(),
gender: Joi.string().valid('Male', 'Female', 'Other').required(),
contactNumber: Joi.string().required(),
email: Joi.string().email().required(),
address: Joi.object({
number: Joi.string().required(),
street: Joi.string().required(),
city: Joi.string().required(),
state: Joi.string().required(),
postalCode: Joi.string().required(),
}),
medicalLicenseNumber: Joi.string().required(),
specialization: Joi.string().valid(
'Internal Medicine',
'Family Medicine',
'Pediatrics',
'Obstetrics and Gynecology',
'General Surgery',
'Anesthesiology',
'Psychiatry',
'Orthopedic Surgery',
'Cardiology',
'Dermatology'
).required(),
degree: Joi.string().required(),
university: Joi.string().required(),
password: Joi.string(),
});
module.exports.insurerSchema = Joi.object({
companyName: Joi.string().required(),
email: Joi.string().email().required(),
address: Joi.object({
number: Joi.string().required(),
street: Joi.string().required(),
city: Joi.string().required(),
state: Joi.string().required(),
postalCode: Joi.string().required(),
}),
iic: Joi.string().required(),
contactNumber: Joi.string().required(),
password: Joi.string(),
});
module.exports.nurseSchema = Joi.object({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
nic: Joi.string().required(),
dateOfBirth: Joi.date().required(),
gender: Joi.string().valid('Male', 'Female', 'Other'),
contactNumber: Joi.string().required(),
email: Joi.string().email().required(),
address: Joi.object({
number: Joi.string().required(),
street: Joi.string().required(),
city: Joi.string().required(),
state: Joi.string().required(),
postalCode: Joi.string().required(),
}),
nurseLicenseNumber: Joi.string().required(),
password: Joi.string(),
});
module.exports.pharmacistSchema = Joi.object({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
nic: Joi.string().required(),
dateOfBirth: Joi.date().required(),
gender: Joi.string().valid('Male', 'Female', 'Other'),
contactNumber: Joi.string().required(),
email: Joi.string().email().required(),
address: Joi.object({
number: Joi.string().required(),
street: Joi.string().required(),
city: Joi.string().required(),
state: Joi.string().required(),
postalCode: Joi.string().required(),
}),
pharmacistLicenseNumber: Joi.string().required(),
password: Joi.string(),
});