|
|
|
//
|
|
|
|
// Copyright (C) 2024 veypi <i@veypi.com>
|
|
|
|
// 2024-10-11 14:36:07
|
|
|
|
// Distributed under terms of the MIT license.
|
|
|
|
//
|
|
|
|
|
|
|
|
import webapi from "./webapi"
|
|
|
|
import * as models from "./models"
|
|
|
|
export interface ListQuery {
|
|
|
|
created_at?: Date
|
|
|
|
updated_at?: Date
|
|
|
|
app_id: string
|
|
|
|
user_id?: string
|
|
|
|
role_id?: string
|
|
|
|
resource_id?: string
|
|
|
|
name?: string
|
|
|
|
}
|
|
|
|
export function List(query: ListQuery) {
|
|
|
|
return webapi.Get<models.Access[]>(`/access`, { query })
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PostOpts {
|
|
|
|
app_id: string
|
|
|
|
user_id?: string
|
|
|
|
role_id?: string
|
|
|
|
name: string
|
|
|
|
t_id: string
|
|
|
|
level: number
|
|
|
|
resource_id?: string
|
|
|
|
}
|
|
|
|
export function Post(json: PostOpts) {
|
|
|
|
return webapi.Post<models.Access>(`/access`, { json })
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Get(access_id: string) {
|
|
|
|
return webapi.Get<models.Access>(`/access/${access_id}`, {})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Patch(access_id: string) {
|
|
|
|
return webapi.Patch<models.Access>(`/access/${access_id}`, {})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Delete(access_id: string) {
|
|
|
|
return webapi.Delete<models.Access>(`/access/${access_id}`, {})
|
|
|
|
}
|
|
|
|
|