| Current Path : /proc/thread-self/root/home/deltalab/PMS/partner-manager-backend/models/mongoose/ |
| Current File : //proc/thread-self/root/home/deltalab/PMS/partner-manager-backend/models/mongoose/api-key.js |
const mongoose = require('mongoose');
// SCHEMA ============================================
const ApiKeySchema = new mongoose.Schema(
{
keyPrefix: { type: String, required: true, unique: true },
key: { type: String, required: true },
name: { type: String, required: true },
enabled: { type: Boolean, required: true, default: false },
scopes: {
type: [String],
enum: ['MODULE_REGISTRATION', 'CHECK_SERVICE_STATUS'],
required: true,
},
},
{
timestamps: true,
versionKey: false,
},
);
// MODELS ============================================
const apiKeyModel = mongoose.model('ApiKey', ApiKeySchema);
// EXPORTS ===========================================
module.exports = {
apiKeyModel,
ApiKeySchema,
};