Files
drb-frontend/src/types/index.ts
2025-05-25 23:20:48 -04:00

65 lines
1.2 KiB
TypeScript

export enum DemodTypes {
P25 = "P25",
DMR = "DMR",
NBFM = "NBFM"
}
export interface TalkgroupTag {
talkgroup: string;
tagDec: number;
}
export interface DiscordId {
_id: string;
discord_id: string;
name: string;
token: string;
active: boolean;
guild_ids: string[];
}
export interface System {
_id: string;
type: DemodTypes;
name: string;
frequencies: number[];
location: string;
avail_on_nodes: string[];
description?: string;
tags?: TalkgroupTag[];
whitelist?: number[];
}
export enum UserRoles {
ADMIN = "admin",
MOD = "mod",
USER = "user"
}
export interface UserDetails {
id: string;
username: string;
role: UserRoles;
}
export interface ErrorResponse {
message?: string;
detail?: string | any;
}
export interface NodeStatusResponse {
status: {
op25_status: string;
discord_status: string;
}
}
// Auth Context Types
export interface AuthContextType {
token: string | null;
user: UserDetails | null;
loading: boolean;
login: (username: string, password: string) => Promise<boolean>;
logout: () => void;
hasPermission: (requiredRole: UserRoles) => boolean;
}