phos 1.2.1 โ 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/package.json +1 -1
- package/src/templates/backend/nestjs/.env.example +15 -0
- package/src/templates/backend/nestjs/.prettierrc +4 -0
- package/src/templates/backend/nestjs/README.md +98 -0
- package/src/templates/backend/nestjs/eslint.config.mjs +35 -0
- package/src/templates/backend/nestjs/nest-cli.json +8 -0
- package/src/templates/backend/nestjs/package.json +78 -0
- package/src/templates/backend/nestjs/src/app.controller.spec.ts +22 -0
- package/src/templates/backend/nestjs/src/app.controller.ts +12 -0
- package/src/templates/backend/nestjs/src/app.module.ts +34 -0
- package/src/templates/backend/nestjs/src/app.service.ts +8 -0
- package/src/templates/backend/nestjs/src/main.ts +34 -0
- package/src/templates/backend/nestjs/src/user/dto/create-user.dto.ts +40 -0
- package/src/templates/backend/nestjs/src/user/dto/update-user.dto.ts +44 -0
- package/src/templates/backend/nestjs/src/user/user.controller.spec.ts +20 -0
- package/src/templates/backend/nestjs/src/user/user.controller.ts +74 -0
- package/src/templates/backend/nestjs/src/user/user.entity.ts +37 -0
- package/src/templates/backend/nestjs/src/user/user.module.ts +13 -0
- package/src/templates/backend/nestjs/src/user/user.service.spec.ts +18 -0
- package/src/templates/backend/nestjs/src/user/user.service.ts +122 -0
- package/src/templates/backend/nestjs/test/app.e2e-spec.ts +25 -0
- package/src/templates/backend/nestjs/test/jest-e2e.json +9 -0
- package/src/templates/backend/nestjs/tsconfig.build.json +4 -0
- package/src/templates/backend/nestjs/tsconfig.json +25 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Full-stack interactive project generator CLI
|
|
|
10
10
|
[](https://nodejs.org)
|
|
11
11
|
[](http://makeapullrequest.com)
|
|
12
12
|
|
|
13
|
-
**Version 1.
|
|
13
|
+
**Version 1.3.1 - Production Release** ๐
|
|
14
14
|
|
|
15
15
|
[View on npmjs.com](https://www.npmjs.com/package/phos)
|
|
16
16
|
|
|
@@ -25,12 +25,12 @@ Phos is a powerful CLI tool that scaffolds modern full-stack web applications wi
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
27
|
- โจ Interactive CLI with beautiful prompts
|
|
28
|
-
- ๐ Multiple backend frameworks (Elysia, FastAPI)
|
|
29
|
-
- ๐จ Multiple frontend frameworks (Astro, Svelte, Next.js)
|
|
28
|
+
- ๐ Multiple backend frameworks (Elysia, FastAPI, NestJS)
|
|
29
|
+
- ๐จ Multiple frontend frameworks (Astro, Svelte, Next.js, Vue)
|
|
30
30
|
- ๐ฆ Monorepo support with workspace configuration
|
|
31
31
|
- ๐ ๏ธ Configurable tooling (TypeScript, ESLint, Prettier)
|
|
32
32
|
- ๐จ CSS framework options (Tailwind, SCSS, CSS Modules)
|
|
33
|
-
- ๐งฉ UI component library support (shadcn/ui, Radix UI)
|
|
33
|
+
- ๐งฉ UI component library support (Ant Design, shadcn/ui, Radix UI, Vuetify)
|
|
34
34
|
- ๐งช Testing framework options (Vitest, Playwright)
|
|
35
35
|
- ๐ค Multiple package manager support (npm, yarn, pnpm, bun)
|
|
36
36
|
- ๐ Automatic README generation
|
|
@@ -64,6 +64,7 @@ Phos is a powerful CLI tool that scaffolds modern full-stack web applications wi
|
|
|
64
64
|
| ---------------------------------------- | ------- | ---------------------------------- |
|
|
65
65
|
| [Elysia](https://elysiajs.com/) | Bun | Fast and elegant Bun web framework |
|
|
66
66
|
| [FastAPI](https://fastapi.tiangolo.com/) | Python | Modern Python web framework |
|
|
67
|
+
| [NestJS](https://nestjs.com/) | Node.js | Progressive Node.js framework with TypeScript |
|
|
67
68
|
|
|
68
69
|
#### Frontend
|
|
69
70
|
|
|
@@ -72,6 +73,7 @@ Phos is a powerful CLI tool that scaffolds modern full-stack web applications wi
|
|
|
72
73
|
| [Astro](https://astro.build/) | Modern static site generator |
|
|
73
74
|
| [SvelteKit](https://kit.svelte.dev/) | Full-stack Svelte framework |
|
|
74
75
|
| [Next.js](https://nextjs.org/) | React framework with server components |
|
|
76
|
+
| [Vue](https://vuejs.org/) | Progressive JavaScript framework |
|
|
75
77
|
|
|
76
78
|
## Quick Start
|
|
77
79
|
|
|
@@ -131,14 +133,13 @@ Phos will guide you through a series of questions to configure your project:
|
|
|
131
133
|
5. **Backend: Use TypeScript?** - Enable TypeScript for backend
|
|
132
134
|
6. **Backend: Add ESLint?** - Add ESLint configuration
|
|
133
135
|
7. **Backend: Add Prettier?** - Add Prettier configuration
|
|
134
|
-
8. **Frontend Framework** - Astro, Svelte,
|
|
136
|
+
8. **Frontend Framework** - Astro, Svelte, Next.js, or Vue
|
|
135
137
|
9. **Frontend Package Manager** - npm, yarn, pnpm, or bun
|
|
136
138
|
10. **Frontend: Use TypeScript?** - Enable TypeScript for frontend
|
|
137
139
|
11. **Frontend: Add ESLint?** - Add ESLint configuration
|
|
138
140
|
12. **Frontend: Add Prettier?** - Add Prettier configuration
|
|
139
141
|
13. **Select CSS Framework** - No, Tailwind CSS, SCSS, or CSS Modules
|
|
140
|
-
14. **Add
|
|
141
|
-
15. **Add Testing?** - No, Vitest, Playwright, or both
|
|
142
|
+
14. **Add Testing?** - No, Vitest, Playwright, or both
|
|
142
143
|
16. **Initialize Git?** - Initialize a Git repository
|
|
143
144
|
17. **Install Dependencies?** - Auto-install dependencies after generation
|
|
144
145
|
|
|
@@ -209,7 +210,6 @@ npx phos create
|
|
|
209
210
|
# Frontend: Add ESLint? Yes
|
|
210
211
|
# Frontend: Add Prettier? Yes
|
|
211
212
|
# CSS Framework: Tailwind CSS
|
|
212
|
-
# UI Components: shadcn/ui
|
|
213
213
|
# Testing: Vitest + Playwright
|
|
214
214
|
# Initialize Git? Yes
|
|
215
215
|
# Install dependencies? No
|
|
@@ -227,7 +227,6 @@ bunx phos create
|
|
|
227
227
|
# Add ESLint? Yes
|
|
228
228
|
# Add Prettier? Yes
|
|
229
229
|
# CSS Framework: Tailwind CSS
|
|
230
|
-
# UI Components: No
|
|
231
230
|
# Testing: Vitest
|
|
232
231
|
# Initialize Git? Yes
|
|
233
232
|
# Install dependencies? No
|
|
@@ -278,6 +277,8 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
278
277
|
|
|
279
278
|
Phos follows [semantic versioning](https://semver.org/).
|
|
280
279
|
|
|
280
|
+
- **1.3.1** - Patch release (Vue frontend support, documentation updates)
|
|
281
|
+
- **1.3.0** - Minor release (NestJS backend support)
|
|
281
282
|
- **1.2.1** - Patch release (TypeScript type fix)
|
|
282
283
|
- **1.2.0** - Minor release (backend API architecture)
|
|
283
284
|
- **1.1.0** - Minor release (new features, non-breaking changes)
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Server
|
|
2
|
+
PORT=3000
|
|
3
|
+
|
|
4
|
+
# Database
|
|
5
|
+
DATABASE_HOST=localhost
|
|
6
|
+
DATABASE_PORT=5432
|
|
7
|
+
DATABASE_USERNAME=postgres
|
|
8
|
+
DATABASE_PASSWORD=postgres
|
|
9
|
+
DATABASE_NAME=nestjs_db
|
|
10
|
+
DATABASE_SYNCHRONIZE=false
|
|
11
|
+
DATABASE_LOGGING=false
|
|
12
|
+
|
|
13
|
+
# JWT
|
|
14
|
+
JWT_SECRET=your-secret-key-change-this-in-production
|
|
15
|
+
JWT_EXPIRATION=1d
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
|
6
|
+
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
7
|
+
|
|
8
|
+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
|
+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
|
+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
15
|
+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
16
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
17
|
+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
|
18
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
19
|
+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
|
20
|
+
</p>
|
|
21
|
+
<!--[](https://opencollective.com/nest#backer)
|
|
22
|
+
[](https://opencollective.com/nest#sponsor)-->
|
|
23
|
+
|
|
24
|
+
## Description
|
|
25
|
+
|
|
26
|
+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
|
27
|
+
|
|
28
|
+
## Project setup
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
$ npm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Compile and run the project
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# development
|
|
38
|
+
$ npm run start
|
|
39
|
+
|
|
40
|
+
# watch mode
|
|
41
|
+
$ npm run start:dev
|
|
42
|
+
|
|
43
|
+
# production mode
|
|
44
|
+
$ npm run start:prod
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Run tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# unit tests
|
|
51
|
+
$ npm run test
|
|
52
|
+
|
|
53
|
+
# e2e tests
|
|
54
|
+
$ npm run test:e2e
|
|
55
|
+
|
|
56
|
+
# test coverage
|
|
57
|
+
$ npm run test:cov
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Deployment
|
|
61
|
+
|
|
62
|
+
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
|
63
|
+
|
|
64
|
+
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
$ npm install -g @nestjs/mau
|
|
68
|
+
$ mau deploy
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
|
72
|
+
|
|
73
|
+
## Resources
|
|
74
|
+
|
|
75
|
+
Check out a few resources that may come in handy when working with NestJS:
|
|
76
|
+
|
|
77
|
+
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
|
78
|
+
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
79
|
+
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
80
|
+
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
81
|
+
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
82
|
+
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
83
|
+
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
84
|
+
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
|
85
|
+
|
|
86
|
+
## Support
|
|
87
|
+
|
|
88
|
+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
89
|
+
|
|
90
|
+
## Stay in touch
|
|
91
|
+
|
|
92
|
+
- Author - [Kamil Myลliwiec](https://twitter.com/kammysliwiec)
|
|
93
|
+
- Website - [https://nestjs.com](https://nestjs.com/)
|
|
94
|
+
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import eslint from '@eslint/js';
|
|
3
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import tseslint from 'typescript-eslint';
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
{
|
|
9
|
+
ignores: ['eslint.config.mjs'],
|
|
10
|
+
},
|
|
11
|
+
eslint.configs.recommended,
|
|
12
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
13
|
+
eslintPluginPrettierRecommended,
|
|
14
|
+
{
|
|
15
|
+
languageOptions: {
|
|
16
|
+
globals: {
|
|
17
|
+
...globals.node,
|
|
18
|
+
...globals.jest,
|
|
19
|
+
},
|
|
20
|
+
sourceType: 'commonjs',
|
|
21
|
+
parserOptions: {
|
|
22
|
+
projectService: true,
|
|
23
|
+
tsconfigRootDir: import.meta.dirname,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
rules: {
|
|
29
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
30
|
+
'@typescript-eslint/no-floating-promises': 'warn',
|
|
31
|
+
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
32
|
+
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nestjs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "",
|
|
6
|
+
"private": true,
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "nest build",
|
|
10
|
+
"start": "nest start",
|
|
11
|
+
"start:dev": "nest start --watch",
|
|
12
|
+
"start:debug": "nest start --debug --watch",
|
|
13
|
+
"start:prod": "node dist/main",
|
|
14
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
15
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\""
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@nestjs/common": "^11.0.1",
|
|
19
|
+
"@nestjs/core": "^11.0.1",
|
|
20
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
21
|
+
"@nestjs/config": "^4.0.1",
|
|
22
|
+
"@nestjs/jwt": "^10.2.3",
|
|
23
|
+
"@nestjs/passport": "^11.0.6",
|
|
24
|
+
"@nestjs/swagger": "^11.2.6",
|
|
25
|
+
"passport": "^0.7.0",
|
|
26
|
+
"passport-jwt": "^4.0.1",
|
|
27
|
+
"bcrypt": "^5.1.1",
|
|
28
|
+
"class-transformer": "^0.5.1",
|
|
29
|
+
"class-validator": "^0.14.1",
|
|
30
|
+
"pg": "^8.13.1",
|
|
31
|
+
"typeorm": "^0.3.20",
|
|
32
|
+
"uuid": "^11.0.3",
|
|
33
|
+
"reflect-metadata": "^0.2.2",
|
|
34
|
+
"rxjs": "^7.8.1"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
38
|
+
"@eslint/js": "^9.18.0",
|
|
39
|
+
"@nestjs/cli": "^11.0.0",
|
|
40
|
+
"@nestjs/schematics": "^11.0.0",
|
|
41
|
+
"@nestjs/testing": "^11.0.1",
|
|
42
|
+
"@types/express": "^5.0.0",
|
|
43
|
+
"@types/jest": "^30.0.0",
|
|
44
|
+
"@types/node": "^22.10.7",
|
|
45
|
+
"@types/supertest": "^6.0.2",
|
|
46
|
+
"eslint": "^9.18.0",
|
|
47
|
+
"eslint-config-prettier": "^10.0.1",
|
|
48
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
49
|
+
"globals": "^16.0.0",
|
|
50
|
+
"jest": "^30.0.0",
|
|
51
|
+
"prettier": "^3.4.2",
|
|
52
|
+
"source-map-support": "^0.5.21",
|
|
53
|
+
"supertest": "^7.0.0",
|
|
54
|
+
"ts-jest": "^29.2.5",
|
|
55
|
+
"ts-loader": "^9.5.2",
|
|
56
|
+
"ts-node": "^10.9.2",
|
|
57
|
+
"tsconfig-paths": "^4.2.0",
|
|
58
|
+
"typescript": "^5.7.3",
|
|
59
|
+
"typescript-eslint": "^8.20.0"
|
|
60
|
+
},
|
|
61
|
+
"jest": {
|
|
62
|
+
"moduleFileExtensions": [
|
|
63
|
+
"js",
|
|
64
|
+
"json",
|
|
65
|
+
"ts"
|
|
66
|
+
],
|
|
67
|
+
"rootDir": "src",
|
|
68
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
69
|
+
"transform": {
|
|
70
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
71
|
+
},
|
|
72
|
+
"collectCoverageFrom": [
|
|
73
|
+
"**/*.(t|j)s"
|
|
74
|
+
],
|
|
75
|
+
"coverageDirectory": "../coverage",
|
|
76
|
+
"testEnvironment": "node"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { AppController } from './app.controller';
|
|
3
|
+
import { AppService } from './app.service';
|
|
4
|
+
|
|
5
|
+
describe('AppController', () => {
|
|
6
|
+
let appController: AppController;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [AppController],
|
|
11
|
+
providers: [AppService],
|
|
12
|
+
}).compile();
|
|
13
|
+
|
|
14
|
+
appController = app.get<AppController>(AppController);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('root', () => {
|
|
18
|
+
it('should return "Hello World!"', () => {
|
|
19
|
+
expect(appController.getHello()).toBe('Hello World!');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { AppService } from './app.service';
|
|
3
|
+
|
|
4
|
+
@Controller()
|
|
5
|
+
export class AppController {
|
|
6
|
+
constructor(private readonly appService: AppService) {}
|
|
7
|
+
|
|
8
|
+
@Get()
|
|
9
|
+
getHello(): string {
|
|
10
|
+
return this.appService.getHello();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
3
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
4
|
+
import { AppController } from './app.controller';
|
|
5
|
+
import { AppService } from './app.service';
|
|
6
|
+
import { User } from './user/user.entity';
|
|
7
|
+
import { UserModule } from './user/user.module';
|
|
8
|
+
|
|
9
|
+
@Module({
|
|
10
|
+
imports: [
|
|
11
|
+
ConfigModule.forRoot({ isGlobal: true }),
|
|
12
|
+
TypeOrmModule.forRootAsync({
|
|
13
|
+
imports: [ConfigModule],
|
|
14
|
+
useFactory: async (configService: ConfigService) => ({
|
|
15
|
+
type: 'postgres',
|
|
16
|
+
host: configService.get('DATABASE_HOST', 'localhost'),
|
|
17
|
+
port: configService.get('DATABASE_PORT', 5432),
|
|
18
|
+
username: configService.get('DATABASE_USERNAME', 'postgres'),
|
|
19
|
+
password: configService.get('DATABASE_PASSWORD', 'postgres'),
|
|
20
|
+
database: configService.get('DATABASE_NAME', 'nestjs_db'),
|
|
21
|
+
entities: [User],
|
|
22
|
+
synchronize: configService.get('DATABASE_SYNCHRONIZE', 'false') === 'true',
|
|
23
|
+
logging: configService.get('DATABASE_LOGGING', 'false') === 'true',
|
|
24
|
+
}),
|
|
25
|
+
inject: [ConfigService],
|
|
26
|
+
}),
|
|
27
|
+
UserModule,
|
|
28
|
+
],
|
|
29
|
+
controllers: [AppController],
|
|
30
|
+
providers: [AppService],
|
|
31
|
+
})
|
|
32
|
+
export class AppModule {
|
|
33
|
+
constructor(private dataSource: any) {}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NestFactory } from '@nestjs/core';
|
|
2
|
+
import { ValidationPipe } from '@nestjs/common';
|
|
3
|
+
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|
4
|
+
import { AppModule } from './app.module';
|
|
5
|
+
|
|
6
|
+
async function bootstrap() {
|
|
7
|
+
const app = await NestFactory.create(AppModule);
|
|
8
|
+
|
|
9
|
+
app.useGlobalPipes(
|
|
10
|
+
new ValidationPipe({
|
|
11
|
+
whitelist: true,
|
|
12
|
+
forbidNonWhitelisted: true,
|
|
13
|
+
transform: true,
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const config = new DocumentBuilder()
|
|
18
|
+
.setTitle('NestJS API')
|
|
19
|
+
.setDescription('NestJS backend API with TypeORM and PostgreSQL')
|
|
20
|
+
.setVersion('1.0')
|
|
21
|
+
.addTag('users')
|
|
22
|
+
.addBearerAuth()
|
|
23
|
+
.build();
|
|
24
|
+
|
|
25
|
+
SwaggerModule.setup('api', app, config);
|
|
26
|
+
|
|
27
|
+
const port = process.env.PORT || 3000;
|
|
28
|
+
await app.listen(port);
|
|
29
|
+
|
|
30
|
+
console.log(`๐ Application is running on: http://localhost:${port}`);
|
|
31
|
+
console.log(`๐ Swagger documentation available at: http://localhost:${port}/api`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
bootstrap();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IsEmail, IsString, IsNotEmpty, IsOptional, MinLength, MaxLength, IsBoolean } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class CreateUserDto {
|
|
4
|
+
@IsEmail()
|
|
5
|
+
@IsNotEmpty()
|
|
6
|
+
email: string;
|
|
7
|
+
|
|
8
|
+
@IsString()
|
|
9
|
+
@MinLength(3)
|
|
10
|
+
@MaxLength(100)
|
|
11
|
+
@IsNotEmpty()
|
|
12
|
+
username: string;
|
|
13
|
+
|
|
14
|
+
@IsString()
|
|
15
|
+
@MinLength(1)
|
|
16
|
+
@MaxLength(255)
|
|
17
|
+
@IsNotEmpty()
|
|
18
|
+
fullName: string;
|
|
19
|
+
|
|
20
|
+
@IsString()
|
|
21
|
+
@MinLength(6)
|
|
22
|
+
@MaxLength(255)
|
|
23
|
+
@IsNotEmpty()
|
|
24
|
+
password: string;
|
|
25
|
+
|
|
26
|
+
@IsOptional()
|
|
27
|
+
@IsString()
|
|
28
|
+
@MaxLength(1000)
|
|
29
|
+
avatarUrl?: string;
|
|
30
|
+
|
|
31
|
+
@IsOptional()
|
|
32
|
+
@IsString()
|
|
33
|
+
@MaxLength(1000)
|
|
34
|
+
bio?: string;
|
|
35
|
+
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@IsString()
|
|
38
|
+
@MaxLength(50)
|
|
39
|
+
role?: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IsEmail, IsString, IsOptional, MinLength, MaxLength, IsBoolean } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class UpdateUserDto {
|
|
4
|
+
@IsOptional()
|
|
5
|
+
@IsEmail()
|
|
6
|
+
email?: string;
|
|
7
|
+
|
|
8
|
+
@IsOptional()
|
|
9
|
+
@IsString()
|
|
10
|
+
@MinLength(3)
|
|
11
|
+
@MaxLength(100)
|
|
12
|
+
username?: string;
|
|
13
|
+
|
|
14
|
+
@IsOptional()
|
|
15
|
+
@IsString()
|
|
16
|
+
@MinLength(1)
|
|
17
|
+
@MaxLength(255)
|
|
18
|
+
fullName?: string;
|
|
19
|
+
|
|
20
|
+
@IsOptional()
|
|
21
|
+
@IsString()
|
|
22
|
+
@MinLength(6)
|
|
23
|
+
@MaxLength(255)
|
|
24
|
+
password?: string;
|
|
25
|
+
|
|
26
|
+
@IsOptional()
|
|
27
|
+
@IsString()
|
|
28
|
+
@MaxLength(1000)
|
|
29
|
+
avatarUrl?: string;
|
|
30
|
+
|
|
31
|
+
@IsOptional()
|
|
32
|
+
@IsString()
|
|
33
|
+
@MaxLength(1000)
|
|
34
|
+
bio?: string;
|
|
35
|
+
|
|
36
|
+
@IsOptional()
|
|
37
|
+
@IsString()
|
|
38
|
+
@MaxLength(50)
|
|
39
|
+
role?: string;
|
|
40
|
+
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@IsBoolean()
|
|
43
|
+
isActive?: boolean;
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { UsersController } from './users.controller';
|
|
3
|
+
import { UsersService } from './users.service';
|
|
4
|
+
|
|
5
|
+
describe('UsersController', () => {
|
|
6
|
+
let controller: UsersController;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [UsersController],
|
|
11
|
+
providers: [UsersService],
|
|
12
|
+
}).compile();
|
|
13
|
+
|
|
14
|
+
controller = module.get<UsersController>(UsersController);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should be defined', () => {
|
|
18
|
+
expect(controller).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Controller, Get, Post, Put, Delete, Param, Body, HttpCode, HttpStatus, HttpException, ParseIntPipe } from '@nestjs/common';
|
|
2
|
+
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth } from '@nestjs/swagger';
|
|
3
|
+
import { UserService } from './user.service';
|
|
4
|
+
import { CreateUserDto } from './dto/create-user.dto';
|
|
5
|
+
import { UpdateUserDto } from './dto/update-user.dto';
|
|
6
|
+
|
|
7
|
+
@ApiTags('users')
|
|
8
|
+
@Controller('users')
|
|
9
|
+
export class UserController {
|
|
10
|
+
constructor(private readonly userService: UserService) {}
|
|
11
|
+
|
|
12
|
+
@Get()
|
|
13
|
+
@ApiOperation({ summary: 'Get all users' })
|
|
14
|
+
@ApiResponse({ status: 200, description: 'Returns all active users' })
|
|
15
|
+
async findAll() {
|
|
16
|
+
return this.userService.findAll();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Get(':id')
|
|
20
|
+
@ApiOperation({ summary: 'Get user by ID' })
|
|
21
|
+
@ApiResponse({ status: 200, description: 'Returns user by ID' })
|
|
22
|
+
async findOne(@Param('id', ParseIntPipe) id: number) {
|
|
23
|
+
if (id <= 0) {
|
|
24
|
+
throw new HttpException('Invalid user ID', HttpStatus.BAD_REQUEST);
|
|
25
|
+
}
|
|
26
|
+
return this.userService.findOne(id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Get('search/:keyword')
|
|
30
|
+
@ApiOperation({ summary: 'Search users' })
|
|
31
|
+
@ApiResponse({ status: 200, description: 'Returns users matching the keyword' })
|
|
32
|
+
async search(@Param('keyword') keyword: string) {
|
|
33
|
+
return this.userService.search(keyword);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Post()
|
|
37
|
+
@HttpCode(HttpStatus.CREATED)
|
|
38
|
+
@ApiOperation({ summary: 'Create a new user' })
|
|
39
|
+
@ApiResponse({ status: 201, description: 'User created successfully' })
|
|
40
|
+
async create(@Body() createUserDto: CreateUserDto) {
|
|
41
|
+
return this.userService.create(createUserDto);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Put(':id')
|
|
45
|
+
@ApiOperation({ summary: 'Update a user' })
|
|
46
|
+
@ApiResponse({ status: 200, description: 'User updated successfully' })
|
|
47
|
+
async update(@Param('id', ParseIntPipe) id: number, @Body() updateUserDto: UpdateUserDto) {
|
|
48
|
+
if (id <= 0) {
|
|
49
|
+
throw new HttpException('Invalid user ID', HttpStatus.BAD_REQUEST);
|
|
50
|
+
}
|
|
51
|
+
return this.userService.update(id, updateUserDto);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Delete(':id')
|
|
55
|
+
@HttpCode(HttpStatus.NO_CONTENT)
|
|
56
|
+
@ApiOperation({ summary: 'Delete a user' })
|
|
57
|
+
@ApiResponse({ status: 204, description: 'User deleted successfully' })
|
|
58
|
+
async remove(@Param('id', ParseIntPipe) id: number) {
|
|
59
|
+
if (id <= 0) {
|
|
60
|
+
throw new HttpException('Invalid user ID', HttpStatus.BAD_REQUEST);
|
|
61
|
+
}
|
|
62
|
+
return this.userService.remove(id);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Post(':id/soft-delete')
|
|
66
|
+
@ApiOperation({ summary: 'Soft delete a user' })
|
|
67
|
+
@ApiResponse({ status: 200, description: 'User soft deleted successfully' })
|
|
68
|
+
async softDelete(@Param('id', ParseIntPipe) id: number) {
|
|
69
|
+
if (id <= 0) {
|
|
70
|
+
throw new HttpException('Invalid user ID', HttpStatus.BAD_REQUEST);
|
|
71
|
+
}
|
|
72
|
+
return this.userService.softDelete(id);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity()
|
|
4
|
+
export class User {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({ unique: true })
|
|
9
|
+
email: string;
|
|
10
|
+
|
|
11
|
+
@Column({ unique: true })
|
|
12
|
+
username: string;
|
|
13
|
+
|
|
14
|
+
@Column()
|
|
15
|
+
fullName: string;
|
|
16
|
+
|
|
17
|
+
@Column()
|
|
18
|
+
password: string;
|
|
19
|
+
|
|
20
|
+
@Column({ nullable: true })
|
|
21
|
+
avatarUrl: string;
|
|
22
|
+
|
|
23
|
+
@Column({ nullable: true, type: 'text' })
|
|
24
|
+
bio: string;
|
|
25
|
+
|
|
26
|
+
@Column({ default: 'user' })
|
|
27
|
+
role: string;
|
|
28
|
+
|
|
29
|
+
@Column({ default: true })
|
|
30
|
+
isActive: boolean;
|
|
31
|
+
|
|
32
|
+
@CreateDateColumn({ name: 'created_at' })
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
|
|
35
|
+
@UpdateDateColumn({ name: 'updated_at' })
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
3
|
+
import { UserController } from './user.controller';
|
|
4
|
+
import { UserService } from './user.service';
|
|
5
|
+
import { User } from './user.entity';
|
|
6
|
+
|
|
7
|
+
@Module({
|
|
8
|
+
imports: [TypeOrmModule.forFeature([User])],
|
|
9
|
+
controllers: [UserController],
|
|
10
|
+
providers: [UserService],
|
|
11
|
+
exports: [UserService],
|
|
12
|
+
})
|
|
13
|
+
export class UserModule {}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { UsersService } from './users.service';
|
|
3
|
+
|
|
4
|
+
describe('UsersService', () => {
|
|
5
|
+
let service: UsersService;
|
|
6
|
+
|
|
7
|
+
beforeEach(async () => {
|
|
8
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
9
|
+
providers: [UsersService],
|
|
10
|
+
}).compile();
|
|
11
|
+
|
|
12
|
+
service = module.get<UsersService>(UsersService);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should be defined', () => {
|
|
16
|
+
expect(service).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Injectable, NotFoundException, ConflictException } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { Repository, Like } from 'typeorm';
|
|
4
|
+
import { User } from './user.entity';
|
|
5
|
+
import { CreateUserDto } from './dto/create-user.dto';
|
|
6
|
+
import { UpdateUserDto } from './dto/update-user.dto';
|
|
7
|
+
import * as bcrypt from 'bcrypt';
|
|
8
|
+
import { instanceToPlain, plainToInstance } from 'class-transformer';
|
|
9
|
+
|
|
10
|
+
const SALT_ROUNDS = 10;
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class UserService {
|
|
14
|
+
constructor(
|
|
15
|
+
@InjectRepository(User)
|
|
16
|
+
private readonly userRepository: Repository<User>,
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
async findAll() {
|
|
20
|
+
return this.userRepository.find({
|
|
21
|
+
where: { isActive: true },
|
|
22
|
+
order: { createdAt: 'DESC' },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async findOne(id: number) {
|
|
27
|
+
const user = await this.userRepository.findOne({ where: { id } });
|
|
28
|
+
if (!user) {
|
|
29
|
+
throw new NotFoundException('User not found');
|
|
30
|
+
}
|
|
31
|
+
return user;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async findByEmail(email: string) {
|
|
35
|
+
return this.userRepository.findOne({ where: { email } });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async findByUsername(username: string) {
|
|
39
|
+
return this.userRepository.findOne({ where: { username } });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async create(createUserDto: CreateUserDto) {
|
|
43
|
+
const existingEmail = await this.findByEmail(createUserDto.email);
|
|
44
|
+
if (existingEmail) {
|
|
45
|
+
throw new ConflictException('User with this email already exists');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const existingUsername = await this.findByUsername(createUserDto.username);
|
|
49
|
+
if (existingUsername) {
|
|
50
|
+
throw new ConflictException('Username already taken');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const hashedPassword = await bcrypt.hash(createUserDto.password, SALT_ROUNDS);
|
|
54
|
+
|
|
55
|
+
const user = this.userRepository.create({
|
|
56
|
+
...createUserDto,
|
|
57
|
+
password: hashedPassword,
|
|
58
|
+
avatarUrl: createUserDto.avatarUrl || null,
|
|
59
|
+
bio: createUserDto.bio || null,
|
|
60
|
+
role: createUserDto.role || 'user',
|
|
61
|
+
isActive: true,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return this.userRepository.save(user);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async update(id: number, updateUserDto: UpdateUserDto) {
|
|
68
|
+
const user = await this.findOne(id);
|
|
69
|
+
|
|
70
|
+
if (updateUserDto.email) {
|
|
71
|
+
const emailUser = await this.findByEmail(updateUserDto.email);
|
|
72
|
+
if (emailUser && emailUser.id !== id) {
|
|
73
|
+
throw new ConflictException('Email already in use');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (updateUserDto.username) {
|
|
78
|
+
const usernameUser = await this.findByUsername(updateUserDto.username);
|
|
79
|
+
if (usernameUser && usernameUser.id !== id) {
|
|
80
|
+
throw new ConflictException('Username already taken');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const updateData: Partial<User> = {};
|
|
85
|
+
|
|
86
|
+
if (updateUserDto.email !== undefined) updateData.email = updateUserDto.email;
|
|
87
|
+
if (updateUserDto.username !== undefined) updateData.username = updateUserDto.username;
|
|
88
|
+
if (updateUserDto.fullName !== undefined) updateData.fullName = updateUserDto.fullName;
|
|
89
|
+
if (updateUserDto.password !== undefined) {
|
|
90
|
+
updateData.password = await bcrypt.hash(updateUserDto.password, SALT_ROUNDS);
|
|
91
|
+
}
|
|
92
|
+
if (updateUserDto.avatarUrl !== undefined) updateData.avatarUrl = updateUserDto.avatarUrl;
|
|
93
|
+
if (updateUserDto.bio !== undefined) updateData.bio = updateUserDto.bio;
|
|
94
|
+
if (updateUserDto.role !== undefined) updateData.role = updateUserDto.role;
|
|
95
|
+
if (updateUserDto.isActive !== undefined) updateData.isActive = updateUserDto.isActive;
|
|
96
|
+
|
|
97
|
+
Object.assign(user, updateData);
|
|
98
|
+
return this.userRepository.save(user);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async remove(id: number) {
|
|
102
|
+
const user = await this.findOne(id);
|
|
103
|
+
await this.userRepository.remove(user);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async softDelete(id: number) {
|
|
107
|
+
const user = await this.findOne(id);
|
|
108
|
+
user.isActive = false;
|
|
109
|
+
return this.userRepository.save(user);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async search(keyword: string) {
|
|
113
|
+
return this.userRepository.find({
|
|
114
|
+
where: [
|
|
115
|
+
{ email: Like(`%${keyword}%`), isActive: true },
|
|
116
|
+
{ username: Like(`%${keyword}%`), isActive: true },
|
|
117
|
+
{ fullName: Like(`%${keyword}%`), isActive: true },
|
|
118
|
+
],
|
|
119
|
+
order: { createdAt: 'DESC' },
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { INestApplication } from '@nestjs/common';
|
|
3
|
+
import request from 'supertest';
|
|
4
|
+
import { App } from 'supertest/types';
|
|
5
|
+
import { AppModule } from './../src/app.module';
|
|
6
|
+
|
|
7
|
+
describe('AppController (e2e)', () => {
|
|
8
|
+
let app: INestApplication<App>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
12
|
+
imports: [AppModule],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
app = moduleFixture.createNestApplication();
|
|
16
|
+
await app.init();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('/ (GET)', () => {
|
|
20
|
+
return request(app.getHttpServer())
|
|
21
|
+
.get('/')
|
|
22
|
+
.expect(200)
|
|
23
|
+
.expect('Hello World!');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "nodenext",
|
|
4
|
+
"moduleResolution": "nodenext",
|
|
5
|
+
"resolvePackageJsonExports": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"removeComments": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"target": "ES2023",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"outDir": "./dist",
|
|
16
|
+
"baseUrl": "./",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strictNullChecks": true,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"noImplicitAny": false,
|
|
22
|
+
"strictBindCallApply": false,
|
|
23
|
+
"noFallthroughCasesInSwitch": false
|
|
24
|
+
}
|
|
25
|
+
}
|