-
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.
Browse files
Browse the repository at this point in the history
Create a Pet Event | Back End
- Loading branch information
Showing
17 changed files
with
749 additions
and
453 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,25 @@ | ||
import { Schema, model } from 'mongoose' | ||
// FUNCTIONS | ||
import { parseErrorMsg } from '../../functions/parsers' | ||
|
||
const eventSchema = new Schema({ | ||
description: { | ||
type: String, | ||
required: [true, parseErrorMsg.missingValue('Description', 'Event')], | ||
minlength: [2, parseErrorMsg.minMaxValue('Name', 3, true)], | ||
maxlength: [200, parseErrorMsg.minMaxValue('Name', 200, false)] | ||
}, | ||
date: { | ||
type: String, | ||
required: [true, parseErrorMsg.missingValue('Date', 'Event')] | ||
}, | ||
associatedPets: { | ||
type: [Schema.Types.ObjectId], | ||
required: [true, parseErrorMsg.missingValue('Pet', 'Event')], | ||
ref: 'Pet' | ||
} | ||
}) | ||
|
||
const Event = model('Event', eventSchema) | ||
|
||
export default Event |
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
Oops, something went wrong.