WebHooker/admin/types.ts
RhenCloud 62985a2f3f
feat(admin): groups management UI in the console
Add a super-admin-only Groups tab to create, edit and delete groups
(name, admin ids, owner scope). Routes now require a group via a select
in the editor, group names are shown on route cards, and the new
useMe/useGroups composables back the UI.
2026-08-02 08:16:05 +08:00

58 lines
1.1 KiB
TypeScript

export interface Filter {
type: "event" | "repo" | "actor" | "action" | "branch" | "keyword";
match: string | string[];
exclude?: boolean;
}
export interface Route {
id: string;
name: string;
enabled: boolean;
filters: Filter[];
target: {
channelId: string;
threadId?: string;
};
lang?: string;
groupId?: string;
}
export interface Group {
id: string;
name: string;
adminIds: string[];
owners?: string[];
}
export interface Me {
login: string;
userId: string;
isSuper: boolean;
groups: Group[];
}
export const FILTER_TYPES = ["event", "repo", "actor", "action", "branch", "keyword"] as const;
export const FILTER_LABELS: Record<string, string> = {
event: "Event",
repo: "Repo",
actor: "Actor",
action: "Action",
branch: "Branch",
keyword: "Keyword",
};
export function fmtMatch(match: string | string[]): string {
if (Array.isArray(match)) return match.join(", ");
return String(match ?? "");
}
export interface SendRecord {
ts: number;
routeId: string;
event: string;
repo?: string;
target: string;
ok: boolean;
error?: string;
}