From f6bababc23cd2fd8bd3f4b4af15c2e1a90dac0df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=80=EB=8A=90=ED=98=84=EC=8A=A4?= Date: Tue, 5 Mar 2024 01:26:24 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20Book=20->=20isPDFEnabled=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/endpoint/book/endpoint.ts | 2 ++ src/object/adminBook.object.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/endpoint/book/endpoint.ts b/src/endpoint/book/endpoint.ts index 2d23f42..802b4a9 100644 --- a/src/endpoint/book/endpoint.ts +++ b/src/endpoint/book/endpoint.ts @@ -136,6 +136,7 @@ export const UpdateBook: Endpoint = { "coverImage", "notionDatabaseId", "status", + "isPDFEnabled", ], }; export type UpdateBookReqPath = { @@ -149,6 +150,7 @@ export type UpdateBookReqBody = { coverImage?: string; notionDatabaseId?: string; status?: "draft" | "pending" | "published" | "deleted"; + isPDFEnabled?: boolean; }; export type UpdateBookReq = UpdateBookReqPath & UpdateBookReqBody; export type UpdateBookRes = { diff --git a/src/object/adminBook.object.ts b/src/object/adminBook.object.ts index 4f96940..ef6455b 100644 --- a/src/object/adminBook.object.ts +++ b/src/object/adminBook.object.ts @@ -14,6 +14,7 @@ export class AdminBookObject { role: string; user: UserObject; }[]; + isPDFEnabled: boolean; createdAt: string; updatedAt: string; @@ -26,6 +27,7 @@ export class AdminBookObject { coverImage: string; notionDatabaseId: string; status: "draft" | "pending" | "published" | "deleted"; + isPDFEnabled: boolean; authorUsers: { id: number; role: string; @@ -41,6 +43,7 @@ export class AdminBookObject { this.price = data.price; this.coverImage = data.coverImage; this.notionDatabaseId = data.notionDatabaseId; + this.isPDFEnabled = data.isPDFEnabled; this.status = data.status; this.authorUsers = data.authorUsers; this.createdAt = data.createdAt; From 68dbcb7a51d31547e861845973fb1647055322d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=80=EB=8A=90=ED=98=84=EC=8A=A4?= Date: Tue, 5 Mar 2024 01:30:17 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20ExportSectionPDF=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client.ts | 3 +++ src/endpoint/book/section/export/endpoint.ts | 22 ++++++++++++++++++++ src/endpoint/book/section/export/index.ts | 1 + src/endpoint/book/section/index.ts | 1 + src/object/adminBook.object.ts | 6 +++--- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/endpoint/book/section/export/endpoint.ts create mode 100644 src/endpoint/book/section/export/index.ts diff --git a/src/client.ts b/src/client.ts index c1f0019..5659c51 100644 --- a/src/client.ts +++ b/src/client.ts @@ -21,6 +21,7 @@ import { DeleteSection, DeleteUserDevice, EditBlockComment, + ExportSectionPDF, FetchSection, GetAdminBook, GetBook, @@ -109,6 +110,8 @@ export class ProjectBookClient extends EndpointClient { readonly UpdateSection = this.endpointBuilder(UpdateSection); readonly DeleteSection = this.endpointBuilder(DeleteSection); + readonly ExportSectionPDF = this.endpointBuilder(ExportSectionPDF); + readonly ListBlockComment = this.endpointBuilder(ListBlockComment); readonly CreateBlockComment = this.endpointBuilder(CreateBlockComment); readonly EditBlockComment = this.endpointBuilder(EditBlockComment); diff --git a/src/endpoint/book/section/export/endpoint.ts b/src/endpoint/book/section/export/endpoint.ts new file mode 100644 index 0000000..a24354c --- /dev/null +++ b/src/endpoint/book/section/export/endpoint.ts @@ -0,0 +1,22 @@ +import { Endpoint } from "endpoint-client"; + +/** + * POST /books/:bookId/sections/:sectionId/export/pdf + * 색션 PDF를 생성합니다. + */ +export const ExportSectionPDF: Endpoint< + ExportSectionPDFReq, + ExportSectionPDFRes +> = { + method: "POST", + path: (e) => `/books/${e.bookId}/sections/${e.sectionId}/pdf`, + pathParams: ["bookId", "sectionId"], +}; +export type ExportSectionPDFReqPath = { + bookId: number | string; + sectionId: number | string; +}; +export type ExportSectionPDFReq = ExportSectionPDFReqPath; +export type ExportSectionPDFRes = { + url: string; +}; diff --git a/src/endpoint/book/section/export/index.ts b/src/endpoint/book/section/export/index.ts new file mode 100644 index 0000000..3a8ad5a --- /dev/null +++ b/src/endpoint/book/section/export/index.ts @@ -0,0 +1 @@ +export * from "./endpoint"; diff --git a/src/endpoint/book/section/index.ts b/src/endpoint/book/section/index.ts index c494a75..91090fb 100644 --- a/src/endpoint/book/section/index.ts +++ b/src/endpoint/book/section/index.ts @@ -1,3 +1,4 @@ export * from "./block-comment"; export * from "./endpoint"; export * from "./block-memo"; +export * from "./export"; diff --git a/src/object/adminBook.object.ts b/src/object/adminBook.object.ts index ef6455b..f077959 100644 --- a/src/object/adminBook.object.ts +++ b/src/object/adminBook.object.ts @@ -14,7 +14,7 @@ export class AdminBookObject { role: string; user: UserObject; }[]; - isPDFEnabled: boolean; + isPDFExportEnabled: boolean; createdAt: string; updatedAt: string; @@ -27,7 +27,7 @@ export class AdminBookObject { coverImage: string; notionDatabaseId: string; status: "draft" | "pending" | "published" | "deleted"; - isPDFEnabled: boolean; + isPDFExportEnabled: boolean; authorUsers: { id: number; role: string; @@ -43,7 +43,7 @@ export class AdminBookObject { this.price = data.price; this.coverImage = data.coverImage; this.notionDatabaseId = data.notionDatabaseId; - this.isPDFEnabled = data.isPDFEnabled; + this.isPDFExportEnabled = data.isPDFExportEnabled; this.status = data.status; this.authorUsers = data.authorUsers; this.createdAt = data.createdAt; From 22657f4258c87b051eea4498abb147e976e4358e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=98=80=EB=8A=90=ED=98=84=EC=8A=A4?= Date: Tue, 5 Mar 2024 01:33:42 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20isExportPDFEnabled=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/endpoint/book/endpoint.ts | 4 ++-- src/object/adminBook.object.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/endpoint/book/endpoint.ts b/src/endpoint/book/endpoint.ts index 802b4a9..f674ac3 100644 --- a/src/endpoint/book/endpoint.ts +++ b/src/endpoint/book/endpoint.ts @@ -136,7 +136,7 @@ export const UpdateBook: Endpoint = { "coverImage", "notionDatabaseId", "status", - "isPDFEnabled", + "isExportPDFEnabled", ], }; export type UpdateBookReqPath = { @@ -150,7 +150,7 @@ export type UpdateBookReqBody = { coverImage?: string; notionDatabaseId?: string; status?: "draft" | "pending" | "published" | "deleted"; - isPDFEnabled?: boolean; + isExportPDFEnabled?: boolean; }; export type UpdateBookReq = UpdateBookReqPath & UpdateBookReqBody; export type UpdateBookRes = { diff --git a/src/object/adminBook.object.ts b/src/object/adminBook.object.ts index f077959..ad2e8c0 100644 --- a/src/object/adminBook.object.ts +++ b/src/object/adminBook.object.ts @@ -14,7 +14,7 @@ export class AdminBookObject { role: string; user: UserObject; }[]; - isPDFExportEnabled: boolean; + isExportPDFEnabled: boolean; createdAt: string; updatedAt: string; @@ -27,7 +27,7 @@ export class AdminBookObject { coverImage: string; notionDatabaseId: string; status: "draft" | "pending" | "published" | "deleted"; - isPDFExportEnabled: boolean; + isExportPDFEnabled: boolean; authorUsers: { id: number; role: string; @@ -43,7 +43,7 @@ export class AdminBookObject { this.price = data.price; this.coverImage = data.coverImage; this.notionDatabaseId = data.notionDatabaseId; - this.isPDFExportEnabled = data.isPDFExportEnabled; + this.isExportPDFEnabled = data.isExportPDFEnabled; this.status = data.status; this.authorUsers = data.authorUsers; this.createdAt = data.createdAt;