apps/bot/src/lib/tickets.ts (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import {
type User,
type Actor,
type TicketWithRelations,
type Guild,
} from "@stealth-developers/db";
export async function hasAccessToTicket(
user: Actor | User,
guild: Guild,
ticket: TicketWithRelations,
) {
if (user.discordId === ticket.subjectActor?.discordId) return true;
if ("moderator" in user) if (user.guildId === guild.id && user.moderator) return true;
return false;
}
|