@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
42 lines (41 loc) • 1.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GitProviderModel = exports.gitProviderSchema = exports.githubAuthFlow = exports.bitbucketAuthFlow = void 0;
const mongoose_1 = require("mongoose");
const SystemTypes_1 = require("../interfaces/SystemTypes");
const Base_1 = require("./Base");
exports.bitbucketAuthFlow = ["app_password", "oauth_consumer"];
exports.githubAuthFlow = ["personal_access_token", "oauth_app"];
exports.gitProviderSchema = new mongoose_1.Schema({
...Base_1.baseSchemaDefinitions,
name: { type: String },
isDefault: { type: Boolean, default: false },
host: { type: String },
org: { type: String },
gitWorkspace: { type: String },
repo: {
url: { type: String },
sshPrefix: { type: String },
},
isOrg: { type: Boolean, default: false },
type: { type: String, enum: SystemTypes_1.availableGitProviders },
github_oauth: {
consumer_key: { type: String },
consumer_secret: { type: String },
username: { type: String },
app_password: { type: String },
verified: { type: Boolean },
},
bitbucket_oauth: {
client_id: { type: String },
client_secret: { type: String },
username: { type: String },
personal_access_token: { type: String },
verified: { type: Boolean },
},
method: { type: String, enum: ["bearer", "basic"] },
access_token: { type: String },
refresh_token: { type: String },
verified: { type: Boolean },
}, { collection: "git_providers", timestamps: true });
exports.GitProviderModel = (0, mongoose_1.model)("GitProvider", exports.gitProviderSchema, "git_providers");