import { eq } from "drizzle-orm"; import { db, moderators } from "@/database"; type Moderator = { id: string; /** they */ subjective: string; /** them */ objective: string; /** their */ possessiveDeterminer: string; /** theirs */ possessive: string; /** themself */ reflexive: string; }; const defaultModerator: Omit = { subjective: "they", objective: "them", possessiveDeterminer: "their", possessive: "theirs", reflexive: "themself", }; export function getModerator(id: string): Moderator { const moderator = db .select() .from(moderators) .where(eq(moderators.user_id, id)) .get(); if (!moderator) return { id, ...defaultModerator }; return { id: id, ...moderator }; } export function capitalise(str: string): string { return str.charAt(0).toUpperCase() + str.slice(1); }