UNPKG

@tachybase/plugin-workflow-approval

Version:

Approval base in Workflow

97 lines (96 loc) 2.4 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var approvals_exports = {}; __export(approvals_exports, { default: () => approvals_default }); module.exports = __toCommonJS(approvals_exports); var import_server = require("@tego/server"); var approvals_default = (0, import_server.defineCollection)({ namespace: "workflow.approvals", dumpRules: "required", name: "approvals", createdBy: true, updatedBy: true, fields: [ { type: "string", name: "collectionName" }, { type: "string", name: "dataKey" }, { type: "belongsTo", name: "workflow", onDelete: "CASCADE" }, { type: "string", name: "workflowKey" }, { type: "belongsToMany", name: "executions", through: "approvalExecutions", targetKey: "id", sourceKey: "id", foreignKey: "approvalId", otherKey: "executionId" }, { type: "hasMany", name: "approvalExecutions", target: "approvalExecutions", onDelete: "CASCADE" }, { type: "belongsTo", name: "latestApprovalExecution", target: "approvalExecutions", foreignKey: "latestExecutionId" }, { type: "hasMany", name: "records", target: "approvalRecords", onDelete: "CASCADE" }, { type: "integer", name: "status" }, { type: "json", name: "data", defaultValue: {} }, { type: "jsonb", name: "summary", defaultValue: {} }, { type: "belongsTo", name: "applicantRole", foreignKey: "applicantRoleName", target: "roles" } ] });