shuttlepro-shared 1.2.51 → 1.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/models/Workspace.js +125 -26
  2. package/package.json +1 -1
@@ -1,26 +1,24 @@
1
1
  const mongoose = require("mongoose");
2
-
3
- const shiftSchema = new mongoose.Schema({
4
- _id: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- default: mongoose.Types.ObjectId,
7
- },
8
- shiftName: {
9
- type: String,
10
- required: true,
11
- },
12
- days: [
13
- {
14
- day: { type: String, required: true },
15
- startTime: { type: String, required: true },
16
- endTime: { type: String, required: true },
17
- breakStartTime: { type: String, required: false },
18
- breakEndTime: { type: String, required: false },
19
- lateThreshold: { type: String, required: false },
2
+ //TODO: task manager and default location creation
3
+ const shiftSchema = new mongoose.Schema(
4
+ {
5
+ shiftName: {
6
+ type: String,
7
+ required: true,
20
8
  },
21
- ],
22
- });
23
-
9
+ days: [
10
+ {
11
+ day: { type: String, required: true },
12
+ startTime: { type: String, required: true },
13
+ endTime: { type: String, required: true },
14
+ breakStartTime: { type: String, required: false },
15
+ breakEndTime: { type: String, required: false },
16
+ lateThreshold: { type: String, required: false },
17
+ },
18
+ ],
19
+ },
20
+ { _id: true }
21
+ );
24
22
  const scoreThresholdSchema = new mongoose.Schema({
25
23
  operator: {
26
24
  type: mongoose.Schema.Types.Mixed,
@@ -39,7 +37,6 @@ const scoreThresholdSchema = new mongoose.Schema({
39
37
  default: {},
40
38
  },
41
39
  });
42
-
43
40
  const kpiSchema = new mongoose.Schema({
44
41
  weight: {
45
42
  type: Number,
@@ -54,7 +51,95 @@ const kpiSchema = new mongoose.Schema({
54
51
  default: false,
55
52
  },
56
53
  });
57
-
54
+ const ReasonSchema = new mongoose.Schema({
55
+ _id: {
56
+ type: mongoose.Schema.Types.ObjectId,
57
+ default: null,
58
+ },
59
+ reason: { type: String, required: true },
60
+ color: { type: String, default: "#000000" },
61
+ categoryTitle: { type: String, required: true },
62
+ });
63
+ const ResolutionReasonCategorySchema = new mongoose.Schema({
64
+ _id: {
65
+ type: mongoose.Schema.Types.ObjectId,
66
+ default: null,
67
+ },
68
+ title: { type: String, required: true },
69
+ reasons: { type: [ReasonSchema], default: [] },
70
+ });
71
+ const feedbackFormSchema = new mongoose.Schema({
72
+ formName: { type: String, required: true, trim: true },
73
+ brandName: { type: String, default: "" },
74
+ brandLogoUrl: { type: String, default: "", trim: true },
75
+ type: { type: String, default: "agent", enum: ["agent", "order"] },
76
+ qr: {
77
+ data: { type: String, default: "", trim: true },
78
+ code: { type: String, default: "", trim: true },
79
+ link: { type: String, default: "", trim: true },
80
+ },
81
+ integrationId: [
82
+ {
83
+ type: mongoose.Schema.Types.ObjectId,
84
+ ref: "Integration",
85
+ default: null,
86
+ },
87
+ ],
88
+ enabled: {
89
+ type: Boolean,
90
+ default: true,
91
+ },
92
+ fields: [
93
+ {
94
+ fieldName: {
95
+ type: String,
96
+ required: true,
97
+ trim: true,
98
+ },
99
+ required: {
100
+ type: Boolean,
101
+ default: false,
102
+ },
103
+ enabled: {
104
+ type: Boolean,
105
+ default: true,
106
+ },
107
+ createdBy: {
108
+ type: mongoose.Schema.Types.ObjectId,
109
+ ref: "User",
110
+ default: null,
111
+ },
112
+ updatedBy: {
113
+ type: mongoose.Schema.Types.ObjectId,
114
+ ref: "User",
115
+ default: null,
116
+ },
117
+ fieldType: {
118
+ type: String,
119
+ enum: [
120
+ "text",
121
+ "autocomplete",
122
+ "radio",
123
+ "text area",
124
+ "number",
125
+ "date",
126
+ "time",
127
+ "email",
128
+ "range",
129
+ "url",
130
+ "colour",
131
+ "file",
132
+ "starRating",
133
+ "heading",
134
+ "paragraph",
135
+ ],
136
+ },
137
+ option: {
138
+ type: mongoose.Schema.Types.Mixed,
139
+ },
140
+ },
141
+ ],
142
+ });
58
143
  const workspaceSchema = new mongoose.Schema(
59
144
  {
60
145
  name: {
@@ -101,6 +186,7 @@ const workspaceSchema = new mongoose.Schema(
101
186
  {
102
187
  reason: { type: String, default: "" },
103
188
  type: { type: String, default: "" },
189
+ color: { type: String, default: "" },
104
190
  },
105
191
  ],
106
192
  chatGptApiKey: String,
@@ -113,7 +199,11 @@ const workspaceSchema = new mongoose.Schema(
113
199
  queueTracking: { type: Boolean, default: false },
114
200
  orderConfiguration: { type: String, default: "" },
115
201
  defaultModule: { type: String, default: "dashboard" },
116
- defaultShift: { type: String, default: "" },
202
+ resolutionReasonCategories: {
203
+ type: [ResolutionReasonCategorySchema],
204
+ default: [],
205
+ },
206
+ feedbackDynamicFields: [feedbackFormSchema],
117
207
  dynamicFieldsTemplate: [
118
208
  {
119
209
  groupName: { type: String, required: true, trim: true },
@@ -166,16 +256,20 @@ const workspaceSchema = new mongoose.Schema(
166
256
  ],
167
257
  },
168
258
  ],
259
+ crmVisibility: {
260
+ type: String,
261
+ enum: ["everyone", "assignee"],
262
+ default: "everyone",
263
+ },
264
+ defaultShift: { type: String, default: "" },
169
265
  },
170
266
  { timestamps: true, toJSON: { virtuals: true }, toObject: { virtuals: true } }
171
267
  );
172
-
173
268
  const commonOptions = {
174
269
  type: String,
175
270
  trim: true,
176
271
  default: "",
177
272
  };
178
-
179
273
  workspaceSchema.add({
180
274
  contact: commonOptions,
181
275
  email: commonOptions,
@@ -187,5 +281,10 @@ workspaceSchema.add({
187
281
  chatGptApiKey: commonOptions,
188
282
  });
189
283
 
284
+ workspaceSchema.virtual("integrations", {
285
+ ref: "Integration",
286
+ localField: "_id",
287
+ foreignField: "workspaceId",
288
+ });
190
289
  const Workspace = mongoose.model("Workspace", workspaceSchema);
191
290
  module.exports = Workspace;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.2.51",
3
+ "version": "1.2.53",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {