Skip to content

Instantly share code, notes, and snippets.

@vuongngo
Created September 4, 2017 11:17
Show Gist options
  • Save vuongngo/8bc0af8215092d63d69a9dcb1186c590 to your computer and use it in GitHub Desktop.
Save vuongngo/8bc0af8215092d63d69a9dcb1186c590 to your computer and use it in GitHub Desktop.
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