Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Oct 20, 2023
1 parent fb5a9b5 commit 1f49b08
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 70 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
45 changes: 23 additions & 22 deletions src/providers/common/BbsArticleCommentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Prisma.bbs_article_commentsWhereInput["AND"]>()(
Expand All @@ -65,31 +65,32 @@ export namespace BbsArticleCommentProvider {
);

export const orderBy = (
key: IBbsArticleComment.IRequest.SortableColumns,
_key: IBbsArticleComment.IRequest.SortableColumns,
value: "asc" | "desc",
) =>
Prisma.validator<Prisma.bbs_article_commentsOrderByWithRelationInput | null>()(
key === "created_at" ? { created_at: value } : null,
Prisma.validator<Prisma.bbs_article_commentsOrderByWithRelationInput>()(
{ created_at: value },
);

export const collect =
<Input extends IBbsArticleComment.IStore>(
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<IBbsArticle, "id"> }) =>
(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<Prisma.bbs_article_commentsCreateInput>()({
id: v4(),
article: {
connect: { id: related.article.id },
},
snapshots: {
create: [snapshot],
},
created_at: new Date(),
});
};
}
32 changes: 16 additions & 16 deletions src/providers/common/BbsArticleCommentSnapshotProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ export namespace BbsArticleCommentSnapshotProvider {
};

export const collect = (input: IBbsArticleComment.IStore) =>
Prisma.validator<
Omit<Prisma.bbs_article_comment_snapshotsCreateInput, "comment">
>()({
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<Prisma.bbs_article_comment_snapshotsCreateWithoutCommentInput>()(
{
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,
})),
},
},
});
);
}
18 changes: 7 additions & 11 deletions src/providers/common/BbsArticleProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" }],
Expand Down Expand Up @@ -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" }],
Expand Down Expand Up @@ -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<Prisma.bbs_articlesWhereInput["AND"]>()([
...(input?.title?.length
? [
Expand Down Expand Up @@ -193,23 +193,19 @@ export namespace BbsArticleProvider {
key: IBbsArticle.IRequest.SortableColumns,
value: "asc" | "desc",
) =>
Prisma.validator<Prisma.bbs_articlesOrderByWithRelationInput | null>()(
Prisma.validator<Prisma.bbs_articlesOrderByWithRelationInput>()(
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,
) =>
Expand Down
34 changes: 17 additions & 17 deletions src/providers/common/BbsArticleSnapshotProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ export namespace BbsArticleSnapshotProvider {
};

export const collect = (input: IBbsArticle.IStore) =>
Prisma.validator<
Omit<Prisma.bbs_article_snapshotsCreateInput, "article">
>()({
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<Prisma.bbs_article_snapshotsCreateWithoutArticleInput>()(
{
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,
})),
},
},
});
);
}

0 comments on commit 1f49b08

Please sign in to comment.