Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFrancis12 committed Jul 17, 2024
1 parent ec41c9b commit e60d060
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/data/Campaign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -111,11 +111,9 @@ export async function deleteCampaignById(id: number): Promise<TCampaign> {

async function makeClientCampaign(dbModel: Campaign): Promise<TCampaign> {
const { flowMainRoute, flowRuleRoutes } = dbModel;
const mainRouteProm = flowMainRoute ? parseRoute(flowMainRoute) : promFrom(newRoute())();
const ruleRoutesProm = flowRuleRoutes ? parseRoutes(flowRuleRoutes) : promFrom(<TRoute[]>[])();
return {
...dbModel,
flowMainRoute: await mainRouteProm,
flowRuleRoutes: await ruleRoutesProm,
flowMainRoute: flowMainRoute ? await parseRoute(flowMainRoute) : newRoute(),
flowRuleRoutes: flowRuleRoutes ? await parseRoutes(flowRuleRoutes) : [],
};
}

0 comments on commit e60d060

Please sign in to comment.