From 063ffc78c98fa29206de12efd6c90d688dec04e6 Mon Sep 17 00:00:00 2001 From: solufa Date: Thu, 6 Jun 2024 01:51:59 +0900 Subject: [PATCH] chore: rename from toModel to toEntity --- server/domain/task/repository/taskQuery.ts | 6 +++--- server/package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/domain/task/repository/taskQuery.ts b/server/domain/task/repository/taskQuery.ts index c5b759b..040ac2c 100644 --- a/server/domain/task/repository/taskQuery.ts +++ b/server/domain/task/repository/taskQuery.ts @@ -5,7 +5,7 @@ import { brandedId } from 'service/brandedId'; import { s3 } from 'service/s3Client'; import { depend } from 'velona'; -const toModel = async (prismaTask: Task & { Author: User }): Promise => ({ +const toEntity = async (prismaTask: Task & { Author: User }): Promise => ({ id: brandedId.task.entity.parse(prismaTask.id), label: prismaTask.label, done: prismaTask.done, @@ -32,7 +32,7 @@ const listByAuthorId = async ( include: { Author: true }, }); - return Promise.all(prismaTasks.map(toModel)); + return Promise.all(prismaTasks.map(toEntity)); }; export const taskQuery = { @@ -43,5 +43,5 @@ export const taskQuery = { deps.listByAuthorId(tx, userId), ), findById: async (tx: Prisma.TransactionClient, taskId: MaybeId['task']): Promise => - tx.task.findUniqueOrThrow({ where: { id: taskId }, include: { Author: true } }).then(toModel), + tx.task.findUniqueOrThrow({ where: { id: taskId }, include: { Author: true } }).then(toEntity), }; diff --git a/server/package.json b/server/package.json index cfc0eb1..76d8d93 100644 --- a/server/package.json +++ b/server/package.json @@ -2,13 +2,13 @@ "name": "server", "version": "0.1.0", "scripts": { - "predev": "npm run generate && npm run migrate:deploy", + "predev": "run-p generate migrate:deploy", "dev": "run-p dev:*", "dev:build": "node ./scripts/build.dev.js", "dev:server": "touch index.js && node-dev --respawn index.js", "dev:frourio": "frourio --watch", "dev:prisma": "prisma generate --watch", - "prebuild": "npm run generate && npm run migrate:deploy", + "prebuild": "run-p generate migrate:deploy", "build": "node ./scripts/build.prod.js", "lint": "run-p lint:js lint:prettier lint:prisma", "lint:js": "eslint --ext .ts,.js --ignore-path .gitignore .",