@avakado.ai/schemas 1.1.29 → 1.1.30

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakado.ai/schemas",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "description": "Canonical Mongo schemas, models, enums and index declarations shared by the Avakado services.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -6,6 +6,7 @@
6
6
  export const LEAD_STATUS = ["new", "contacted", "qualified", "converted", "lost", "spam"];
7
7
  export const CONVERSATION_STATUS = ["open", "pending", "snoozed", "completed", "closed", "archived", "spam"];
8
8
  export const CAMPAIGN_STATUS = ["pending", "active", "completed", "failed", "partial"];
9
+ export const TASK_STAGES = ["Scheduled", "Execution", "Provider", "Engagement"];
9
10
  export const TASK_STATUS = ["pending", "in-progress", "completed", "failed", "skipped"];
10
11
 
11
12
  // Webhook events the channel adapters publish. Names are `{channel}_{event}`.
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "mongoose";
2
2
  import { defineModel } from "../runtime.js";
3
- import { CAMPAIGN_STATUS, TASK_REFERENCE_TYPES, TASK_STATUS, TASK_TYPES } from "../enums/index.js";
3
+ import { CAMPAIGN_STATUS, TASK_REFERENCE_TYPES, TASK_STAGES, TASK_STATUS, TASK_TYPES } from "../enums/index.js";
4
4
  import { attachStatusChangeTrigger } from "../statusTrigger.js";
5
5
 
6
6
  const TaskSchema = new Schema({
@@ -8,6 +8,7 @@ const TaskSchema = new Schema({
8
8
  campaign: { type: Schema.Types.ObjectId, ref: 'Campaign' },
9
9
  lead: { type: Schema.Types.ObjectId, ref: "Lead" },
10
10
  status: { type: String, enum: TASK_STATUS, default: "pending" },
11
+ stage: { type: String, enum: TASK_STAGES, default: "Scheduled" },
11
12
  timeLine: {
12
13
  startedAt: Date,// start of task
13
14
  failedAt: Date,// failed of task
@@ -27,6 +28,10 @@ TaskSchema.methods.updateTimeLine = async function (timeLine, currentStatus) {
27
28
  return this.save();
28
29
  };
29
30
 
31
+ TaskSchema.methods.updateStage = async function (stage) {
32
+ this.stage = stage;
33
+ return this.save();
34
+ };
30
35
  TaskSchema.methods.updateError = async function (error) {
31
36
  this.error = error;
32
37
  return this.save();