+/* Copyright (c) 2019 AT&T Intellectual Property. #\r
+# #\r
+# Licensed under the Apache License, Version 2.0 (the "License"); #\r
+# you may not use this file except in compliance with the License. #\r
+# You may obtain a copy of the License at #\r
+# #\r
+# http://www.apache.org/licenses/LICENSE-2.0 #\r
+# #\r
+# Unless required by applicable law or agreed to in writing, software #\r
+# distributed under the License is distributed on an "AS IS" BASIS, #\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #\r
+# See the License for the specific language governing permissions and #\r
+# limitations under the License. #\r
+##############################################################################*/\r
+\r
+\r
+\r
+module.exports = function (app) {\r
+ const mongooseClient = app.get('mongooseClient');\r
+ const { Schema } = mongooseClient;\r
+ const testDefinitions = new Schema({\r
+ testName: { type: String, required: true },\r
+ testDescription: { type: String, required: true },\r
+ processDefinitionKey: { type: String, unique: true },\r
+ creatorId: { type: Schema.Types.ObjectId, ref: 'users', required: true },\r
+ groupId: { type: Schema.Types.ObjectId, ref: 'groups', required: true },\r
+ bpmnInstances: [new Schema({\r
+ processDefinitionId: { type: String },\r
+ deploymentId: { type: String },\r
+ version: { type: String, required: true },\r
+ bpmnFileId: { type: Schema.Types.ObjectId, ref: 'files', required: true },\r
+ resourceFileId: {type: Schema.Types.ObjectId, ref: 'files' },\r
+ isDeployed: { type: Boolean, required: true, default: false },\r
+ testHeads: [new Schema({\r
+ testHeadId: { type: Schema.Types.ObjectId, ref: 'testHeads' },\r
+ bpmnVthTaskId: { type: String },\r
+ label: { type: String, default: '' }\r
+ }, { _id: false })],\r
+ pflos: [new Schema({\r
+ bpmnPfloTaskId: { type: String },\r
+ label: { type: String, default: '' }\r
+ }, { _id: false })],\r
+ testDataTemplate: { type: Object, default: {} }, \r
+ updatedBy: { type: Schema.Types.ObjectId, ref: 'users'},\r
+ createdBy: { type: Schema.Types.ObjectId, ref: 'users'}\r
+ }, { _id: false, timestamps: true })],\r
+ disabled: {type: Boolean, default: false},\r
+ updatedBy: { type: Schema.Types.ObjectId, ref: 'users'},\r
+ createdBy: { type: Schema.Types.ObjectId, ref: 'users'}\r
+ }, {\r
+ timestamps: true,\r
+ minimize: false\r
+ });\r
+\r
+ \r
+ \r
+ return mongooseClient.model('testDefinitions', testDefinitions, 'testDefinitions');\r
+};\r