Skip to content

Commit ca06009

Browse files
updated
1 parent e5de294 commit ca06009

38 files changed

+88
-36
lines changed

README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,78 @@
11
# Development the API Clean Architecture Node.js with TypeScript
22

33
```plaintext
4+
45
src/
56
├── adapters/
67
│ ├── controllers/
7-
│ │ ├── index.ts
8-
│ │ └── UserController.ts
8+
│ │ ├── User/
9+
│ │ │ ├── __tests__/
10+
│ │ │ │ └── UserController.test.ts
11+
│ │ │ └── UserController.ts
12+
│ │ └── index.ts
913
│ ├── presenters/
10-
│ │ └── UserPresenter.ts
14+
│ │ └── User/
15+
│ │ └── UserPresenter.ts
1116
│ └── repositories/
12-
│ └── UserRepository.ts
17+
│ └── User/
18+
│ └── UserRepository.ts
1319
├── entities/
14-
│ └── User.ts
20+
│ └── User/
21+
│ ├── __tests__/
22+
│ │ └── User.entity.test.ts
23+
│ └── User.entity.ts
1524
├── frameworks/
1625
│ ├── express/
26+
│ │ ├── __tests__/
27+
│ │ │ └── server.test.ts
1728
│ │ ├── middlewares/
1829
│ │ │ └── ExampleMiddleware.ts
1930
│ │ └── server.ts
2031
│ └── typeorm/
2132
│ ├── entities/
22-
│ │ └── UserEntity.ts
33+
│ │ └── User/
34+
│ │ └── UserEntity.ts
2335
│ └── database.ts
36+
├── integrations/
37+
│ └── ExternalAPI/
38+
│ ├── __tests__/
39+
│ │ └── ExternalAPIService.test.ts
40+
│ └── ExternalAPIService.ts
2441
├── services/
25-
│ └── UserService.ts
42+
│ └── User/
43+
│ ├── __tests__/
44+
│ │ └── UserService.test.ts
45+
│ └── UserService.ts
2646
├── shared/
2747
│ ├── logger/
28-
│ │ └── index.ts
48+
│ │ └── logger.ts
2949
│ └── utils/
50+
│ ├── __tests__/
51+
│ │ └── Validation.test.ts
3052
│ └── Validation.ts
3153
└── useCases/
32-
└── user/
54+
└── User/
3355
├── create/
56+
│ ├── __tests__/
57+
│ │ └── CreateUserUseCase.test.ts
3458
│ ├── CreateUserController.ts
3559
│ ├── CreateUserUseCase.ts
3660
│ └── ICreateUserRepository.ts
3761
├── delete/
62+
│ ├── __tests__/
63+
│ │ └── DeleteUserUseCase.test.ts
3864
│ ├── DeleteUserController.ts
3965
│ ├── DeleteUserUseCase.ts
4066
│ └── IDeleteUserRepository.ts
4167
├── get/
68+
│ ├── __tests__/
69+
│ │ └── GetUserUseCase.test.ts
4270
│ ├── GetUserController.ts
4371
│ ├── GetUserUseCase.ts
44-
│ └── IGetUserRepository.ts
72+
│ └── IGetUserRepository.ts
4573
└── put/
74+
├── __tests__/
75+
│ └── PutUserUseCase.test.ts
4676
├── PutUserController.ts
4777
├── PutUserUseCase.ts
4878
└── IPutUserRepository.ts

src/adapters/controllers/UserController.ts renamed to src/adapters/controllers/User/UserController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Application, Request, Response } from 'express'
22
import { UserService } from '@/services/UserService'
3-
import { UserPresenter } from '../presenters/UserPresenter'
3+
import { UserPresenter } from '../../presenters/User/UserPresenter'
44

55
export default (app: Application, userService: UserService) => {
66
/**

src/frameworks/express/middlewares/ExampleMiddleware.ts renamed to src/adapters/controllers/__tests__/UserController.test.ts

File renamed without changes.

src/adapters/controllers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Application } from 'express'
22
import { readdirSync } from 'fs'
33
import { join } from 'path'
4-
import { IUserRepository } from '../repositories/UserRepository'
4+
import { IUserRepository } from '../repositories/User/UserRepository'
55

66
export default (app: Application, userRepository: IUserRepository) => {
77
const controllersPath = __dirname

src/adapters/presenters/UserPresenter.ts renamed to src/adapters/presenters/User/UserPresenter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { User } from '@/entities/User'
1+
import { User } from '@/entities/User/User.entity'
22

33
export class UserPresenter {
44
static toResponse(user: User): User {

src/adapters/repositories/UserRepository.ts renamed to src/adapters/repositories/User/UserRepository.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import User, { IUser } from '../../frameworks/typeorm/entities/UserEntity'
1+
import User, {
2+
IUser
3+
} from '../../../frameworks/typeorm/entities/User/UserEntity'
24

35
export interface IUserRepository {
46
createUser(userData: Partial<IUser>): Promise<IUser>

src/entities/__tests__/User.entity.test.ts

Whitespace-only changes.

src/frameworks/express/__tests__/server.test.ts

Whitespace-only changes.

src/frameworks/express/middlewares/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)