From 1748b8d23055de293c03d93f2c6411c5830260e2 Mon Sep 17 00:00:00 2001 From: youmoo Date: Mon, 17 Oct 2022 19:36:20 +0800 Subject: [PATCH] fix: correct some typos and misuse of comma expression --- package.json | 4 ++-- src/libs/db/sql-repository.base.ts | 6 +++--- src/libs/ddd/mapper.interface.ts | 2 +- src/modules/user/user.mapper.ts | 2 +- src/modules/wallet/wallet.mapper.ts | 2 +- tests/shared/shared-steps.ts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 6abb0d20..73edc64e 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ "scripts": { "prebuild": "rimraf dist", "build": "nest build", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"", "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "lint": "eslint \"{src,apps,libs,tests}/**/*.ts\" --fix", "test": "jest --config .jestrc.json", "test:watch": "jest --watch", "test:cov": "jest --coverage", diff --git a/src/libs/db/sql-repository.base.ts b/src/libs/db/sql-repository.base.ts index dd5ac640..2f649265 100644 --- a/src/libs/db/sql-repository.base.ts +++ b/src/libs/db/sql-repository.base.ts @@ -84,8 +84,8 @@ export abstract class SqlRepositoryBase< this.logger.debug( `[${RequestContextService.getRequestId()}] deleting entities ${ - (entity.id, this.tableName) - }`, + entity.id + } from ${this.tableName}`, ); const result = await this.pool.query(query); @@ -102,7 +102,7 @@ export abstract class SqlRepositoryBase< async insert(entity: Aggregate | Aggregate[]): Promise { const entities = Array.isArray(entity) ? entity : [entity]; - const records = entities.map(this.mapper.toPersistance); + const records = entities.map(this.mapper.toPersistence); const query = this.generateInsertQuery(records); diff --git a/src/libs/ddd/mapper.interface.ts b/src/libs/ddd/mapper.interface.ts index e39d5821..3ce95207 100644 --- a/src/libs/ddd/mapper.interface.ts +++ b/src/libs/ddd/mapper.interface.ts @@ -5,7 +5,7 @@ export interface Mapper< DbRecord, Response = any, > { - toPersistance(entity: DomainEntity): DbRecord; + toPersistence(entity: DomainEntity): DbRecord; toDomain(record: any): DomainEntity; toResponse(entity: DomainEntity): Response; } diff --git a/src/modules/user/user.mapper.ts b/src/modules/user/user.mapper.ts index 27b8faba..661fe5e0 100644 --- a/src/modules/user/user.mapper.ts +++ b/src/modules/user/user.mapper.ts @@ -16,7 +16,7 @@ import { Injectable } from '@nestjs/common'; export class UserMapper implements Mapper { - toPersistance(entity: UserEntity): UserModel { + toPersistence(entity: UserEntity): UserModel { const copy = entity.getPropsCopy(); const record: UserModel = { id: copy.id, diff --git a/src/modules/wallet/wallet.mapper.ts b/src/modules/wallet/wallet.mapper.ts index 3607fedb..07027cd6 100644 --- a/src/modules/wallet/wallet.mapper.ts +++ b/src/modules/wallet/wallet.mapper.ts @@ -5,7 +5,7 @@ import { WalletModel, walletSchema } from './database/wallet.repository'; @Injectable() export class WalletMapper implements Mapper { - toPersistance(entity: WalletEntity): WalletModel { + toPersistence(entity: WalletEntity): WalletModel { const copy = entity.getPropsCopy(); const record: WalletModel = { id: copy.id, diff --git a/tests/shared/shared-steps.ts b/tests/shared/shared-steps.ts index 5d0090ed..a8d3581f 100644 --- a/tests/shared/shared-steps.ts +++ b/tests/shared/shared-steps.ts @@ -4,7 +4,7 @@ import { CreateUserTestContext } from '@tests/user/user-shared-steps'; import { DefineStepFunction } from 'jest-cucumber'; /** - * Test steps that an be shared between all tests + * Test steps that can be shared between all tests */ export const iReceiveAnErrorWithStatusCode = (