Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikmokki committed Sep 10, 2024
1 parent 1c37753 commit 0dfe168
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions apps/cms/src/controllers/newsletter-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Response } from "express";
import type { PayloadRequest } from "payload/types";
import { render } from "@react-email/components";
import { type Node } from "@tietokilta/cms-types/lexical";
import { type WeeklyNewsletter } from "@tietokilta/cms-types/payload";
import { signedIn } from "../access/signed-in";
import { sendEmail } from "../mailgun";
import { NewsletterEmail } from "../emails/newsletter-email";
Expand Down Expand Up @@ -60,20 +61,20 @@ export const getEmailController = async (
const { newsletterId } = req.params;

// Fetch the English version of the newsletter
const englishNewsletter = await req.payload.findByID({
const englishNewsletter = (await req.payload.findByID({
collection: "weekly-newsletters",
id: newsletterId,
depth: 2,
locale: "en",
});
})) as unknown as WeeklyNewsletter;

// Fetch the Finnish version of the newsletter
const finnishNewsletter = await req.payload.findByID({
const finnishNewsletter = (await req.payload.findByID({
collection: "weekly-newsletters",
id: newsletterId,
depth: 2,
locale: "fi",
});
})) as unknown as WeeklyNewsletter;

const { PUBLIC_LEGACY_URL, PUBLIC_FRONTEND_URL } = process.env;

Expand Down Expand Up @@ -111,12 +112,12 @@ export const getTelegramMessageController = async (
const { newsletterId } = req.params;
const { locale } = req.query;

const newsletter = await req.payload.findByID({
const newsletter = (await req.payload.findByID({
collection: "weekly-newsletters",
id: newsletterId,
depth: 2,
locale: locale as string,
});
})) as unknown as WeeklyNewsletter;
let message = "";
message += `**${newsletter.title}**\n\n`;
message += parseToTelegramString(
Expand Down

0 comments on commit 0dfe168

Please sign in to comment.