-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notification model and entitie added
- Loading branch information
Showing
19 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export enum NotificationStatus { | ||
READ = 'read', | ||
UNREAD = 'unread' | ||
} | ||
export enum NotificationTypes { | ||
APPOINTMENT_CANCELED = 'appointment_canceled', | ||
APPOINTMENT_CONFIRMED = 'appointment_confirmed', | ||
APPOINTMENT_REMINDER = 'appointment_reminder', | ||
} | ||
|
||
export default interface INotification { | ||
readonly _id?: string; | ||
readonly patientId?: string; | ||
readonly doctorId?: string; | ||
readonly type?: string; | ||
readonly message?: string; | ||
readonly createdAt?: Date; | ||
readonly updatedAt?: Date; | ||
readonly appointmentId?:string | ||
status?: NotificationStatus, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { model, Schema } from "mongoose"; | ||
import INotification, { NotificationStatus, NotificationTypes } from "../../domain/entities/INotification"; | ||
|
||
const notificationSchema = new Schema<INotification>( | ||
{ | ||
patientId: { | ||
type: Schema.Types.ObjectId, | ||
ref: "Patient", | ||
index: true, | ||
}, | ||
doctorId: { | ||
type: Schema.Types.ObjectId, | ||
ref: "Doctor", | ||
index: true, | ||
}, | ||
type: { | ||
type: String, | ||
enum: Object.values(NotificationTypes), | ||
required: true, | ||
}, | ||
message: { | ||
type: String, | ||
required: true, | ||
}, | ||
status: { | ||
type: String, | ||
enum: Object.values(NotificationStatus), | ||
default: NotificationStatus.UNREAD, | ||
}, | ||
appointmentId: { | ||
type: Schema.Types.ObjectId, | ||
ref: "Appointment", | ||
required: false, | ||
}, | ||
}, | ||
{ | ||
timestamps: true, | ||
versionKey: false, | ||
minimize: false | ||
} | ||
); | ||
|
||
const NotificationModel = model<INotification>("Notification", notificationSchema); | ||
export default NotificationModel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters