@merkl/api 0.16.9 → 0.16.11

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.
@@ -59,14 +59,21 @@ export declare class StatusRepository {
59
59
  computedUntil: bigint;
60
60
  processingStarted: bigint;
61
61
  }>;
62
- static updateProcessing(campaignUnique: CampaignUnique): Promise<{
62
+ static updateProcessing(campaignUnique: CampaignUnique): Promise<[{
63
63
  error: string;
64
64
  details: Prisma.JsonValue;
65
65
  status: import("../../../../database/api/.generated").$Enums.RunStatus;
66
66
  campaignId: string;
67
67
  computedUntil: bigint;
68
68
  processingStarted: bigint;
69
- }>;
69
+ }, {
70
+ error: string;
71
+ details: Prisma.JsonValue;
72
+ status: import("../../../../database/api/.generated").$Enums.RunStatus;
73
+ campaignId: string;
74
+ computedUntil: bigint;
75
+ processingStarted: bigint;
76
+ }]>;
70
77
  static findManyDelay(query: DelayModel): Promise<{
71
78
  startTimestamp: bigint;
72
79
  endTimestamp: bigint;
@@ -80,6 +87,7 @@ export declare class StatusRepository {
80
87
  };
81
88
  Opportunity: {
82
89
  name: string;
90
+ type: string;
83
91
  id: string;
84
92
  };
85
93
  CampaignStatus: {
@@ -71,17 +71,28 @@ export class StatusRepository {
71
71
  });
72
72
  }
73
73
  static async updateProcessing(campaignUnique) {
74
- return await apiDbClient.campaignStatus.update({
75
- where: {
76
- campaignId: CampaignService.hashId(campaignUnique),
77
- },
78
- data: {
79
- status: "PROCESSING",
80
- processingStarted: moment().unix(),
81
- error: "",
82
- details: "{}",
83
- },
84
- });
74
+ const campaignId = CampaignService.hashId(campaignUnique);
75
+ return await apiDbClient.$transaction([
76
+ apiDbClient.campaignStatus.findUniqueOrThrow({
77
+ where: {
78
+ campaignId,
79
+ status: {
80
+ not: "PROCESSING",
81
+ },
82
+ },
83
+ }),
84
+ apiDbClient.campaignStatus.update({
85
+ where: {
86
+ campaignId,
87
+ },
88
+ data: {
89
+ status: "PROCESSING",
90
+ processingStarted: moment().unix(),
91
+ error: "",
92
+ details: "{}",
93
+ },
94
+ }),
95
+ ]);
85
96
  }
86
97
  static async findManyDelay(query) {
87
98
  return await apiDbClient.campaign.findMany({
@@ -108,6 +119,7 @@ export class StatusRepository {
108
119
  select: {
109
120
  name: true,
110
121
  id: true,
122
+ type: true,
111
123
  },
112
124
  },
113
125
  CampaignStatus: {
@@ -63,6 +63,7 @@ export declare class StatusService {
63
63
  };
64
64
  Opportunity: {
65
65
  name: string;
66
+ type: string;
66
67
  id: string;
67
68
  };
68
69
  CampaignStatus: {