nestforge-generator 0.6.0 → 0.6.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/dist/generator.js +3 -2
- package/dist/generator.js.map +1 -1
- package/package.json +1 -1
- package/templates/drizzle/eslint.config.mjs +47 -0
- package/templates/drizzle/src/app.module.ts +12 -5
- package/templates/drizzle/src/auth/auth.controller.ts +4 -1
- package/templates/drizzle/src/auth/auth.service.ts +15 -5
- package/templates/drizzle/src/database/schema/postgres.schema.ts +3 -1
- package/templates/drizzle/src/main.ts +3 -1
- package/templates/prisma/eslint.config.mjs +47 -0
- package/templates/prisma/src/app.module.ts +12 -5
- package/templates/prisma/src/auth/auth.controller.ts +4 -1
- package/templates/prisma/src/auth/auth.service.ts +7 -2
- package/templates/typeorm/eslint.config.mjs +47 -0
- package/templates/typeorm/src/app.module.ts +12 -5
- package/templates/typeorm/src/auth/auth.controller.ts +4 -1
- package/templates/typeorm/src/auth/auth.service.ts +13 -5
package/dist/generator.js
CHANGED
|
@@ -66,7 +66,7 @@ export async function generateProject(options) {
|
|
|
66
66
|
throw new Error(`The "${projectName}" directory already exists. Choose another name or remove the directory.`);
|
|
67
67
|
}
|
|
68
68
|
await fs.copy(templateDir, targetDir);
|
|
69
|
-
const enabledFeatures = buildEnabledFeatures(features, accessControl, database, authStrategy);
|
|
69
|
+
const enabledFeatures = buildEnabledFeatures(features, accessControl, database, authStrategy, language);
|
|
70
70
|
await applyDockerToggle(targetDir, enabledFeatures);
|
|
71
71
|
if (orm !== 'none') {
|
|
72
72
|
await applyDatabaseConfig(targetDir, database);
|
|
@@ -84,8 +84,9 @@ export async function generateProject(options) {
|
|
|
84
84
|
}
|
|
85
85
|
return targetDir;
|
|
86
86
|
}
|
|
87
|
-
function buildEnabledFeatures(features, accessControl, database, authStrategy) {
|
|
87
|
+
function buildEnabledFeatures(features, accessControl, database, authStrategy, language) {
|
|
88
88
|
const enabled = new Set(features);
|
|
89
|
+
enabled.add(`language:${language}`);
|
|
89
90
|
if (accessControl) {
|
|
90
91
|
enabled.add('rbac');
|
|
91
92
|
}
|
package/dist/generator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACvE,MAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAE9E,2EAA2E;AAC3E,MAAM,gBAAgB,GAAG;IACrB,QAAQ;IACR,SAAS;IACT,SAAS;IACT,MAAM;CACT,CAAC;AACF,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAC3D,MAAM,qBAAqB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACzE,MAAM,2BAA2B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IACvB,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAEhD,MAAM,WAAW,GAAG;QAChB,WAAW;QACX,iBAAiB;KACpB,CAAC;IAEF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CACxB,SAAS,EACT,UAAU,CACb,CAAC;QAEF,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACrC,SAAS;QACb,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAC5B,UAAU,EACV,OAAO,CACV,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAC1B,eAAe,EACf,KAAK,WAAW,EAAE,CACrB,CAAC;QAEF,MAAM,EAAE,CAAC,SAAS,CACd,UAAU,EACV,OAAO,EACP,OAAO,CACV,CAAC;IACN,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,SAAiB;IAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAE7C,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO;IACX,CAAC;IAED,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import prettier from 'eslint-config-prettier';
|
|
2
|
+
// nestforge:feature:language:typescript
|
|
3
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import tsParser from '@typescript-eslint/parser';
|
|
5
|
+
// nestforge:feature:language:typescript:end
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
ignores: ['dist/', 'coverage/', 'node_modules/'],
|
|
10
|
+
},
|
|
11
|
+
// nestforge:feature:language:typescript
|
|
12
|
+
{
|
|
13
|
+
files: ['src/**/*.ts', 'test/**/*.ts'],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parser: tsParser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
sourceType: 'commonjs',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: {
|
|
22
|
+
'@typescript-eslint': tseslint,
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
...tseslint.configs.recommended.rules,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
files: ['src/**/*.spec.ts', 'test/**/*.ts'],
|
|
30
|
+
rules: {
|
|
31
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// nestforge:feature:language:typescript:end
|
|
35
|
+
// nestforge:feature:language:javascript
|
|
36
|
+
{
|
|
37
|
+
files: ['src/**/*.js', 'test/**/*.js'],
|
|
38
|
+
languageOptions: {
|
|
39
|
+
parserOptions: {
|
|
40
|
+
ecmaVersion: 'latest',
|
|
41
|
+
sourceType: 'commonjs',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
// nestforge:feature:language:javascript:end
|
|
46
|
+
prettier,
|
|
47
|
+
];
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:auth:session
|
|
3
|
+
import { MiddlewareConsumer, NestModule } from '@nestjs/common';
|
|
4
|
+
// nestforge:feature:auth:session:end
|
|
2
5
|
import { ConfigModule } from '@nestjs/config';
|
|
3
6
|
import { ThrottlerModule } from '@nestjs/throttler';
|
|
4
7
|
// nestforge:feature:redis
|
|
@@ -61,12 +64,16 @@ import { validateEnv } from './config/env.validation';
|
|
|
61
64
|
MetricsModule,
|
|
62
65
|
],
|
|
63
66
|
})
|
|
64
|
-
export class AppModule
|
|
67
|
+
export class AppModule
|
|
68
|
+
// nestforge:feature:auth:session
|
|
69
|
+
implements NestModule
|
|
70
|
+
// nestforge:feature:auth:session:end
|
|
71
|
+
{
|
|
72
|
+
// nestforge:feature:auth:session
|
|
65
73
|
configure(consumer: MiddlewareConsumer) {
|
|
66
|
-
// nestforge:feature:auth:session
|
|
67
74
|
if (process.env.ENABLE_CSRF === 'true') {
|
|
68
75
|
consumer.apply(CsrfMiddleware).forRoutes('*');
|
|
69
76
|
}
|
|
70
|
-
// nestforge:feature:auth:session:end
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
// nestforge:feature:auth:session:end
|
|
79
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Body, Controller, Get, HttpCode, HttpStatus, Post,
|
|
1
|
+
import { Body, Controller, Get, HttpCode, HttpStatus, Post, Req, UseGuards } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:redis,auth:password
|
|
3
|
+
import { Query } from '@nestjs/common';
|
|
4
|
+
// nestforge:feature:redis,auth:password:end
|
|
2
5
|
// nestforge:feature:swagger
|
|
3
6
|
import { ApiExcludeEndpoint, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
4
7
|
// nestforge:feature:swagger:end
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:auth:password
|
|
1
3
|
import {
|
|
2
4
|
ConflictException,
|
|
3
|
-
Injectable,
|
|
4
5
|
UnauthorizedException,
|
|
5
6
|
} from '@nestjs/common';
|
|
7
|
+
// nestforge:feature:auth:password:end
|
|
6
8
|
import {
|
|
7
9
|
and,
|
|
8
10
|
eq,
|
|
9
|
-
isNull,
|
|
10
11
|
} from 'drizzle-orm';
|
|
12
|
+
// nestforge:feature:redis,auth:password
|
|
13
|
+
import { isNull } from 'drizzle-orm';
|
|
14
|
+
// nestforge:feature:redis,auth:password:end
|
|
15
|
+
// nestforge:feature:auth:password
|
|
11
16
|
import * as bcrypt from 'bcryptjs';
|
|
17
|
+
// nestforge:feature:auth:password:end
|
|
18
|
+
import { randomUUID } from 'node:crypto';
|
|
19
|
+
// nestforge:feature:redis,auth:password
|
|
12
20
|
import {
|
|
13
21
|
createHash,
|
|
14
22
|
randomBytes,
|
|
15
|
-
randomUUID,
|
|
16
23
|
} from 'node:crypto';
|
|
24
|
+
// nestforge:feature:redis,auth:password:end
|
|
17
25
|
import { Role } from '../common/constants/role.enum';
|
|
18
26
|
import { InjectDatabase } from '../database/database.decorators';
|
|
19
27
|
import type { DrizzleDatabase } from '../database/database.types';
|
|
@@ -22,9 +30,9 @@ import {
|
|
|
22
30
|
users,
|
|
23
31
|
} from '../database/schema';
|
|
24
32
|
|
|
25
|
-
// nestforge:feature:auth:token
|
|
33
|
+
// nestforge:feature:redis,auth:password,auth:token
|
|
26
34
|
import { refreshTokens } from '../database/schema';
|
|
27
|
-
// nestforge:feature:auth:token:end
|
|
35
|
+
// nestforge:feature:redis,auth:password,auth:token:end
|
|
28
36
|
|
|
29
37
|
// nestforge:feature:redis,auth:password
|
|
30
38
|
import { MailService } from '../mail/mail.service';
|
|
@@ -623,9 +631,11 @@ export class AuthService {
|
|
|
623
631
|
};
|
|
624
632
|
}
|
|
625
633
|
|
|
634
|
+
// nestforge:feature:redis,auth:password
|
|
626
635
|
private hashToken(token: string): string {
|
|
627
636
|
return createHash('sha256')
|
|
628
637
|
.update(token)
|
|
629
638
|
.digest('hex');
|
|
630
639
|
}
|
|
640
|
+
// nestforge:feature:redis,auth:password:end
|
|
631
641
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import prettier from 'eslint-config-prettier';
|
|
2
|
+
// nestforge:feature:language:typescript
|
|
3
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import tsParser from '@typescript-eslint/parser';
|
|
5
|
+
// nestforge:feature:language:typescript:end
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
ignores: ['dist/', 'coverage/', 'node_modules/'],
|
|
10
|
+
},
|
|
11
|
+
// nestforge:feature:language:typescript
|
|
12
|
+
{
|
|
13
|
+
files: ['src/**/*.ts', 'test/**/*.ts'],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parser: tsParser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
sourceType: 'commonjs',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: {
|
|
22
|
+
'@typescript-eslint': tseslint,
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
...tseslint.configs.recommended.rules,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
files: ['src/**/*.spec.ts', 'test/**/*.ts'],
|
|
30
|
+
rules: {
|
|
31
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// nestforge:feature:language:typescript:end
|
|
35
|
+
// nestforge:feature:language:javascript
|
|
36
|
+
{
|
|
37
|
+
files: ['src/**/*.js', 'test/**/*.js'],
|
|
38
|
+
languageOptions: {
|
|
39
|
+
parserOptions: {
|
|
40
|
+
ecmaVersion: 'latest',
|
|
41
|
+
sourceType: 'commonjs',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
// nestforge:feature:language:javascript:end
|
|
46
|
+
prettier,
|
|
47
|
+
];
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:auth:session
|
|
3
|
+
import { MiddlewareConsumer, NestModule } from '@nestjs/common';
|
|
4
|
+
// nestforge:feature:auth:session:end
|
|
2
5
|
import { ConfigModule } from '@nestjs/config';
|
|
3
6
|
import { ThrottlerModule } from '@nestjs/throttler';
|
|
4
7
|
// nestforge:feature:redis
|
|
@@ -61,12 +64,16 @@ import { validateEnv } from './config/env.validation';
|
|
|
61
64
|
MetricsModule,
|
|
62
65
|
],
|
|
63
66
|
})
|
|
64
|
-
export class AppModule
|
|
67
|
+
export class AppModule
|
|
68
|
+
// nestforge:feature:auth:session
|
|
69
|
+
implements NestModule
|
|
70
|
+
// nestforge:feature:auth:session:end
|
|
71
|
+
{
|
|
72
|
+
// nestforge:feature:auth:session
|
|
65
73
|
configure(consumer: MiddlewareConsumer) {
|
|
66
|
-
// nestforge:feature:auth:session
|
|
67
74
|
if (process.env.ENABLE_CSRF === 'true') {
|
|
68
75
|
consumer.apply(CsrfMiddleware).forRoutes('*');
|
|
69
76
|
}
|
|
70
|
-
// nestforge:feature:auth:session:end
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
// nestforge:feature:auth:session:end
|
|
79
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Body, Controller, Get, HttpCode, HttpStatus, Post,
|
|
1
|
+
import { Body, Controller, Get, HttpCode, HttpStatus, Post, Req, UseGuards } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:redis,auth:password
|
|
3
|
+
import { Query } from '@nestjs/common';
|
|
4
|
+
// nestforge:feature:redis,auth:password:end
|
|
2
5
|
// nestforge:feature:swagger
|
|
3
6
|
import { ApiExcludeEndpoint, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
4
7
|
// nestforge:feature:swagger:end
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:auth:password
|
|
1
3
|
import {
|
|
2
4
|
ConflictException,
|
|
3
|
-
Injectable,
|
|
4
5
|
UnauthorizedException,
|
|
5
6
|
} from '@nestjs/common';
|
|
6
7
|
import * as bcrypt from 'bcryptjs';
|
|
8
|
+
// nestforge:feature:auth:password:end
|
|
9
|
+
// nestforge:feature:redis,auth:password
|
|
7
10
|
import { createHash, randomBytes } from 'crypto';
|
|
11
|
+
// nestforge:feature:redis,auth:password:end
|
|
8
12
|
import { PrismaService } from '../database/prisma.service';
|
|
9
13
|
// nestforge:feature:redis,auth:password
|
|
10
14
|
import { MailService } from '../mail/mail.service';
|
|
@@ -217,8 +221,9 @@ export class AuthService {
|
|
|
217
221
|
role: user.role,
|
|
218
222
|
};
|
|
219
223
|
}
|
|
220
|
-
|
|
224
|
+
// nestforge:feature:redis,auth:password
|
|
221
225
|
private hashToken(token: string): string {
|
|
222
226
|
return createHash('sha256').update(token).digest('hex');
|
|
223
227
|
}
|
|
228
|
+
// nestforge:feature:redis,auth:password:end
|
|
224
229
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import prettier from 'eslint-config-prettier';
|
|
2
|
+
// nestforge:feature:language:typescript
|
|
3
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import tsParser from '@typescript-eslint/parser';
|
|
5
|
+
// nestforge:feature:language:typescript:end
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
ignores: ['dist/', 'coverage/', 'node_modules/'],
|
|
10
|
+
},
|
|
11
|
+
// nestforge:feature:language:typescript
|
|
12
|
+
{
|
|
13
|
+
files: ['src/**/*.ts', 'test/**/*.ts'],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parser: tsParser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
sourceType: 'commonjs',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: {
|
|
22
|
+
'@typescript-eslint': tseslint,
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
...tseslint.configs.recommended.rules,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
files: ['src/**/*.spec.ts', 'test/**/*.ts'],
|
|
30
|
+
rules: {
|
|
31
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// nestforge:feature:language:typescript:end
|
|
35
|
+
// nestforge:feature:language:javascript
|
|
36
|
+
{
|
|
37
|
+
files: ['src/**/*.js', 'test/**/*.js'],
|
|
38
|
+
languageOptions: {
|
|
39
|
+
parserOptions: {
|
|
40
|
+
ecmaVersion: 'latest',
|
|
41
|
+
sourceType: 'commonjs',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
// nestforge:feature:language:javascript:end
|
|
46
|
+
prettier,
|
|
47
|
+
];
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:auth:session
|
|
3
|
+
import { MiddlewareConsumer, NestModule } from '@nestjs/common';
|
|
4
|
+
// nestforge:feature:auth:session:end
|
|
2
5
|
import { ConfigModule } from '@nestjs/config';
|
|
3
6
|
import { ThrottlerModule } from '@nestjs/throttler';
|
|
4
7
|
// nestforge:feature:redis
|
|
@@ -61,12 +64,16 @@ import { validateEnv } from './config/env.validation';
|
|
|
61
64
|
MetricsModule,
|
|
62
65
|
],
|
|
63
66
|
})
|
|
64
|
-
export class AppModule
|
|
67
|
+
export class AppModule
|
|
68
|
+
// nestforge:feature:auth:session
|
|
69
|
+
implements NestModule
|
|
70
|
+
// nestforge:feature:auth:session:end
|
|
71
|
+
{
|
|
72
|
+
// nestforge:feature:auth:session
|
|
65
73
|
configure(consumer: MiddlewareConsumer) {
|
|
66
|
-
// nestforge:feature:auth:session
|
|
67
74
|
if (process.env.ENABLE_CSRF === 'true') {
|
|
68
75
|
consumer.apply(CsrfMiddleware).forRoutes('*');
|
|
69
76
|
}
|
|
70
|
-
// nestforge:feature:auth:session:end
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
// nestforge:feature:auth:session:end
|
|
79
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Body, Controller, Get, HttpCode, HttpStatus, Post,
|
|
1
|
+
import { Body, Controller, Get, HttpCode, HttpStatus, Post, Req, UseGuards } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:redis,auth:password
|
|
3
|
+
import { Query } from '@nestjs/common';
|
|
4
|
+
// nestforge:feature:redis,auth:password:end
|
|
2
5
|
// nestforge:feature:swagger
|
|
3
6
|
import { ApiExcludeEndpoint, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
4
7
|
// nestforge:feature:swagger:end
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
// nestforge:feature:auth:password
|
|
1
3
|
import {
|
|
2
4
|
ConflictException,
|
|
3
|
-
Injectable,
|
|
4
5
|
UnauthorizedException,
|
|
5
6
|
} from '@nestjs/common';
|
|
7
|
+
import * as bcrypt from 'bcryptjs';
|
|
8
|
+
// nestforge:feature:auth:password:end
|
|
6
9
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
7
10
|
import {
|
|
8
11
|
DataSource,
|
|
9
|
-
IsNull,
|
|
10
12
|
Repository,
|
|
11
13
|
} from 'typeorm';
|
|
12
|
-
|
|
14
|
+
// nestforge:feature:redis,auth:password,auth:token
|
|
15
|
+
import { IsNull } from 'typeorm';
|
|
16
|
+
// nestforge:feature:redis,auth:password,auth:token:end
|
|
17
|
+
// nestforge:feature:redis,auth:password
|
|
13
18
|
import { createHash, randomBytes } from 'crypto';
|
|
19
|
+
// nestforge:feature:redis,auth:password:end
|
|
14
20
|
import { UserEntity } from '../users/entities/user.entity';
|
|
15
21
|
import { OAuthAccountEntity } from './entities/oauth-account.entity';
|
|
16
22
|
|
|
17
|
-
// nestforge:feature:auth:token
|
|
23
|
+
// nestforge:feature:redis,auth:password,auth:token
|
|
18
24
|
import { RefreshTokenEntity } from './entities/refresh-token.entity';
|
|
19
|
-
// nestforge:feature:auth:token:end
|
|
25
|
+
// nestforge:feature:redis,auth:password,auth:token:end
|
|
20
26
|
|
|
21
27
|
// nestforge:feature:redis,auth:password
|
|
22
28
|
import { MailService } from '../mail/mail.service';
|
|
@@ -338,9 +344,11 @@ export class AuthService {
|
|
|
338
344
|
};
|
|
339
345
|
}
|
|
340
346
|
|
|
347
|
+
// nestforge:feature:redis,auth:password
|
|
341
348
|
private hashToken(token: string): string {
|
|
342
349
|
return createHash('sha256')
|
|
343
350
|
.update(token)
|
|
344
351
|
.digest('hex');
|
|
345
352
|
}
|
|
353
|
+
// nestforge:feature:redis,auth:password:end
|
|
346
354
|
}
|