mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
Merge remote-tracking branch 'entropy-xu/payment-billing-plans'
# Conflicts: # crates/aether-data/src/lifecycle/bootstrap/postgres.rs # crates/aether-data/src/lifecycle/migrate/tests.rs # frontend/src/views/admin/Users.vue
This commit is contained in:
@@ -16,6 +16,9 @@ import {
|
||||
type UserGroupMember,
|
||||
type UpsertUserGroupRequest,
|
||||
type ListUserGroupsResponse,
|
||||
type AdminUserPlanEntitlementsResponse,
|
||||
type GrantUserPlanRequest,
|
||||
type GrantUserPlanResponse,
|
||||
} from '@/api/users'
|
||||
import { parseApiError } from '@/utils/errorParser'
|
||||
|
||||
@@ -248,6 +251,29 @@ export const useUsersStore = defineStore('users', () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function listUserPlanEntitlements(
|
||||
userId: string,
|
||||
): Promise<AdminUserPlanEntitlementsResponse> {
|
||||
try {
|
||||
return await usersApi.listUserPlanEntitlements(userId)
|
||||
} catch (err: unknown) {
|
||||
error.value = parseApiError(err, '获取用户套餐失败')
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
async function grantUserPlan(
|
||||
userId: string,
|
||||
payload: GrantUserPlanRequest,
|
||||
): Promise<GrantUserPlanResponse> {
|
||||
try {
|
||||
return await usersApi.grantUserPlan(userId, payload)
|
||||
} catch (err: unknown) {
|
||||
error.value = parseApiError(err, '发放用户套餐失败')
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
async function revokeUserSession(userId: string, sessionId: string): Promise<{ message: string }> {
|
||||
try {
|
||||
return await usersApi.revokeUserSession(userId, sessionId)
|
||||
@@ -291,6 +317,8 @@ export const useUsersStore = defineStore('users', () => {
|
||||
deleteApiKey,
|
||||
getFullApiKey,
|
||||
getUserSessions,
|
||||
listUserPlanEntitlements,
|
||||
grantUserPlan,
|
||||
revokeUserSession,
|
||||
revokeAllUserSessions,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user