Skip to content

Commit

Permalink
chore: rename from toModel to toEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Jun 5, 2024
1 parent 0cd4a1f commit 063ffc7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions server/domain/task/repository/taskQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TaskEntity> => ({
const toEntity = async (prismaTask: Task & { Author: User }): Promise<TaskEntity> => ({
id: brandedId.task.entity.parse(prismaTask.id),
label: prismaTask.label,
done: prismaTask.done,
Expand All @@ -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 = {
Expand All @@ -43,5 +43,5 @@ export const taskQuery = {
deps.listByAuthorId(tx, userId),
),
findById: async (tx: Prisma.TransactionClient, taskId: MaybeId['task']): Promise<TaskEntity> =>
tx.task.findUniqueOrThrow({ where: { id: taskId }, include: { Author: true } }).then(toModel),
tx.task.findUniqueOrThrow({ where: { id: taskId }, include: { Author: true } }).then(toEntity),
};
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 .",
Expand Down

0 comments on commit 063ffc7

Please sign in to comment.