Skip to content

Commit

Permalink
refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFrancis12 committed Jul 18, 2024
1 parent 15480e7 commit aeb0a65
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/data/Campaign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ const makeKey = makeRedisKeyFunc("campaign");
export async function getAllCampaigns(): Promise<TCampaign[]> {
const campaigns: Campaign[] = await db.campaign.findMany();
const proms: Promise<TCampaign>[] = campaigns.map(makeClientCampaign);
const result: TCampaign[] = [];
for (const prom of proms) {
const campaign = await prom;
result.push(campaign);
}
return result;
return Promise.all(proms);
}

export async function getCampaignById(id: number): Promise<TCampaign | null> {
Expand Down

0 comments on commit aeb0a65

Please sign in to comment.