added svcapi ui and camunda code
[it/otf.git] / otf-frontend / server / src / feathers / models / users.model.js
1 /*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\r
3 #   Licensed under the Apache License, Version 2.0 (the "License");            #\r
4 #   you may not use this file except in compliance with the License.           #\r
5 #   You may obtain a copy of the License at                                    #\r
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\r
9 #   Unless required by applicable law or agreed to in writing, software        #\r
10 #   distributed under the License is distributed on an "AS IS" BASIS,          #\r
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
12 #   See the License for the specific language governing permissions and        #\r
13 #   limitations under the License.                                             #\r
14 ##############################################################################*/\r
15 \r
16 \r
17 \r
18 module.exports = function (app) {\r
19         const mongooseClient = app.get('mongooseClient');\r
20         \r
21         const { Schema } = mongooseClient;\r
22         const users = new Schema({\r
23                 firstName: { type: String, required: true },\r
24                 lastName: { type: String, required: true },\r
25                 email: { type: String, required: true, unique: true },\r
26                 permissions: { type: Array, default: ['user'] },\r
27                 enabled: { type: Boolean, required: true, default: false },\r
28                 isVerified: { type: Boolean },\r
29                 verifyToken: { type: String },\r
30                 verifyExpires: { type: Date },\r
31                 verifyChanges: { type: Object },\r
32                 resetToken: { type: String },\r
33                 resetExpires: { type: Date },\r
34                 defaultGroup: { type: Schema.Types.ObjectId, ref: 'groups' },\r
35                 defaultGroupEnabled: { type: Boolean, default: false },\r
36                 password: { type: String, required: true },\r
37                 favorites: new Schema({\r
38                         testDefinitions: [{type: Schema.Types.ObjectId, ref: 'testDefinitions'}]\r
39                 }, { _id: false})\r
40         }, {\r
41                 timestamps: true\r
42         });\r
43 \r
44         return mongooseClient.model('users', users);\r
45 \r
46 };\r