Files
archie/ui/src/org/org.ts
T

54 lines
1.3 KiB
TypeScript

/** An org the caller belongs to, with their own org-wide role. `version` is the
* revision a rename is guarded by. */
export interface Org {
id: string;
name: string;
version: number;
role?: Role;
}
/** A workspace as the org's caller sees it. `version` guards a rename. */
export interface OrgWorkspace {
id: string;
org_id: string;
name: string;
environment?: string;
version: number;
}
/** One appended name change: the organisation itself, or one of its workspaces. */
export interface OrgEvent {
id: number;
kind: "org" | "workspace";
workspace_id?: string;
actor_id: string;
actor_name: string;
old_name: string;
new_name: string;
at: string;
}
export type Role = "owner" | "admin" | "developer" | "viewer";
/** The roles the domain accepts, in descending authority. */
export const ROLES: Role[] = ["owner", "admin", "developer", "viewer"];
/** How a role reads wherever the dashboard offers one. */
export const ROLE_LABELS: Record<Role, string> = {
owner: "Owner",
admin: "Admin",
developer: "Developer",
viewer: "Viewer",
};
export interface Member {
identity_id: string;
kind: string;
display_name: string;
workspace_id?: string;
role: Role;
/** The identity's lifecycle; a suspended member keeps the role but cannot act. */
status: "active" | "suspended" | "retired";
last_sign_in?: string;
}