Created
September 4, 2017 11:17
-
-
Save vuongngo/8bc0af8215092d63d69a9dcb1186c590 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
var keystone = require('keystone'); | |
var Types = keystone.Field.Types; | |
/** | |
* Job Model | |
* ========== | |
*/ | |
var Job = new keystone.List('Job'); | |
Job.add({ | |
_id: { | |
type: String, | |
index: true | |
}, | |
title: { | |
type: String, | |
index: true | |
}, | |
description: { | |
type: String, | |
}, | |
createdAt: { | |
type: Types.Date | |
}, | |
updatedAt: { | |
type: Types.Date | |
}, | |
}); | |
// Provide access to Keystone | |
Job.schema.virtual('canAccessKeystone').get(function () { | |
return this.isAdmin; | |
}); | |
/** | |
* Registration | |
*/ | |
Job.defaultColumns = '_id, title, description, createdAt, updatedAt'; | |
Job.register(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment