mgebbe@0: # Copyright (C) 2014 by Intevation GmbH mgebbe@0: # Author: Mathias Gebbe mgebbe@0: # mgebbe@3: # This file is Free Software under the Apache License, Version 2.0; mgebbe@3: # and comes with NO WARRANTY! mgebbe@3: # See the documentation coming with pumpbridge for details. mgebbe@0: mgebbe@0: _ = require("underscore") mgebbe@0: async = require("async") mgebbe@0: DatabankObject = require("databank").DatabankObject mgebbe@0: User = DatabankObject.subClass("bridgeuser") mgebbe@0: mgebbe@0: User.schema = mgebbe@0: pkey: "id" mgebbe@0: fields: [ mgebbe@0: "name" mgebbe@0: "displayName" mgebbe@0: "profileLink" mgebbe@0: "profilePicLink" mgebbe@0: "created" mgebbe@0: ] mgebbe@0: indices: [ mgebbe@0: "name" mgebbe@0: "displayName" mgebbe@0: ] mgebbe@0: mgebbe@0: User.beforeCreate = (props, callback) -> mgebbe@0: if not props.id mgebbe@0: callback new Error("Need 'id' in User"), null mgebbe@0: return mgebbe@0: props.created = Date.now() mgebbe@0: callback null, props mgebbe@0: return mgebbe@0: mgebbe@0: module.exports = User