feat(private-zone): add paid video moments
Docker Image / Build and Push Docker Image (push) Successful in 2m5s

This commit is contained in:
Codex
2026-07-24 20:17:28 +08:00
parent 30ab2c2c97
commit 0d5b5c17fa
25 changed files with 1578 additions and 43 deletions
@@ -9,4 +9,5 @@ export * from "./ifeedback_repository";
export * from "./imetrics_repository";
export * from "./ipayment_repository";
export * from "./iprivate_zone_repository";
export * from "./iprivate_zone_post_repository";
export * from "./iuser_repository";
@@ -0,0 +1,21 @@
import type {
PrivateZonePostsResponse,
PrivateZonePostUnlockResponse,
} from "@/data/schemas/private-zone";
import type { Result } from "@/utils/result";
export interface GetPrivateZonePostsInput {
characterId: string;
limit?: number;
cursor?: string | null;
}
export interface IPrivateZonePostRepository {
getPosts(
input: GetPrivateZonePostsInput,
): Promise<Result<PrivateZonePostsResponse>>;
unlockPost(
postId: string,
expectedCost: number,
): Promise<Result<PrivateZonePostUnlockResponse>>;
}
@@ -0,0 +1,43 @@
import type {
GetPrivateZonePostsInput,
IPrivateZonePostRepository,
} from "@/data/repositories/interfaces";
import {
UnlockPrivateZonePostRequestSchema,
type PrivateZonePostsResponse,
type PrivateZonePostUnlockResponse,
} from "@/data/schemas/private-zone";
import {
PrivateZonePostApi,
privateZonePostApi,
} from "@/data/services/api/private_zone_post_api";
import { Result } from "@/utils/result";
import { createLazySingleton } from "./lazy_singleton";
export class PrivateZonePostRepository implements IPrivateZonePostRepository {
constructor(private readonly api: PrivateZonePostApi) {}
getPosts(
input: GetPrivateZonePostsInput,
): Promise<Result<PrivateZonePostsResponse>> {
return Result.wrap(() => this.api.getPosts(input));
}
unlockPost(
postId: string,
expectedCost: number,
): Promise<Result<PrivateZonePostUnlockResponse>> {
return Result.wrap(() =>
this.api.unlockPost(
postId,
UnlockPrivateZonePostRequestSchema.parse({ expectedCost }),
),
);
}
}
export const getPrivateZonePostRepository =
createLazySingleton<IPrivateZonePostRepository>(
() => new PrivateZonePostRepository(privateZonePostApi),
);