From 1f49b0853e16b255b9dd8435e72db174c5f56d50 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Fri, 20 Oct 2023 19:13:30 +0900 Subject: [PATCH] Upgrade dependencies --- package.json | 6 +-- packages/api/package.json | 2 +- .../common/BbsArticleCommentProvider.ts | 45 ++++++++++--------- .../BbsArticleCommentSnapshotProvider.ts | 32 ++++++------- src/providers/common/BbsArticleProvider.ts | 18 +++----- .../common/BbsArticleSnapshotProvider.ts | 34 +++++++------- 6 files changed, 67 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index 1fc6554..bd864ba 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "homepage": "https://github.com/samchon/backend", "devDependencies": { "@nestia/e2e": "^0.3.6", - "@nestia/sdk": "^2.3.0", + "@nestia/sdk": "^2.3.3", "@trivago/prettier-plugin-sort-imports": "^3.3.0", "@types/cli": "^0.11.19", "@types/inquirer": "^8.2.5", @@ -67,7 +67,7 @@ "nestia": "^5.0.2", "pm2": "^4.5.6", "prettier": "^2.6.2", - "prisma-markdown": "^1.0.0", + "prisma-markdown": "^1.0.1", "rimraf": "^3.0.2", "sloc": "^0.2.1", "ts-node": "^10.9.1", @@ -76,7 +76,7 @@ "typescript-transform-paths": "^3.4.6" }, "dependencies": { - "@nestia/core": "^2.3.0", + "@nestia/core": "^2.3.3", "@prisma/client": "^5.3.1", "dotenv": "^16.3.1", "dotenv-expand": "^10.0.0", diff --git a/packages/api/package.json b/packages/api/package.json index ef631de..91c06e4 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -15,7 +15,7 @@ }, "homepage": "https://github.com/samchon/backend#readme", "dependencies": { - "@nestia/fetcher": "^2.3.0", + "@nestia/fetcher": "^2.3.3", "typia": "^5.2.3" }, "include": [ diff --git a/src/providers/common/BbsArticleCommentProvider.ts b/src/providers/common/BbsArticleCommentProvider.ts index 7096aa4..41830a6 100644 --- a/src/providers/common/BbsArticleCommentProvider.ts +++ b/src/providers/common/BbsArticleCommentProvider.ts @@ -39,13 +39,13 @@ export namespace BbsArticleCommentProvider { payload: json.select, transform: json.transform, })({ - where: where(input.search ?? {}), + where: search(input.search ?? {}), orderBy: input.sort?.length ? PaginationUtil.orderBy(orderBy)(input.sort) : [{ created_at: "asc" }], })(input); - export const where = ( + export const search = ( input: IBbsArticleComment.IRequest.ISearch | undefined, ) => Prisma.validator()( @@ -65,31 +65,32 @@ export namespace BbsArticleCommentProvider { ); export const orderBy = ( - key: IBbsArticleComment.IRequest.SortableColumns, + _key: IBbsArticleComment.IRequest.SortableColumns, value: "asc" | "desc", ) => - Prisma.validator()( - key === "created_at" ? { created_at: value } : null, + Prisma.validator()( + { created_at: value }, ); export const collect = - ( - factory: ( - input: Input, - ) => Omit< - Prisma.bbs_article_comment_snapshotsCreateInput, - "comment" - >, + < + Input extends IBbsArticleComment.IStore, + Snapshot extends Prisma.bbs_article_comment_snapshotsCreateWithoutCommentInput, + >( + snapshotFactory: (input: Input) => Snapshot, ) => (related: { article: Pick }) => - (input: Input): Prisma.bbs_article_commentsCreateInput => ({ - id: v4(), - article: { - connect: { id: related.article.id }, - }, - snapshots: { - create: [factory(input)], - }, - created_at: new Date(), - }); + (input: Input) => { + const snapshot = snapshotFactory(input); + return Prisma.validator()({ + id: v4(), + article: { + connect: { id: related.article.id }, + }, + snapshots: { + create: [snapshot], + }, + created_at: new Date(), + }); + }; } diff --git a/src/providers/common/BbsArticleCommentSnapshotProvider.ts b/src/providers/common/BbsArticleCommentSnapshotProvider.ts index 5cbd7c0..1524dd9 100644 --- a/src/providers/common/BbsArticleCommentSnapshotProvider.ts +++ b/src/providers/common/BbsArticleCommentSnapshotProvider.ts @@ -53,21 +53,21 @@ export namespace BbsArticleCommentSnapshotProvider { }; export const collect = (input: IBbsArticleComment.IStore) => - Prisma.validator< - Omit - >()({ - id: v4(), - format: input.format, - body: input.body, - created_at: new Date(), - to_files: { - create: input.files.map((file, i) => ({ - id: v4(), - file: { - create: AttachmentFileProvider.collect(file), - }, - sequence: i, - })), + Prisma.validator()( + { + id: v4(), + format: input.format, + body: input.body, + created_at: new Date(), + to_files: { + create: input.files.map((file, i) => ({ + id: v4(), + file: { + create: AttachmentFileProvider.collect(file), + }, + sequence: i, + })), + }, }, - }); + ); } diff --git a/src/providers/common/BbsArticleProvider.ts b/src/providers/common/BbsArticleProvider.ts index 6f5b1ba..27c534c 100644 --- a/src/providers/common/BbsArticleProvider.ts +++ b/src/providers/common/BbsArticleProvider.ts @@ -38,7 +38,7 @@ export namespace BbsArticleProvider { payload: abridge.select, transform: abridge.transform, })({ - where: where(input.search ?? {}), + where: search(input.search ?? {}), orderBy: input.sort?.length ? PaginationUtil.orderBy(orderBy)(input.sort) : [{ created_at: "desc" }], @@ -85,7 +85,7 @@ export namespace BbsArticleProvider { payload: summarize.select, transform: summarize.transform, })({ - where: where(input.search ?? {}), + where: search(input.search ?? {}), orderBy: input.sort?.length ? PaginationUtil.orderBy(orderBy)(input.sort) : [{ created_at: "desc" }], @@ -115,7 +115,7 @@ export namespace BbsArticleProvider { }); } - export const where = (input: IBbsArticle.IRequest.ISearch | undefined) => + export const search = (input: IBbsArticle.IRequest.ISearch | undefined) => Prisma.validator()([ ...(input?.title?.length ? [ @@ -193,23 +193,19 @@ export namespace BbsArticleProvider { key: IBbsArticle.IRequest.SortableColumns, value: "asc" | "desc", ) => - Prisma.validator()( + Prisma.validator()( key === "title" ? { mv_last: { snapshot: { title: value } } } : key === "created_at" ? { created_at: value } - : key === "updated_at" - ? { mv_last: { snapshot: { created_at: value } } } - : null, + : // updated_at + { mv_last: { snapshot: { created_at: value } } }, ); export const collect = < Input extends IBbsArticle.IStore, - Snapshot extends Omit< - Prisma.bbs_article_snapshotsCreateInput, - "article" - >, + Snapshot extends Prisma.bbs_article_snapshotsCreateWithoutArticleInput, >( snapshotFactory: (input: Input) => Snapshot, ) => diff --git a/src/providers/common/BbsArticleSnapshotProvider.ts b/src/providers/common/BbsArticleSnapshotProvider.ts index 1e51dc5..fd042ad 100644 --- a/src/providers/common/BbsArticleSnapshotProvider.ts +++ b/src/providers/common/BbsArticleSnapshotProvider.ts @@ -59,22 +59,22 @@ export namespace BbsArticleSnapshotProvider { }; export const collect = (input: IBbsArticle.IStore) => - Prisma.validator< - Omit - >()({ - id: v4(), - title: input.title, - format: input.format, - body: input.body, - created_at: new Date(), - to_files: { - create: input.files.map((file, i) => ({ - id: v4(), - file: { - create: AttachmentFileProvider.collect(file), - }, - sequence: i, - })), + Prisma.validator()( + { + id: v4(), + title: input.title, + format: input.format, + body: input.body, + created_at: new Date(), + to_files: { + create: input.files.map((file, i) => ({ + id: v4(), + file: { + create: AttachmentFileProvider.collect(file), + }, + sequence: i, + })), + }, }, - }); + ); }