@taiger-common/model 1.0.46 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Role = void 0;
4
+ exports.Role = {
5
+ Admin: 'Admin',
6
+ Manager: 'Manager',
7
+ External: 'External',
8
+ Guest: 'Guest',
9
+ Agent: 'Agent',
10
+ Editor: 'Editor',
11
+ Student: 'Student'
12
+ };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var mongoose_1 = require("mongoose");
7
7
  var validator_1 = __importDefault(require("validator"));
8
8
  var core_1 = require("@taiger-common/core");
9
+ var users_1 = require("../constants/users");
9
10
  var Program_1 = require("./Program");
10
11
  var ManagerType = {
11
12
  Agent: 'Agent',
@@ -25,6 +26,11 @@ var attributeSchema = new mongoose_1.Schema({
25
26
  }
26
27
  });
27
28
  var userSchema = new mongoose_1.Schema({
29
+ role: {
30
+ type: String,
31
+ enum: Object.values(users_1.Role),
32
+ required: true
33
+ },
28
34
  firstname: {
29
35
  type: String,
30
36
  trim: true
@@ -0,0 +1,9 @@
1
+ export var Role = {
2
+ Admin: 'Admin',
3
+ Manager: 'Manager',
4
+ External: 'External',
5
+ Guest: 'Guest',
6
+ Agent: 'Agent',
7
+ Editor: 'Editor',
8
+ Student: 'Student'
9
+ };
@@ -1,6 +1,7 @@
1
1
  import { Schema } from 'mongoose';
2
2
  import validator from 'validator';
3
3
  import { DocumentStatusType } from '@taiger-common/core';
4
+ import { Role } from '../constants/users';
4
5
  import { PROGRAM_SUBJECT_KEYS } from './Program';
5
6
  var ManagerType = {
6
7
  Agent: 'Agent',
@@ -20,6 +21,11 @@ var attributeSchema = new Schema({
20
21
  }
21
22
  });
22
23
  var userSchema = new Schema({
24
+ role: {
25
+ type: String,
26
+ enum: Object.values(Role),
27
+ required: true
28
+ },
23
29
  firstname: {
24
30
  type: String,
25
31
  trim: true
@@ -0,0 +1,9 @@
1
+ export declare const Role: {
2
+ Admin: string;
3
+ Manager: string;
4
+ External: string;
5
+ Guest: string;
6
+ Agent: string;
7
+ Editor: string;
8
+ Student: string;
9
+ };
@@ -93,6 +93,7 @@ export interface IUserAttribute {
93
93
  name: string;
94
94
  }
95
95
  export interface IUser {
96
+ role?: string;
96
97
  firstname?: string;
97
98
  firstname_chinese?: string;
98
99
  lastname?: string;