diff --git a/oa/api/token/token.go b/oa/api/token/token.go index 7d59aa9..e242633 100644 --- a/oa/api/token/token.go +++ b/oa/api/token/token.go @@ -251,7 +251,7 @@ func tokenList(x *rest.X) (any, error) { query := cfg.DB() query = query.Where("user_id = ?", opts.UserID) query = query.Where("app_id = ?", opts.AppID) - err = query.Find(&data).Error + err = query.Limit(opts.Limit).Find(&data).Error return data, err } diff --git a/oa/main.go b/oa/main.go index 3ba1f09..bf413c2 100644 --- a/oa/main.go +++ b/oa/main.go @@ -41,8 +41,10 @@ func runWeb() error { builtin.Enable(app) app.Router().Any("/media/*", http.StripPrefix("/media", http.FileServer(http.Dir("/home/v/cache/"))).ServeHTTP) apiRouter := app.Router().SubRouter("api") + api.Use(apiRouter) apiRouter.Use(errs.JsonResponse) + apiRouter.SetErrFunc(errs.JsonErrorResponse) app.Router().EmbedDir("/", staticFs, "static/", "static/index.html") app.Router().Print() diff --git a/oa/models/access.gen.go b/oa/models/access.gen.go index 9ecb693..ce11b2f 100644 --- a/oa/models/access.gen.go +++ b/oa/models/access.gen.go @@ -5,11 +5,11 @@ import "time" type AccessList struct { CreatedAt *time.Time `json:"created_at" parse:"query"` UpdatedAt *time.Time `json:"updated_at" parse:"query"` - AppID string `json:"app_id" gorm:"index;type:varchar(32)" parse:"json"` - UserID *string `json:"user_id" gorm:"index;type:varchar(32);default: null" parse:"json"` - RoleID *string `json:"role_id" gorm:"index;type:varchar(32);default: null" parse:"json"` - Name *string `json:"name" parse:"json"` - ResourceID *string `json:"resource_id" gorm:"index;type:varchar(32);default: null" parse:"json"` + AppID string `json:"app_id" gorm:"index;type:varchar(32)" parse:"query"` + UserID *string `json:"user_id" gorm:"index;type:varchar(32);default: null" parse:"query"` + RoleID *string `json:"role_id" gorm:"index;type:varchar(32);default: null" parse:"query"` + ResourceID *string `json:"resource_id" gorm:"index;type:varchar(32);default: null" parse:"query"` + Name *string `json:"name" parse:"query"` } type AccessPost struct { diff --git a/oa/models/app.gen.go b/oa/models/app.gen.go index 2ba3bea..e0ba3f2 100644 --- a/oa/models/app.gen.go +++ b/oa/models/app.gen.go @@ -27,13 +27,13 @@ type AppPost struct { } type AppList struct { - Name *string `json:"name" parse:"json"` + Name *string `json:"name" parse:"query"` } type AppUserGet struct { ID string `json:"id" gorm:"primaryKey;type:varchar(32)" parse:"path@app_user_id"` - UserID string `json:"user_id" parse:"json"` AppID string `json:"app_id" parse:"path"` + UserID string `json:"user_id" parse:"query"` } type AppUserPatch struct { @@ -49,8 +49,8 @@ type AppUserDelete struct { type AppUserList struct { AppID *string `json:"app_id" parse:"path"` - UserID *string `json:"user_id" parse:"json"` - Status *string `json:"status" parse:"json"` + UserID *string `json:"user_id" parse:"query"` + Status *string `json:"status" parse:"query"` } type AppUserPost struct { diff --git a/oa/models/role.gen.go b/oa/models/role.gen.go index 0713154..6f42922 100644 --- a/oa/models/role.gen.go +++ b/oa/models/role.gen.go @@ -22,5 +22,5 @@ type RolePost struct { } type RoleList struct { - Name *string `json:"name" parse:"json"` + Name *string `json:"name" parse:"query"` } diff --git a/oa/models/token.gen.go b/oa/models/token.gen.go index 9e8e87d..94c4c87 100644 --- a/oa/models/token.gen.go +++ b/oa/models/token.gen.go @@ -38,6 +38,7 @@ type TokenDelete struct { } type TokenList struct { - UserID string `json:"user_id" gorm:"index;type:varchar(32)" parse:"json"` - AppID string `json:"app_id" gorm:"index;type:varchar(32)" parse:"json"` + Limit int `json:"limit"` + UserID string `json:"user_id" gorm:"index;type:varchar(32)" parse:"query"` + AppID string `json:"app_id" gorm:"index;type:varchar(32)" parse:"query"` } diff --git a/oa/models/user.gen.go b/oa/models/user.gen.go index a33cd82..b614369 100644 --- a/oa/models/user.gen.go +++ b/oa/models/user.gen.go @@ -31,11 +31,11 @@ type UserPost struct { } type UserList struct { - Username *string `json:"username" gorm:"varchar(100);unique;default:not null" parse:"json"` - Nickname *string `json:"nickname" parse:"json"` - Email *string `json:"email" gorm:"varchar(20);unique;default:null" parse:"json"` - Phone *string `json:"phone" gorm:"varchar(50);unique;default:null" parse:"json"` - Status *uint `json:"status" parse:"json"` + Username *string `json:"username" gorm:"type:varchar(100);unique;default:not null" parse:"query"` + Nickname *string `json:"nickname" gorm:"type:varchar(100)" parse:"query"` + Email *string `json:"email" gorm:"unique;type:varchar(50);default:null" parse:"query"` + Phone *string `json:"phone" gorm:"type:varchar(30);unique;default:null" parse:"query"` + Status *uint `json:"status" parse:"query"` } type UserRoleGet struct { @@ -64,6 +64,6 @@ type UserRolePost struct { } type UserRoleList struct { - Status *string `json:"status" parse:"json"` UserID string `json:"user_id" parse:"path"` + Status *string `json:"status" parse:"query"` } diff --git a/oaer/lib/api/access.ts b/oaer/lib/api/access.ts index 17dfd7e..ce90ddb 100644 --- a/oaer/lib/api/access.ts +++ b/oaer/lib/api/access.ts @@ -6,18 +6,17 @@ import webapi from "./webapi" import * as models from "./models" -export interface ListOpts { +export interface ListQuery { + created_at?: Date + updated_at?: Date app_id: string user_id?: string role_id?: string + resource_id?: string name?: string } -export interface ListQuery { - created_at?: Date - updated_at?: Date -} -export function List(json: ListOpts, query: ListQuery) { - return webapi.Get(`/access`, { json, query }) +export function List(query: ListQuery) { + return webapi.Get(`/access`, { query }) } export interface PostOpts { @@ -27,8 +26,21 @@ export interface PostOpts { name: string t_id: string level: number + resource_id?: string } export function Post(json: PostOpts) { return webapi.Post(`/access`, { json }) } +export function Get(access_id: string) { + return webapi.Get(`/access/${access_id}`, {}) +} + +export function Patch(access_id: string) { + return webapi.Patch(`/access/${access_id}`, {}) +} + +export function Delete(access_id: string) { + return webapi.Delete(`/access/${access_id}`, {}) +} + diff --git a/oaer/lib/api/app.ts b/oaer/lib/api/app.ts index 8488392..f56ddfd 100644 --- a/oaer/lib/api/app.ts +++ b/oaer/lib/api/app.ts @@ -14,8 +14,9 @@ export interface PatchOpts { name?: string icon?: string des?: string - participate?: string init_role_id?: string + typ?: string + status?: string } export function Patch(app_id: string, json: PatchOpts) { return webapi.Patch(`/app/${app_id}`, { json }) @@ -28,8 +29,9 @@ export function Delete(app_id: string) { export interface PostOpts { name: string icon: string - des: string - participate: string + des?: string + typ: string + status: string } export function Post(json: PostOpts) { return webapi.Post(`/app`, { json }) @@ -38,25 +40,25 @@ export function Post(json: PostOpts) { export interface ListOpts { name?: string } -export function List(json: ListOpts) { - return webapi.Get(`/app`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/app`, { query }) } export interface AppUserGetOpts { user_id: string } -export function AppUserGet(app_user_id: string, app_id: string, json: AppUserGetOpts) { - return webapi.Get(`/app/${app_id}/app_user/${app_user_id}`, { json }) +export function AppUserGet(app_id: string, app_user_id: string, query: AppUserGetQuery) { + return webapi.Get(`/app/${app_id}/app_user/${app_user_id}`, { query }) } export interface AppUserPatchOpts { status?: string } -export function AppUserPatch(app_user_id: string, app_id: string, json: AppUserPatchOpts) { +export function AppUserPatch(app_id: string, app_user_id: string, json: AppUserPatchOpts) { return webapi.Patch(`/app/${app_id}/app_user/${app_user_id}`, { json }) } -export function AppUserDelete(app_user_id: string, app_id: string) { +export function AppUserDelete(app_id: string, app_user_id: string) { return webapi.Delete(`/app/${app_id}/app_user/${app_user_id}`, {}) } @@ -64,8 +66,8 @@ export interface AppUserListOpts { user_id?: string status?: string } -export function AppUserList(app_id: string, json: AppUserListOpts) { - return webapi.Get(`/app/${app_id}/app_user`, { json }) +export function AppUserList(app_id: string, query: AppUserListQuery) { + return webapi.Get(`/app/${app_id}/app_user`, { query }) } export interface AppUserPostOpts { @@ -76,12 +78,8 @@ export function AppUserPost(app_id: string, json: AppUserPostOpts) { return webapi.Post(`/app/${app_id}/app_user`, { json }) } -export interface ResourceListQuery { - created_at?: Date - updated_at?: Date -} -export function ResourceList(app_id: string, query: ResourceListQuery) { - return webapi.Get(`/app/${app_id}/resource`, { query }) +export function ResourceList(app_id: string) { + return webapi.Get(`/app/${app_id}/resource`, {}) } export interface ResourcePostOpts { @@ -95,15 +93,28 @@ export function ResourcePost(app_id: string, json: ResourcePostOpts) { export interface ResourceDeleteOpts { name: string } -export function ResourceDelete(app_id: string, json: ResourceDeleteOpts) { - return webapi.Delete(`/app/${app_id}/resource`, { json }) +export function ResourceGet(app_id: string, resource_id: string) { + return webapi.Get(`/app/${app_id}/resource/${resource_id}`, {}) } -export function ResourceGet(app_id: string) { - return webapi.Get(`/app/${app_id}/resource`, {}) +export interface ResourcePatchOpts { + des?: string +} +export function ResourcePatch(app_id: string, resource_id: string, json: ResourcePatchOpts) { + return webapi.Patch(`/app/${app_id}/resource/${resource_id}`, { json }) } -export function ResourcePatch(app_id: string) { - return webapi.Patch(`/app/${app_id}/resource`, {}) +export function ResourceDelete(app_id: string, resource_id: string) { + return webapi.Delete(`/app/${app_id}/resource/${resource_id}`, {}) } +export interface ListQuery { + name?: string +} +export interface AppUserGetQuery { + user_id: string +} +export interface AppUserListQuery { + user_id?: string + status?: string +} diff --git a/oaer/lib/api/models.ts b/oaer/lib/api/models.ts index e5800cc..5a57ddc 100644 --- a/oaer/lib/api/models.ts +++ b/oaer/lib/api/models.ts @@ -1,12 +1,14 @@ export interface Access { created_at: Date updated_at: Date - app_id: string + id: string user_id?: string role_id?: string name: string tid: string level: number + resource_id?: string + app_id: string } export interface App { id: string @@ -23,6 +25,9 @@ export interface App { status: string user_status: string } + +export const AppTyp = ['public', 'apply', 'private'] + export interface AppUser { id: string created_at: Date @@ -36,9 +41,10 @@ export interface AppUser { export interface Resource { created_at: Date updated_at: Date - app_id: string + id: string name: string des: string + app_id: string } export interface Role { id: string diff --git a/oaer/lib/api/role.ts b/oaer/lib/api/role.ts index fe85386..5b6c5a1 100644 --- a/oaer/lib/api/role.ts +++ b/oaer/lib/api/role.ts @@ -6,6 +6,7 @@ import webapi from "./webapi" import * as models from "./models" + export function Get(role_id: string) { return webapi.Get(`/role/${role_id}`, {}) } @@ -32,10 +33,10 @@ export function Post(json: PostOpts) { return webapi.Post(`/role`, { json }) } -export interface ListOpts { +export interface ListQuery { name?: string } -export function List(json: ListOpts) { - return webapi.Get(`/role`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/role`, { query }) } diff --git a/oaer/lib/api/token.ts b/oaer/lib/api/token.ts index 8af1890..e8eef5b 100644 --- a/oaer/lib/api/token.ts +++ b/oaer/lib/api/token.ts @@ -12,7 +12,7 @@ export interface TokenSaltOpts { } // keep export function TokenSalt(json: TokenSaltOpts) { - return webapi.Post<{ id: string, salt: string }>(`/token/salt`, { json }) + return webapi.Get<{ id: string, salt: string }>(`/token/TokenSalt`, { json }) } export interface PostOpts { refresh?: string @@ -46,11 +46,11 @@ export function Delete(token_id: string) { return webapi.Delete(`/token/${token_id}`, {}) } -export interface ListOpts { +export interface ListQuery { user_id: string app_id: string } -export function List(json: ListOpts) { - return webapi.Get(`/token`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/token`, { query }) } diff --git a/oaer/lib/api/user.ts b/oaer/lib/api/user.ts index d598af7..deea44f 100644 --- a/oaer/lib/api/user.ts +++ b/oaer/lib/api/user.ts @@ -39,25 +39,25 @@ export function Post(json: PostOpts) { return webapi.Post(`/user`, { json }) } -export interface ListOpts { +export interface ListQuery { username?: string nickname?: string email?: string phone?: string status?: number } -export function List(json: ListOpts) { - return webapi.Get(`/user`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/user`, { query }) } -export function UserRoleGet(user_role_id: string, user_id: string) { +export function UserRoleGet(user_id: string, user_role_id: string) { return webapi.Get(`/user/${user_id}/user_role/${user_role_id}`, {}) } export interface UserRolePatchOpts { status?: string } -export function UserRolePatch(user_role_id: string, user_id: string, json: UserRolePatchOpts) { +export function UserRolePatch(user_id: string, user_role_id: string, json: UserRolePatchOpts) { return webapi.Patch(`/user/${user_id}/user_role/${user_role_id}`, { json }) } @@ -65,7 +65,7 @@ export interface UserRoleDeleteOpts { role_id: string app_id: string } -export function UserRoleDelete(user_role_id: string, user_id: string, json: UserRoleDeleteOpts) { +export function UserRoleDelete(user_id: string, user_role_id: string, json: UserRoleDeleteOpts) { return webapi.Delete(`/user/${user_id}/user_role/${user_role_id}`, { json }) } @@ -78,10 +78,10 @@ export function UserRolePost(user_id: string, json: UserRolePostOpts) { return webapi.Post(`/user/${user_id}/user_role`, { json }) } -export interface UserRoleListOpts { +export interface UserRoleListQuery { status?: string } -export function UserRoleList(user_id: string, json: UserRoleListOpts) { - return webapi.Get(`/user/${user_id}/user_role`, { json }) +export function UserRoleList(user_id: string, query: UserRoleListQuery) { + return webapi.Get(`/user/${user_id}/user_role`, { query }) } diff --git a/oaer/lib/logic.ts b/oaer/lib/logic.ts index edaf428..de2c268 100644 --- a/oaer/lib/logic.ts +++ b/oaer/lib/logic.ts @@ -10,7 +10,7 @@ import * as typs from './typs' import { proxy } from './v2dom' class Token { - iat?: string + iat?: number // oa_id iss?: string // token id @@ -63,7 +63,8 @@ class Token { if (!logic.token.refresh.isVaild() || this._typ === 'refresh') { reject() } - if (this.isVaild()) { + let now = Math.floor(Date.now() / 1000) + if (this.isVaild() && this.iat && now - this.iat < 10) { return resolve(this) } let aid = logic.oa_id diff --git a/oaer/lib/main.ts b/oaer/lib/main.ts index f5f2434..22cdc98 100644 --- a/oaer/lib/main.ts +++ b/oaer/lib/main.ts @@ -86,9 +86,6 @@ export default new class { app: { Get: api.app.Get, List: api.app.List, - }, - token: { - Post: api.token.Post } } } diff --git a/oaweb/composables/api/access.ts b/oaweb/composables/api/access.ts index 17dfd7e..ce90ddb 100644 --- a/oaweb/composables/api/access.ts +++ b/oaweb/composables/api/access.ts @@ -6,18 +6,17 @@ import webapi from "./webapi" import * as models from "./models" -export interface ListOpts { +export interface ListQuery { + created_at?: Date + updated_at?: Date app_id: string user_id?: string role_id?: string + resource_id?: string name?: string } -export interface ListQuery { - created_at?: Date - updated_at?: Date -} -export function List(json: ListOpts, query: ListQuery) { - return webapi.Get(`/access`, { json, query }) +export function List(query: ListQuery) { + return webapi.Get(`/access`, { query }) } export interface PostOpts { @@ -27,8 +26,21 @@ export interface PostOpts { name: string t_id: string level: number + resource_id?: string } export function Post(json: PostOpts) { return webapi.Post(`/access`, { json }) } +export function Get(access_id: string) { + return webapi.Get(`/access/${access_id}`, {}) +} + +export function Patch(access_id: string) { + return webapi.Patch(`/access/${access_id}`, {}) +} + +export function Delete(access_id: string) { + return webapi.Delete(`/access/${access_id}`, {}) +} + diff --git a/oaweb/composables/api/app.ts b/oaweb/composables/api/app.ts index 34de2b7..f56ddfd 100644 --- a/oaweb/composables/api/app.ts +++ b/oaweb/composables/api/app.ts @@ -40,25 +40,25 @@ export function Post(json: PostOpts) { export interface ListOpts { name?: string } -export function List(json: ListOpts) { - return webapi.Get(`/app`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/app`, { query }) } export interface AppUserGetOpts { user_id: string } -export function AppUserGet(app_user_id: string, app_id: string, json: AppUserGetOpts) { - return webapi.Get(`/app/${app_id}/app_user/${app_user_id}`, { json }) +export function AppUserGet(app_id: string, app_user_id: string, query: AppUserGetQuery) { + return webapi.Get(`/app/${app_id}/app_user/${app_user_id}`, { query }) } export interface AppUserPatchOpts { status?: string } -export function AppUserPatch(app_user_id: string, app_id: string, json: AppUserPatchOpts) { +export function AppUserPatch(app_id: string, app_user_id: string, json: AppUserPatchOpts) { return webapi.Patch(`/app/${app_id}/app_user/${app_user_id}`, { json }) } -export function AppUserDelete(app_user_id: string, app_id: string) { +export function AppUserDelete(app_id: string, app_user_id: string) { return webapi.Delete(`/app/${app_id}/app_user/${app_user_id}`, {}) } @@ -66,8 +66,8 @@ export interface AppUserListOpts { user_id?: string status?: string } -export function AppUserList(app_id: string, json: AppUserListOpts) { - return webapi.Get(`/app/${app_id}/app_user`, { json }) +export function AppUserList(app_id: string, query: AppUserListQuery) { + return webapi.Get(`/app/${app_id}/app_user`, { query }) } export interface AppUserPostOpts { @@ -78,12 +78,8 @@ export function AppUserPost(app_id: string, json: AppUserPostOpts) { return webapi.Post(`/app/${app_id}/app_user`, { json }) } -export interface ResourceListQuery { - created_at?: Date - updated_at?: Date -} -export function ResourceList(app_id: string, query: ResourceListQuery) { - return webapi.Get(`/app/${app_id}/resource`, { query }) +export function ResourceList(app_id: string) { + return webapi.Get(`/app/${app_id}/resource`, {}) } export interface ResourcePostOpts { @@ -97,15 +93,28 @@ export function ResourcePost(app_id: string, json: ResourcePostOpts) { export interface ResourceDeleteOpts { name: string } -export function ResourceDelete(app_id: string, json: ResourceDeleteOpts) { - return webapi.Delete(`/app/${app_id}/resource`, { json }) +export function ResourceGet(app_id: string, resource_id: string) { + return webapi.Get(`/app/${app_id}/resource/${resource_id}`, {}) } -export function ResourceGet(app_id: string) { - return webapi.Get(`/app/${app_id}/resource`, {}) +export interface ResourcePatchOpts { + des?: string +} +export function ResourcePatch(app_id: string, resource_id: string, json: ResourcePatchOpts) { + return webapi.Patch(`/app/${app_id}/resource/${resource_id}`, { json }) } -export function ResourcePatch(app_id: string) { - return webapi.Patch(`/app/${app_id}/resource`, {}) +export function ResourceDelete(app_id: string, resource_id: string) { + return webapi.Delete(`/app/${app_id}/resource/${resource_id}`, {}) } +export interface ListQuery { + name?: string +} +export interface AppUserGetQuery { + user_id: string +} +export interface AppUserListQuery { + user_id?: string + status?: string +} diff --git a/oaweb/composables/api/models.ts b/oaweb/composables/api/models.ts index 75fa564..5a57ddc 100644 --- a/oaweb/composables/api/models.ts +++ b/oaweb/composables/api/models.ts @@ -1,12 +1,14 @@ export interface Access { created_at: Date updated_at: Date - app_id: string + id: string user_id?: string role_id?: string name: string tid: string level: number + resource_id?: string + app_id: string } export interface App { id: string @@ -39,9 +41,10 @@ export interface AppUser { export interface Resource { created_at: Date updated_at: Date - app_id: string + id: string name: string des: string + app_id: string } export interface Role { id: string diff --git a/oaweb/composables/api/role.ts b/oaweb/composables/api/role.ts index fe85386..5b6c5a1 100644 --- a/oaweb/composables/api/role.ts +++ b/oaweb/composables/api/role.ts @@ -6,6 +6,7 @@ import webapi from "./webapi" import * as models from "./models" + export function Get(role_id: string) { return webapi.Get(`/role/${role_id}`, {}) } @@ -32,10 +33,10 @@ export function Post(json: PostOpts) { return webapi.Post(`/role`, { json }) } -export interface ListOpts { +export interface ListQuery { name?: string } -export function List(json: ListOpts) { - return webapi.Get(`/role`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/role`, { query }) } diff --git a/oaweb/composables/api/token.ts b/oaweb/composables/api/token.ts index 4c56b14..9b77c87 100644 --- a/oaweb/composables/api/token.ts +++ b/oaweb/composables/api/token.ts @@ -12,11 +12,11 @@ export interface TokenSaltOpts { } // keep export function TokenSalt(json: TokenSaltOpts) { - return webapi.Post<{ id: string, salt: string }>(`/token/salt`, { json }) + return webapi.Get<{ id: string, salt: string }>(`/token/TokenSalt`, { json }) } export interface PostOpts { refresh?: string - typ?: 'app' | 'ufs' + typ?: string user_id?: string salt?: string code?: string @@ -46,12 +46,11 @@ export function Delete(token_id: string) { return webapi.Delete(`/token/${token_id}`, {}) } -export interface ListOpts { +export interface ListQuery { user_id: string app_id: string - limit: number } -export function List(json: ListOpts) { - return webapi.Get(`/token`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/token`, { query }) } diff --git a/oaweb/composables/api/user.ts b/oaweb/composables/api/user.ts index d598af7..deea44f 100644 --- a/oaweb/composables/api/user.ts +++ b/oaweb/composables/api/user.ts @@ -39,25 +39,25 @@ export function Post(json: PostOpts) { return webapi.Post(`/user`, { json }) } -export interface ListOpts { +export interface ListQuery { username?: string nickname?: string email?: string phone?: string status?: number } -export function List(json: ListOpts) { - return webapi.Get(`/user`, { json }) +export function List(query: ListQuery) { + return webapi.Get(`/user`, { query }) } -export function UserRoleGet(user_role_id: string, user_id: string) { +export function UserRoleGet(user_id: string, user_role_id: string) { return webapi.Get(`/user/${user_id}/user_role/${user_role_id}`, {}) } export interface UserRolePatchOpts { status?: string } -export function UserRolePatch(user_role_id: string, user_id: string, json: UserRolePatchOpts) { +export function UserRolePatch(user_id: string, user_role_id: string, json: UserRolePatchOpts) { return webapi.Patch(`/user/${user_id}/user_role/${user_role_id}`, { json }) } @@ -65,7 +65,7 @@ export interface UserRoleDeleteOpts { role_id: string app_id: string } -export function UserRoleDelete(user_role_id: string, user_id: string, json: UserRoleDeleteOpts) { +export function UserRoleDelete(user_id: string, user_role_id: string, json: UserRoleDeleteOpts) { return webapi.Delete(`/user/${user_id}/user_role/${user_role_id}`, { json }) } @@ -78,10 +78,10 @@ export function UserRolePost(user_id: string, json: UserRolePostOpts) { return webapi.Post(`/user/${user_id}/user_role`, { json }) } -export interface UserRoleListOpts { +export interface UserRoleListQuery { status?: string } -export function UserRoleList(user_id: string, json: UserRoleListOpts) { - return webapi.Get(`/user/${user_id}/user_role`, { json }) +export function UserRoleList(user_id: string, query: UserRoleListQuery) { + return webapi.Get(`/user/${user_id}/user_role`, { query }) }