|
|
|
// user-types.js
|
|
|
|
// Copyright (C) 2022 DTP Technologies, LLC
|
|
|
|
// License: Apache-2.0
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const mongoose = require('mongoose');
|
|
|
|
const Schema = mongoose.Schema;
|
|
|
|
|
|
|
|
module.exports.DTP_THEME_LIST = ['dtp-light', 'dtp-dark'];
|
|
|
|
|
|
|
|
module.exports.DTP_USER_TYPE_LIST = ['CoreUser', 'User'];
|
|
|
|
module.exports.DtpUserSchema = new Schema({
|
|
|
|
userType: { type: String, enum: module.exports.DTP_USER_TYPE_LIST, required: true },
|
|
|
|
user: { type: Schema.ObjectId, required: true, index: true, refPath: 'userType' },
|
|
|
|
}, { _id: false });
|
|
|
|
|
|
|
|
module.exports.UserFlagsSchema = new Schema({
|
|
|
|
isAdmin: { type: Boolean, default: false, required: true },
|
|
|
|
isModerator: { type: Boolean, default: false, required: true },
|
|
|
|
isEmailVerified: { type: Boolean, default: false, required: true },
|
|
|
|
}, { _id: false });
|
|
|
|
|
|
|
|
module.exports.UserPermissionsSchema = new Schema({
|
|
|
|
canLogin: { type: Boolean, default: true, required: true },
|
|
|
|
canChat: { type: Boolean, default: true, required: true },
|
|
|
|
canComment: { type: Boolean, default: true, required: true },
|
|
|
|
canReport: { type: Boolean, default: true, required: true },
|
|
|
|
}, { _id: false });
|
|
|
|
|
|
|
|
module.exports.UserOptInSchema = new Schema({
|
|
|
|
system: { type: Boolean, default: true, required: true },
|
|
|
|
marketing: { type: Boolean, default: true, required: true },
|
|
|
|
}, { _id: false });
|