@gameroom/gameroom-kit
Version:
Node kit for the Gameroom API
14 lines (12 loc) • 565 B
JavaScript
const Emporium = require('@emporium/core'),
uuid = require('uuid'),
{ apiAdapter } = require('../adapters'),
{ SecondsFrom1970 } = require('../lib');
module.exports = new Emporium(apiAdapter, {
strict: false,
beforeDefine: (attributes, options) => {
if (!attributes.created_at) attributes.created_at = {type: SecondsFrom1970, default: SecondsFrom1970.now};
if (!attributes.updated_at) attributes.updated_at = {type: SecondsFrom1970, default: SecondsFrom1970.now};
if (!attributes.id) attributes.id = {type: String, default: uuid.v1};
}
});