From 54e38fa374c77068085ad58fcc2e99bbc07f5efb Mon Sep 17 00:00:00 2001 From: zhumeisongsong Date: Tue, 19 Nov 2024 16:02:29 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20User-domain=20?= =?UTF-8?q?to=20users-domain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/user/domain/project.json | 9 --------- .../src/lib/use-case/get-user.use-case.spec.ts | 2 +- .../application/src/lib/use-case/get-user.use-case.ts | 2 +- libs/users/application/src/lib/users.service.spec.ts | 2 +- libs/users/application/src/lib/users.service.ts | 2 +- libs/{user => users}/domain/README.md | 0 libs/{user => users}/domain/eslint.config.js | 0 libs/{user => users}/domain/jest.config.ts | 2 +- libs/users/domain/project.json | 9 +++++++++ libs/{user => users}/domain/src/index.ts | 0 libs/{user => users}/domain/src/lib/user.entity.spec.ts | 2 +- libs/{user => users}/domain/src/lib/user.entity.ts | 0 .../domain/src/lib/user.repository.spec.ts | 1 - libs/{user => users}/domain/src/lib/user.repository.ts | 2 +- libs/{user => users}/domain/tsconfig.json | 0 libs/{user => users}/domain/tsconfig.lib.json | 0 libs/{user => users}/domain/tsconfig.spec.json | 0 .../mongoose/src/lib/mongoose-user.repository.spec.ts | 2 +- .../mongoose/src/lib/mongoose-user.repository.ts | 2 +- .../presentation/resolver/src/lib/users.resolver.spec.ts | 2 +- .../presentation/resolver/src/lib/users.resolver.ts | 2 +- tsconfig.base.json | 2 +- 22 files changed, 21 insertions(+), 22 deletions(-) delete mode 100644 libs/user/domain/project.json rename libs/{user => users}/domain/README.md (100%) rename libs/{user => users}/domain/eslint.config.js (100%) rename libs/{user => users}/domain/jest.config.ts (80%) create mode 100644 libs/users/domain/project.json rename libs/{user => users}/domain/src/index.ts (100%) rename libs/{user => users}/domain/src/lib/user.entity.spec.ts (99%) rename libs/{user => users}/domain/src/lib/user.entity.ts (100%) rename libs/{user => users}/domain/src/lib/user.repository.spec.ts (99%) rename libs/{user => users}/domain/src/lib/user.repository.ts (98%) rename libs/{user => users}/domain/tsconfig.json (100%) rename libs/{user => users}/domain/tsconfig.lib.json (100%) rename libs/{user => users}/domain/tsconfig.spec.json (100%) diff --git a/libs/user/domain/project.json b/libs/user/domain/project.json deleted file mode 100644 index 0987b49..0000000 --- a/libs/user/domain/project.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "user-domain", - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/user/domain/src", - "projectType": "library", - "tags": [], - "// targets": "to see all targets run: nx show project user-domain --web", - "targets": {} -} diff --git a/libs/users/application/src/lib/use-case/get-user.use-case.spec.ts b/libs/users/application/src/lib/use-case/get-user.use-case.spec.ts index 9425eec..650e7d2 100644 --- a/libs/users/application/src/lib/use-case/get-user.use-case.spec.ts +++ b/libs/users/application/src/lib/use-case/get-user.use-case.spec.ts @@ -1,5 +1,5 @@ import { GetUserUseCase } from './get-user.use-case'; -import { UserRepository } from '@user/domain'; +import { UserRepository } from '@users/domain'; describe('GetUserUseCase', () => { let getUserUseCase: GetUserUseCase; diff --git a/libs/users/application/src/lib/use-case/get-user.use-case.ts b/libs/users/application/src/lib/use-case/get-user.use-case.ts index b5c8b0f..a922928 100644 --- a/libs/users/application/src/lib/use-case/get-user.use-case.ts +++ b/libs/users/application/src/lib/use-case/get-user.use-case.ts @@ -1,4 +1,4 @@ -import { User, UserRepository } from '@user/domain'; +import { User, UserRepository } from '@users/domain'; export class GetUserUseCase { constructor(private readonly userRepository: UserRepository) {} diff --git a/libs/users/application/src/lib/users.service.spec.ts b/libs/users/application/src/lib/users.service.spec.ts index 38dc304..85a8661 100644 --- a/libs/users/application/src/lib/users.service.spec.ts +++ b/libs/users/application/src/lib/users.service.spec.ts @@ -1,5 +1,5 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { User } from '@user/domain'; +import { User } from '@users/domain'; import { UsersService } from './users.service'; diff --git a/libs/users/application/src/lib/users.service.ts b/libs/users/application/src/lib/users.service.ts index e9757b0..b605946 100644 --- a/libs/users/application/src/lib/users.service.ts +++ b/libs/users/application/src/lib/users.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { User } from '@user/domain'; +import { User } from '@users/domain'; @Injectable() export class UsersService { diff --git a/libs/user/domain/README.md b/libs/users/domain/README.md similarity index 100% rename from libs/user/domain/README.md rename to libs/users/domain/README.md diff --git a/libs/user/domain/eslint.config.js b/libs/users/domain/eslint.config.js similarity index 100% rename from libs/user/domain/eslint.config.js rename to libs/users/domain/eslint.config.js diff --git a/libs/user/domain/jest.config.ts b/libs/users/domain/jest.config.ts similarity index 80% rename from libs/user/domain/jest.config.ts rename to libs/users/domain/jest.config.ts index 4334d1b..0f470a6 100644 --- a/libs/user/domain/jest.config.ts +++ b/libs/users/domain/jest.config.ts @@ -6,5 +6,5 @@ export default { '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], }, moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../../coverage/libs/user/domain', + coverageDirectory: '../../../coverage/libs/users/domain', }; diff --git a/libs/users/domain/project.json b/libs/users/domain/project.json new file mode 100644 index 0000000..642ed82 --- /dev/null +++ b/libs/users/domain/project.json @@ -0,0 +1,9 @@ +{ + "name": "users-domain", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/users/domain/src", + "projectType": "library", + "tags": [], + "// targets": "to see all targets run: nx show project users-domain --web", + "targets": {} +} diff --git a/libs/user/domain/src/index.ts b/libs/users/domain/src/index.ts similarity index 100% rename from libs/user/domain/src/index.ts rename to libs/users/domain/src/index.ts diff --git a/libs/user/domain/src/lib/user.entity.spec.ts b/libs/users/domain/src/lib/user.entity.spec.ts similarity index 99% rename from libs/user/domain/src/lib/user.entity.spec.ts rename to libs/users/domain/src/lib/user.entity.spec.ts index 7e91f5c..4274304 100644 --- a/libs/user/domain/src/lib/user.entity.spec.ts +++ b/libs/users/domain/src/lib/user.entity.spec.ts @@ -12,4 +12,4 @@ describe('User Entity', () => { user.name = 'Jane Doe'; expect(user.name).toBe('Jane Doe'); }); -}); \ No newline at end of file +}); diff --git a/libs/user/domain/src/lib/user.entity.ts b/libs/users/domain/src/lib/user.entity.ts similarity index 100% rename from libs/user/domain/src/lib/user.entity.ts rename to libs/users/domain/src/lib/user.entity.ts diff --git a/libs/user/domain/src/lib/user.repository.spec.ts b/libs/users/domain/src/lib/user.repository.spec.ts similarity index 99% rename from libs/user/domain/src/lib/user.repository.spec.ts rename to libs/users/domain/src/lib/user.repository.spec.ts index f3be2c5..dbac875 100644 --- a/libs/user/domain/src/lib/user.repository.spec.ts +++ b/libs/users/domain/src/lib/user.repository.spec.ts @@ -28,5 +28,4 @@ describe('UserRepository', () => { const user = await userRepository.findById('3'); expect(user).toBeNull(); }); - }); diff --git a/libs/user/domain/src/lib/user.repository.ts b/libs/users/domain/src/lib/user.repository.ts similarity index 98% rename from libs/user/domain/src/lib/user.repository.ts rename to libs/users/domain/src/lib/user.repository.ts index 0712d58..a3e9686 100644 --- a/libs/user/domain/src/lib/user.repository.ts +++ b/libs/users/domain/src/lib/user.repository.ts @@ -2,4 +2,4 @@ import { User } from './user.entity'; export interface UserRepository { findById(id: string): Promise; -} \ No newline at end of file +} diff --git a/libs/user/domain/tsconfig.json b/libs/users/domain/tsconfig.json similarity index 100% rename from libs/user/domain/tsconfig.json rename to libs/users/domain/tsconfig.json diff --git a/libs/user/domain/tsconfig.lib.json b/libs/users/domain/tsconfig.lib.json similarity index 100% rename from libs/user/domain/tsconfig.lib.json rename to libs/users/domain/tsconfig.lib.json diff --git a/libs/user/domain/tsconfig.spec.json b/libs/users/domain/tsconfig.spec.json similarity index 100% rename from libs/user/domain/tsconfig.spec.json rename to libs/users/domain/tsconfig.spec.json diff --git a/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.spec.ts b/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.spec.ts index 20a9466..412edd7 100644 --- a/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.spec.ts +++ b/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.spec.ts @@ -3,7 +3,7 @@ import { getModelToken } from '@nestjs/mongoose'; import { Model } from 'mongoose'; import { MongooseUserRepository } from './mongoose-user.repository'; import { UserDocument } from './user.schema'; -import { User } from '@user/domain'; +import { User } from '@users/domain'; describe('MongooseUserRepository', () => { let repository: MongooseUserRepository; diff --git a/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.ts b/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.ts index 61af61d..70042a0 100644 --- a/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.ts +++ b/libs/users/infrastructure/mongoose/src/lib/mongoose-user.repository.ts @@ -1,5 +1,5 @@ import { InjectModel } from '@nestjs/mongoose'; -import { User, UserRepository } from '@user/domain'; +import { User, UserRepository } from '@users/domain'; import { Model } from 'mongoose'; import { UserDocument } from './user.schema'; diff --git a/libs/users/presentation/resolver/src/lib/users.resolver.spec.ts b/libs/users/presentation/resolver/src/lib/users.resolver.spec.ts index 2ce2a45..a7bb40e 100644 --- a/libs/users/presentation/resolver/src/lib/users.resolver.spec.ts +++ b/libs/users/presentation/resolver/src/lib/users.resolver.spec.ts @@ -1,6 +1,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { UsersService } from '@users/application'; -import { User } from '@user/domain'; +import { User } from '@users/domain'; import { UsersResolver } from './users.resolver'; diff --git a/libs/users/presentation/resolver/src/lib/users.resolver.ts b/libs/users/presentation/resolver/src/lib/users.resolver.ts index 1b5a730..764a759 100644 --- a/libs/users/presentation/resolver/src/lib/users.resolver.ts +++ b/libs/users/presentation/resolver/src/lib/users.resolver.ts @@ -1,6 +1,6 @@ import { Args, ID, Query, Resolver, ResolveReference } from '@nestjs/graphql'; import { UsersService } from '@users/application'; -import { User } from '@user/domain'; +import { User } from '@users/domain'; import { UserDto } from '@users/presentation-dto'; @Resolver(() => UserDto) diff --git a/tsconfig.base.json b/tsconfig.base.json index ee04d91..cd1cedb 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,7 +20,7 @@ "@shared/infrastructure-mongoose": [ "libs/shared/infrastructure/mongoose/src/index.ts" ], - "@user/domain": ["libs/user/domain/src/index.ts"], + "@users/domain": ["libs/users/domain/src/index.ts"], "@users/application": ["libs/users/application/src/index.ts"], "@users/infrastructure-mongoose": [ "libs/users/infrastructure/mongoose/src/index.ts"