feat: auto committed

This commit is contained in:
SpecialX
2026-07-10 18:57:57 +08:00
parent 5e0e20b1ce
commit 9fae2b0e78
74 changed files with 5362 additions and 304 deletions

View File

@@ -7,16 +7,16 @@ import {
Post,
Put,
} from "@nestjs/common";
import {
ChaptersService,
type CreateChapterInput,
type UpdateChapterInput,
} from "./chapters.service.js";
import { ChaptersService } from "./chapters.service.js";
import type { Chapter } from "./chapters.schema.js";
import {
Permissions,
RequirePermission,
} from "../middleware/permission.guard.js";
import {
createChapterSchema,
updateChapterSchema,
} from "./chapters.dto.js";
@Controller("chapters")
export class ChaptersController {
@@ -25,9 +25,10 @@ export class ChaptersController {
@Post()
@RequirePermission(Permissions.CONTENT_CHAPTER_CREATE)
async create(
@Body() body: CreateChapterInput,
@Body() body: unknown,
): Promise<{ success: true; data: { id: string } }> {
const result = await this.service.createChapter(body);
const input = createChapterSchema.parse(body);
const result = await this.service.createChapter(input);
return { success: true, data: result };
}
@@ -53,9 +54,10 @@ export class ChaptersController {
@RequirePermission(Permissions.CONTENT_CHAPTER_UPDATE)
async update(
@Param("id") id: string,
@Body() body: UpdateChapterInput,
@Body() body: unknown,
): Promise<{ success: true; data: { success: true } }> {
await this.service.updateChapter(id, body);
const input = updateChapterSchema.parse(body);
await this.service.updateChapter(id, input);
return { success: true, data: { success: true } };
}