Last active
February 7, 2019 13:41
-
-
Save guidouil/9a36ed9348ad50f0cffbf25795db7560 to your computer and use it in GitHub Desktop.
ActivitiesSchema
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
export const ActivitiesSchema = new SimpleSchema({ | |
_id: { | |
type: String, | |
optional: true, // because insert | |
}, | |
reference: { | |
type: String, | |
}, | |
name: { | |
type: String, | |
}, | |
background: { | |
type: String, | |
optional: true, | |
}, | |
catchPhrase: { | |
type: String, | |
optional: true, | |
}, | |
description: { | |
type: String, | |
optional: true, | |
}, | |
street: { | |
type: String, | |
optional: true, | |
}, | |
zipCode: { | |
type: String, | |
optional: true, | |
}, | |
city: { | |
type: String, | |
optional: true, | |
}, | |
country: { | |
type: String, | |
optional: true, | |
}, | |
phone: { | |
type: String, | |
optional: true, | |
}, | |
mood: { | |
type: String, | |
optional: true, | |
}, | |
coordinates: { | |
type: GeocoordsSchema, | |
optional: true, | |
}, | |
categories: { | |
type: Array, | |
optional: true, | |
}, | |
'categories.$': { | |
type: String, | |
}, | |
createdAt: { | |
type: Date, | |
autoValue() { | |
if (this.isInsert) { | |
return new Date(); | |
} | |
if (this.isUpsert) { | |
return { $setOnInsert: new Date() }; | |
} | |
this.unset(); // Prevent user from supplying their own value | |
}, | |
optional: true, | |
}, | |
updatedAt: { | |
type: Date, | |
autoValue() { | |
if (this.isUpdate) { | |
return new Date(); | |
} | |
}, | |
denyInsert: true, | |
optional: true, | |
}, | |
}, { check }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment