feat(user): sync entitlement snapshot

This commit is contained in:
2026-06-29 10:37:37 +08:00
parent 455204e1e4
commit 58cd2a7545
22 changed files with 479 additions and 54 deletions
@@ -15,6 +15,7 @@ import type {
CreditsHistoryData,
UpdateProfileRequest,
User,
UserEntitlements,
UserStatsResponse,
} from "@/data/dto/user";
@@ -36,4 +37,7 @@ export interface IUserRepository {
limit?: number,
offset?: number,
): Promise<Result<CreditsHistoryData>>;
/** 获取当前用户权益快照。 */
getEntitlements(): Promise<Result<UserEntitlements>>;
}
+6
View File
@@ -14,6 +14,7 @@ import {
CreditsHistoryData,
UpdateProfileRequest,
User,
UserEntitlements,
UserStatsResponse,
} from "@/data/dto/user";
import { Result } from "@/utils";
@@ -49,6 +50,11 @@ export class UserRepository implements IUserRepository {
): Promise<Result<CreditsHistoryData>> {
return Result.wrap(() => this.api.getCreditsHistory(limit, offset));
}
/** 获取当前用户权益快照。 */
async getEntitlements(): Promise<Result<UserEntitlements>> {
return Result.wrap(() => this.api.getEntitlements());
}
}
/** 全局单例。 */