You've already forked agentic-coding-workflow
修改
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { request } from './client'
|
||||
|
||||
// AdminUser 对应后端 adminUserDTO:比登录用的 User 多 enabled 与时间戳。
|
||||
export interface AdminUser {
|
||||
id: string
|
||||
email: string
|
||||
display_name: string
|
||||
is_admin: boolean
|
||||
enabled: boolean
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface CreateUserBody {
|
||||
email: string
|
||||
display_name: string
|
||||
password: string
|
||||
is_admin: boolean
|
||||
}
|
||||
|
||||
export interface ResetPasswordResponse {
|
||||
temp_password: string
|
||||
}
|
||||
|
||||
const BASE = '/api/v1/admin/users'
|
||||
|
||||
export const userAdminApi = {
|
||||
list: () => request<AdminUser[]>(BASE),
|
||||
get: (id: string) => request<AdminUser>(`${BASE}/${id}`),
|
||||
create: (body: CreateUserBody) =>
|
||||
request<AdminUser>(BASE, { method: 'POST', body }),
|
||||
updateProfile: (id: string, displayName: string) =>
|
||||
request<AdminUser>(`${BASE}/${id}`, {
|
||||
method: 'PATCH',
|
||||
body: { display_name: displayName },
|
||||
}),
|
||||
setRole: (id: string, isAdmin: boolean) =>
|
||||
request<AdminUser>(`${BASE}/${id}/role`, {
|
||||
method: 'PATCH',
|
||||
body: { is_admin: isAdmin },
|
||||
}),
|
||||
setEnabled: (id: string, enabled: boolean) =>
|
||||
request<AdminUser>(`${BASE}/${id}/enabled`, {
|
||||
method: 'PATCH',
|
||||
body: { enabled },
|
||||
}),
|
||||
resetPassword: (id: string) =>
|
||||
request<ResetPasswordResponse>(`${BASE}/${id}/reset-password`, {
|
||||
method: 'POST',
|
||||
}),
|
||||
remove: (id: string) =>
|
||||
request<void>(`${BASE}/${id}`, { method: 'DELETE' }),
|
||||
}
|
||||
Reference in New Issue
Block a user