feat: auto committed
This commit is contained in:
@@ -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 } };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user