Build and type fixes

This commit is contained in:
Darren Clarke 2023-05-24 20:27:57 +00:00
parent d5bd58ac3e
commit 656f3fbe71
64 changed files with 1878 additions and 1501 deletions

View file

@ -25,13 +25,14 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { id } = ticket;
try {
const country = ticket.country[0] ?? "none";
// @ts-expect-error
const translatedCountry = taxonomy.country[country]?.display ?? "none";
const countryDetails = unRegions.find((c) => c.name === translatedCountry);
const countryDetails: any = unRegions.find((c) => c.name === translatedCountry);
const augmentedTicket = {
...ticket,
region: countryDetails['sub-region']?.toLowerCase().replace(" ", "-") ?? null,
continent: countryDetails.region?.toLowerCase().replace(" ", "-") ?? null,
}
};
const out = await client.create({
id: uuid(),
index: "sample_tagged_tickets",
@ -41,13 +42,13 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
console.log(out);
succeeded.push(id);
} catch (e) {
console.log(e)
console.log(e);
failed.push(id);
}
}
const results = { succeeded, failed };
return res.json(results)
return res.json(results);
};
export default handler;