fix (#199)
This commit is contained in:
@@ -205,6 +205,7 @@ export async function parseSesHook(data: SesEvent) {
|
|||||||
updateField === "delivered"
|
updateField === "delivered"
|
||||||
) {
|
) {
|
||||||
logger.info("Updating cumulated metrics");
|
logger.info("Updating cumulated metrics");
|
||||||
|
const cumulatedField = isHardBounced ? "hardBounced" : updateField;
|
||||||
await db.cumulatedMetrics.upsert({
|
await db.cumulatedMetrics.upsert({
|
||||||
where: {
|
where: {
|
||||||
teamId_domainId: {
|
teamId_domainId: {
|
||||||
@@ -213,14 +214,14 @@ export async function parseSesHook(data: SesEvent) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
[updateField]: {
|
[cumulatedField]: {
|
||||||
increment: BigInt(1),
|
increment: BigInt(1),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
teamId: email.teamId,
|
teamId: email.teamId,
|
||||||
domainId: email.domainId ?? 0,
|
domainId: email.domainId ?? 0,
|
||||||
[updateField]: BigInt(1),
|
[cumulatedField]: BigInt(1),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user