JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
API Documentation Admin Webapp
API Documentation
MEDPULSE DATABASE [DRAFT]
More
Share
Explore
MEDPULSE DATABASE [DRAFT]
CONTACT MODEL
id: {
type
: DataTypes
.
INTEGER
,
autoIncrement:
true
,
primaryKey:
true
,
unique
:
true
,
allowNull:
false
}
,
name: {
type
: DataTypes
.
STRING
,
allowNull:
false
}
,
email: {
type
: DataTypes
.
STRING
,
unique
:
true
,
allowNull:
false
,
validate: {
isEmail:
true
}
}
,
mobile: {
type
: DataTypes
.
STRING
,
allowNull:
false
,
unique
:
true
,
validate: {
isMobile
(
value
)
{
if
(
!
mobileRegex
.
test
(
value
)
)
{
throw new Error
(
'mobile number must be valid'
)
;
}
}
}
}
,
type
: {
type
: DataTypes
.
ENUM
,
values
:
[
'doctor'
,
'hospital'
,
'pharmacy'
]
,
allowNull:
false
,
validate: {
notNull:
true
,
isIn:
[
[
'doctor'
,
'hospital'
,
'pharmacy'
]
]
}
}
,
registration: {
type
: DataTypes
.
STRING
}
,
image: {
type
: DataTypes
.
TEXT
(
'long'
)
}
,
about: {
type
: DataTypes
.
TEXT
(
'medium'
)
}
,
status
:{
type
: DataTypes
.
ENUM
,
values
:
[
'pending'
,
'approved'
,
'rejected'
]
,
allowNull:
false
,
defaultValue:
"pending"
,
validate: {
notNull:
true
,
isIn:
[
[
'pending'
,
'approved'
,
'rejected'
]
]
}
}
,
reason:{
type
: DataTypes
.
TEXT
(
'medium'
)
}
}
,
// Foreign Keys
ContactModal
.
hasOne
(
AddressModal
,
{ foreignKey:
'contactId'
,
sourceKey:
'id'
,
as
:
'address'
,
onDelete:
'CASCADE'
}
)
;
ContactModal
.
belongsTo
(
AssigneModel
,
{foreignKey: {name:
'employeeId'
,
allowNull:
true
}
,
as
:
'assigne'
,
targetKey:
'id'
}
)
;
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.