refactor(web): rename Organisation to Instance
This commit is contained in:
+21
-21
@@ -301,14 +301,14 @@ export type Role = "owner" | "admin" | "member";
|
||||
/** The session as returned by GET /auth/me mirrors auth.Session on the server. */
|
||||
export interface SessionUser {
|
||||
user_id: string;
|
||||
org_id: string;
|
||||
instance_id: string;
|
||||
role: Role;
|
||||
email: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Org {
|
||||
org_id: string;
|
||||
export interface Instance {
|
||||
instance_id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
created_at: string;
|
||||
@@ -316,22 +316,22 @@ export interface Org {
|
||||
|
||||
export interface MeResponse {
|
||||
user: SessionUser;
|
||||
org: Org | null;
|
||||
instance: Instance | null;
|
||||
}
|
||||
|
||||
export interface BootstrapStatus {
|
||||
needs_setup: boolean;
|
||||
org_name?: string;
|
||||
instance_name?: string;
|
||||
}
|
||||
|
||||
export interface BootstrapResponse {
|
||||
org: Org;
|
||||
instance: Instance;
|
||||
slug: string;
|
||||
}
|
||||
|
||||
export interface OrgUser {
|
||||
export interface InstanceUser {
|
||||
user_id: string;
|
||||
org_id: string;
|
||||
instance_id: string;
|
||||
email: string;
|
||||
role: Role;
|
||||
auth_source: "local" | "oidc";
|
||||
@@ -426,7 +426,7 @@ export const auth = {
|
||||
return authRequest<BootstrapStatus>("/auth/bootstrap-status");
|
||||
},
|
||||
|
||||
bootstrap(input: { org_name: string; email: string; password: string }): Promise<BootstrapResponse> {
|
||||
bootstrap(input: { instance_name: string; email: string; password: string }): Promise<BootstrapResponse> {
|
||||
return authRequest<BootstrapResponse>("/auth/bootstrap", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(input),
|
||||
@@ -456,31 +456,31 @@ export const auth = {
|
||||
};
|
||||
|
||||
export const api = {
|
||||
listOrgUsers(): Promise<OrgUser[]> {
|
||||
return request<OrgUser[]>("/org/users");
|
||||
listInstanceUsers(): Promise<InstanceUser[]> {
|
||||
return request<InstanceUser[]>("/instance/users");
|
||||
},
|
||||
|
||||
createOrgUser(input: OrgUserInput): Promise<OrgUser> {
|
||||
return request<OrgUser>("/org/users", { method: "POST", body: JSON.stringify(input) });
|
||||
createInstanceUser(input: OrgUserInput): Promise<InstanceUser> {
|
||||
return request<InstanceUser>("/instance/users", { method: "POST", body: JSON.stringify(input) });
|
||||
},
|
||||
|
||||
updateOrgUserRole(userId: string, role: Role): Promise<{ ok: boolean }> {
|
||||
return request<{ ok: boolean }>(`/org/users/${userId}/role`, {
|
||||
updateInstanceUserRole(userId: string, role: Role): Promise<{ ok: boolean }> {
|
||||
return request<{ ok: boolean }>(`/instance/users/${userId}/role`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ role }),
|
||||
});
|
||||
},
|
||||
|
||||
deleteOrgUser(userId: string): Promise<void> {
|
||||
return request<void>(`/org/users/${userId}`, { method: "DELETE" });
|
||||
deleteInstanceUser(userId: string): Promise<void> {
|
||||
return request<void>(`/instance/users/${userId}`, { method: "DELETE" });
|
||||
},
|
||||
|
||||
getOrgOIDC(): Promise<OrgOIDCConfig> {
|
||||
return request<OrgOIDCConfig>("/org/oidc");
|
||||
getInstanceOIDC(): Promise<OrgOIDCConfig> {
|
||||
return request<OrgOIDCConfig>("/instance/oidc");
|
||||
},
|
||||
|
||||
saveOrgOIDC(input: OrgOIDCInput): Promise<{ saved: boolean }> {
|
||||
return request<{ saved: boolean }>("/org/oidc", { method: "PUT", body: JSON.stringify(input) });
|
||||
saveInstanceOIDC(input: OrgOIDCInput): Promise<{ saved: boolean }> {
|
||||
return request<{ saved: boolean }>("/instance/oidc", { method: "PUT", body: JSON.stringify(input) });
|
||||
},
|
||||
|
||||
listServers(): Promise<Server[]> {
|
||||
|
||||
Reference in New Issue
Block a user