Mercurial > pumpbridge
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b73191efc65b |
---|---|
1 # Copyright (C) 2014 by Intevation GmbH | |
2 # Author: Mathias Gebbe <mgebbe@intevation.de> | |
3 # | |
4 # This file is Free Software under the Apache License, Version 2.0 | |
5 # (the "License"); and comes with ABSOLUTELY NO WARRANTY! | |
6 # You may not use this file except in compliance with the License. | |
7 # See LICENSE for details. | |
8 | |
9 _ = require("underscore") | |
10 async = require("async") | |
11 DatabankObject = require("databank").DatabankObject | |
12 User = DatabankObject.subClass("bridgeuser") | |
13 | |
14 User.schema = | |
15 pkey: "id" | |
16 fields: [ | |
17 "name" | |
18 "displayName" | |
19 "profileLink" | |
20 "profilePicLink" | |
21 "created" | |
22 ] | |
23 indices: [ | |
24 "name" | |
25 "displayName" | |
26 ] | |
27 | |
28 User.beforeCreate = (props, callback) -> | |
29 if not props.id | |
30 callback new Error("Need 'id' in User"), null | |
31 return | |
32 props.created = Date.now() | |
33 callback null, props | |
34 return | |
35 | |
36 module.exports = User |