From 5323009fd8562ab8f3997aeb829863fd5b3655ec Mon Sep 17 00:00:00 2001 From: Corban-Lee Date: Tue, 29 Apr 2025 12:27:47 +0100 Subject: [PATCH] feat: util for verifying feed channels --- src/client/typescript/main.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/typescript/main.ts b/src/client/typescript/main.ts index 65edec4..33ed312 100644 --- a/src/client/typescript/main.ts +++ b/src/client/typescript/main.ts @@ -1,3 +1,6 @@ +import { Channel } from "discord.js"; +import prisma from "../../../generated/prisma"; + // Preline: necessary for header events. window.addEventListener("load", () => { const inputs = document.querySelectorAll('.dt-container thead input'); @@ -33,4 +36,10 @@ export const formatTimestamp = (timestamp: string | number) => { return now.getFullYear() === date.getFullYear() ? result + `, ${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}` : result + ` ${date.getFullYear()}`; -} \ No newline at end of file +} + +export const verifyChannels = (data: prisma.Channel[], channels: Channel[]) => { + return data.some(item => { + return channels.map(channel => channel.id).includes(item.channel_id); + }); +}; \ No newline at end of file