From e60d0603c64f04e920addaf041dacffd7f74367a Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 17 Jul 2024 11:08:22 -0500 Subject: [PATCH] bugfixing --- src/data/Campaign.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/data/Campaign.ts b/src/data/Campaign.ts index b72e977..c86893f 100644 --- a/src/data/Campaign.ts +++ b/src/data/Campaign.ts @@ -5,9 +5,9 @@ import cache, { makeRedisKeyFunc } from "../lib/cache"; import db from "../lib/db"; import { parseRoute, parseRoutes } from "."; import { campaignSchema } from "../lib/schemas"; -import { promFrom, safeParseJson } from "../lib/utils"; +import { safeParseJson } from "../lib/utils"; import { REDIS_EXPIRY } from "../lib/constants"; -import { TCampaign, TCampaign_createRequest, TCampaign_updateRequest, TRoute } from "../lib/types"; +import { TCampaign, TCampaign_createRequest, TCampaign_updateRequest } from "../lib/types"; const makeKey = makeRedisKeyFunc("campaign"); @@ -111,11 +111,9 @@ export async function deleteCampaignById(id: number): Promise { async function makeClientCampaign(dbModel: Campaign): Promise { const { flowMainRoute, flowRuleRoutes } = dbModel; - const mainRouteProm = flowMainRoute ? parseRoute(flowMainRoute) : promFrom(newRoute())(); - const ruleRoutesProm = flowRuleRoutes ? parseRoutes(flowRuleRoutes) : promFrom([])(); return { ...dbModel, - flowMainRoute: await mainRouteProm, - flowRuleRoutes: await ruleRoutesProm, + flowMainRoute: flowMainRoute ? await parseRoute(flowMainRoute) : newRoute(), + flowRuleRoutes: flowRuleRoutes ? await parseRoutes(flowRuleRoutes) : [], }; }