Mercurial > pumpbridge
diff src/user.coffee @ 0:b73191efc65b
Initial import of pumpbridge (bloody bloody alpha)
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Thu, 05 Jun 2014 10:35:15 +0200 |
parents | |
children | 98a070c98982 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/user.coffee Thu Jun 05 10:35:15 2014 +0200 @@ -0,0 +1,36 @@ +# Copyright (C) 2014 by Intevation GmbH +# Author: Mathias Gebbe <mgebbe@intevation.de> +# +# This file is Free Software under the Apache License, Version 2.0 +# (the "License"); and comes with ABSOLUTELY NO WARRANTY! +# You may not use this file except in compliance with the License. +# See LICENSE for details. + +_ = require("underscore") +async = require("async") +DatabankObject = require("databank").DatabankObject +User = DatabankObject.subClass("bridgeuser") + +User.schema = + pkey: "id" + fields: [ + "name" + "displayName" + "profileLink" + "profilePicLink" + "created" + ] + indices: [ + "name" + "displayName" + ] + +User.beforeCreate = (props, callback) -> + if not props.id + callback new Error("Need 'id' in User"), null + return + props.created = Date.now() + callback null, props + return + +module.exports = User