-
-
Save imcodingideas/0e5f19b0a291909e7744191857a212d8 to your computer and use it in GitHub Desktop.
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
/*jshint esversion: 6 */ | |
/** | |
* Created by joseph on 12/2/16. | |
*/ | |
const | |
mongoose = require('mongoose'), | |
Schema = mongoose.Schema, | |
Types = Schema.Types; | |
const statusSchema = { | |
review: Types.Boolean, | |
accepted: Types.Boolean, | |
redeemed: Types.Boolean, | |
declined: Types.Boolean, | |
expired: Types.Boolean, | |
pending: Types.Boolean, | |
paid: Types.Boolean | |
}; | |
const GiftSchema = new Schema({ | |
user: { | |
type: Types.ObjectId, | |
ref: 'User', | |
required: true, | |
index: true | |
}, | |
giftNumber: Types.Number, | |
date: Date, | |
status: { | |
type: statusSchema, | |
default: { | |
review: true, | |
accepted: false, | |
redeemed: false, | |
declined: false, | |
expired: false, | |
pending: false, | |
paid: false | |
} | |
}, | |
giftDescription: Types.String, | |
giftAmount: Types.Number, | |
giftCode: Types.String, | |
redeemCode: Types.String, | |
passCode: Types.String, | |
senderFirstName: Types.String, | |
senderLastName: Types.String, | |
giftMessage: Types.String | |
}); | |
module.exports = mongoose.model('Gift', GiftSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment