@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
36 lines (35 loc) • 1.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebhookModel = exports.webhookSchema = void 0;
const mongoose_1 = require("mongoose");
const SystemTypes_1 = require("../interfaces/SystemTypes");
const Base_1 = require("./Base");
exports.webhookSchema = new mongoose_1.Schema({
...Base_1.baseSchemaDefinitions,
name: String,
status: { type: String, enum: SystemTypes_1.webhookEventStatusList },
events: [{ type: String, enum: SystemTypes_1.systemEventList }],
channels: [{ type: String, enum: SystemTypes_1.webhookChannelList }],
// consumers
consumers: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "users" }],
consumerGroups: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "teams" }],
// callback
url: String,
method: String,
headers: mongoose_1.Schema.Types.Mixed,
body: mongoose_1.Schema.Types.Mixed,
httpStatus: mongoose_1.Schema.Types.Mixed,
responseStatus: Number,
// references
build: { type: mongoose_1.Schema.Types.ObjectId, ref: "builds" },
release: { type: mongoose_1.Schema.Types.ObjectId, ref: "releases" },
app: { type: mongoose_1.Schema.Types.ObjectId, ref: "apps" },
database: { type: mongoose_1.Schema.Types.ObjectId, ref: "databases" },
databaseBackup: { type: mongoose_1.Schema.Types.ObjectId, ref: "cloud_database_backups" },
gitProvider: { type: mongoose_1.Schema.Types.ObjectId, ref: "git_providers" },
cluster: { type: mongoose_1.Schema.Types.ObjectId, ref: "clusters" },
registry: { type: mongoose_1.Schema.Types.ObjectId, ref: "container_registries" },
framework: { type: mongoose_1.Schema.Types.ObjectId, ref: "frameworks" },
team: { type: mongoose_1.Schema.Types.ObjectId, ref: "teams" },
}, { collection: "webhooks", timestamps: true });
exports.WebhookModel = (0, mongoose_1.model)("Webhook", exports.webhookSchema, "webhooks");