UNPKG

@topgroup/diginext

Version:

A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.

116 lines (115 loc) 3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.userSchema = void 0; const mongoose_1 = require("mongoose"); const Base_1 = require("./Base"); const providerInfoSchema = new mongoose_1.Schema({ name: { type: String, }, user_id: { type: String, }, access_token: { type: String, }, }); const accessTokenInfoSchema = new mongoose_1.Schema({ access_token: { type: String, required: true, }, refresh_token: { type: String, }, expiredTimestamp: { type: Number, required: true, }, expiredDate: { type: Date, required: true, }, expiredDateGTM7: { type: String, required: true, }, }); exports.userSchema = new mongoose_1.Schema({ ...Base_1.baseSchemaDefinitions, name: { type: String, maxlength: 250, }, username: { type: String, }, type: { type: String, default: "user", }, email: { type: String, maxlength: 500, }, verified: { type: Boolean, default: false, }, image: { type: String, }, providers: { type: [providerInfoSchema], default: [], }, password: { type: String, }, dxUserId: { type: String }, token: { type: accessTokenInfoSchema, }, roles: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "roles" }], ref: "roles", default: [], }, activeRole: { type: mongoose_1.Schema.Types.ObjectId, ref: "roles", }, teams: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "teams" }], ref: "teams", default: [], }, workspaces: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "workspaces" }], ref: "workspaces", default: [], }, activeWorkspace: { type: mongoose_1.Schema.Types.ObjectId, ref: "workspaces", }, owner: { type: mongoose_1.Schema.Types.ObjectId, ref: "users", }, ownerSlug: String, allowAccess: { projects: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "projects" }], apps: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "apps" }], clusters: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "clusters" }], databases: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "cloud_databases" }], database_backups: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "cloud_database_backups" }], gits: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "git_providers" }], frameworks: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "frameworks" }], container_registries: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "container_registries" }], }, settings: { type: mongoose_1.Schema.Types.Mixed }, }, { collection: "users", timestamps: true, });