-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented backend for notification log
- Loading branch information
1 parent
ac35123
commit c8a8683
Showing
3 changed files
with
100 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Notification Model Schema | ||
* | ||
* Defines the Mongoose schema for user message notification in the application. It includes fields for user ID | ||
* (who posted the original message), | ||
* message text (of the original message), | ||
* notification text, | ||
* and the location of the original message | ||
*/ | ||
|
||
import mongoose from "mongoose"; | ||
const { Schema } = mongoose; | ||
|
||
export const NotificationSchema = new Schema({ | ||
user_id: { | ||
type: Schema.Types.ObjectId, | ||
required: true, | ||
}, | ||
message_text: { | ||
type: String, | ||
required: [true, "Please enter the content of the message"], | ||
}, | ||
location: { | ||
type: { | ||
type: String, | ||
enum: ["Point"], | ||
required: true, | ||
}, | ||
coordinates: { | ||
type: [Number], | ||
required: true, | ||
}, | ||
}, | ||
notification_text: { | ||
type: String, | ||
required: [true, "Please enter the content of the notification"], | ||
} | ||
}); | ||
|
||
const NotificationModel = mongoose.model("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