add organization management and refine source repository view
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -43,6 +43,25 @@ export type UserSession = {
|
||||
expiresAt?: string | null;
|
||||
lastSeen?: string | null;
|
||||
state: string;
|
||||
primaryAffiliation?: {
|
||||
id: string;
|
||||
organizationId: string;
|
||||
organizationName: string;
|
||||
organizationType: string;
|
||||
department?: string | null;
|
||||
position?: string | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type OrganizationType = 'COMPANY' | 'SCHOOL' | 'GOVERNMENT' | 'LAB' | 'OTHER' | string;
|
||||
|
||||
export type Organization = {
|
||||
id: string;
|
||||
no?: number;
|
||||
name: string;
|
||||
type: OrganizationType;
|
||||
domain?: string | null;
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export type LauncherNotice = {
|
||||
@@ -121,7 +140,11 @@ export function deleteAdminSshKey(adminId: string, keyId: string) {
|
||||
|
||||
export async function loadUserSessions() {
|
||||
const response = await apiRequest<{ sessions?: UserSession[] }>('/users/sessions');
|
||||
return response.sessions ?? [];
|
||||
return (response.sessions ?? []).map((session) => ({
|
||||
...session,
|
||||
session: session.sessionId ? session.session : '-',
|
||||
state: session.state === '세션 없음' ? '없음' : session.state
|
||||
}));
|
||||
}
|
||||
|
||||
export function lockUser(userId: string) {
|
||||
@@ -142,6 +165,31 @@ export function terminateUserSession(sessionId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadOrganizations() {
|
||||
const response = await apiRequest<{ organizations?: Organization[] }>('/organizations');
|
||||
return response.organizations ?? [];
|
||||
}
|
||||
|
||||
export function createOrganization(payload: { name: string; type: OrganizationType; domain?: string | null }) {
|
||||
return apiRequest<{ organization: Organization }>('/organizations', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export function updateOrganization(organizationId: string, payload: { name?: string; type?: OrganizationType; domain?: string | null }) {
|
||||
return apiRequest<{ organization: Organization }>(`/organizations/${organizationId}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteOrganization(organizationId: string) {
|
||||
return apiRequest<{ ok: boolean }>(`/organizations/${organizationId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadLauncherNotices() {
|
||||
const response = await apiRequest<{ notices?: LauncherNotice[] }>('/notices');
|
||||
return response.notices ?? [];
|
||||
|
||||
Reference in New Issue
Block a user