@steroidsjs/nest-user 0.0.12 → 0.1.0
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/domain/dtos/UserSaveDto.d.ts +1 -1
- package/domain/dtos/UserSaveDto.js +2 -7
- package/domain/dtos/UserSaveDto.js.map +1 -1
- package/domain/services/UserService.d.ts +1 -5
- package/domain/services/UserService.js +1 -10
- package/domain/services/UserService.js.map +1 -1
- package/{infrastructure/config.d.ts → index.d.ts} +1 -2
- package/index.js +9 -0
- package/index.js.map +1 -0
- package/infrastructure/module.d.ts +7 -0
- package/infrastructure/module.js +12 -0
- package/infrastructure/module.js.map +1 -0
- package/package.json +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/usecases/userRegistration/UserRegistrationUseCase.d.ts +11 -0
- package/usecases/userRegistration/UserRegistrationUseCase.js +20 -0
- package/usecases/userRegistration/UserRegistrationUseCase.js.map +1 -0
- package/{domain → usecases/userRegistration}/dtos/UserRegistrationDto.js +1 -1
- package/usecases/userRegistration/dtos/UserRegistrationDto.js.map +1 -0
- package/usecases/userUpdatePassword/UserUpdatePasswordUseCase.d.ts +10 -0
- package/usecases/userUpdatePassword/UserUpdatePasswordUseCase.js +19 -0
- package/usecases/userUpdatePassword/UserUpdatePasswordUseCase.js.map +1 -0
- package/domain/dtos/UserRegistrationDto.js.map +0 -1
- package/infrastructure/config.js +0 -16
- package/infrastructure/config.js.map +0 -1
- /package/{domain → usecases/userRegistration}/dtos/UserRegistrationDto.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ISessionService } from '@steroidsjs/nest-modules/auth/services/ISessionService';
|
|
2
|
+
import { IUserRegistrationUseCase } from '@steroidsjs/nest-modules/user/usecases/IUserRegistrationUseCase';
|
|
3
|
+
import { UserModel } from '../../domain/models/UserModel';
|
|
4
|
+
import { UserRegistrationDto } from './dtos/UserRegistrationDto';
|
|
5
|
+
import { UserService } from '../../domain/services/UserService';
|
|
6
|
+
export declare class UserRegistrationUseCase implements IUserRegistrationUseCase {
|
|
7
|
+
private readonly sessionService;
|
|
8
|
+
private readonly userService;
|
|
9
|
+
constructor(sessionService: ISessionService, userService: UserService);
|
|
10
|
+
handle(dto: UserRegistrationDto): Promise<UserModel>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserRegistrationUseCase = void 0;
|
|
4
|
+
const DataMapper_1 = require("@steroidsjs/nest/usecases/helpers/DataMapper");
|
|
5
|
+
const UserModel_1 = require("../../domain/models/UserModel");
|
|
6
|
+
class UserRegistrationUseCase {
|
|
7
|
+
constructor(sessionService, userService) {
|
|
8
|
+
this.sessionService = sessionService;
|
|
9
|
+
this.userService = userService;
|
|
10
|
+
}
|
|
11
|
+
async handle(dto) {
|
|
12
|
+
const model = DataMapper_1.DataMapper.create(UserModel_1.UserModel, dto);
|
|
13
|
+
if (dto.password) {
|
|
14
|
+
model.passwordHash = await this.sessionService.hashPassword(dto.password);
|
|
15
|
+
}
|
|
16
|
+
return this.userService.create(model);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.UserRegistrationUseCase = UserRegistrationUseCase;
|
|
20
|
+
//# sourceMappingURL=UserRegistrationUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRegistrationUseCase.js","sourceRoot":"","sources":["../../../src/usecases/userRegistration/UserRegistrationUseCase.ts"],"names":[],"mappings":";;;AAAA,6EAA0E;AAG1E,6DAA0D;AAI1D,MAAa,uBAAuB;IAChC,YACqB,cAA+B,EAC/B,WAAwB;QADxB,mBAAc,GAAd,cAAc,CAAiB;QAC/B,gBAAW,GAAX,WAAW,CAAa;IAC1C,CAAC;IAEG,KAAK,CAAC,MAAM,CAAC,GAAwB;QACxC,MAAM,KAAK,GAAG,uBAAU,CAAC,MAAM,CAAC,qBAAS,EAAE,GAAG,CAAC,CAAC;QAEhD,IAAI,GAAG,CAAC,QAAQ,EAAE;YACd,KAAK,CAAC,YAAY,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAC7E;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;CACJ;AAfD,0DAeC"}
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UserRegistrationDto = void 0;
|
|
13
13
|
const ExtendField_1 = require("@steroidsjs/nest/infrastructure/decorators/fields/ExtendField");
|
|
14
14
|
const fields_1 = require("@steroidsjs/nest/infrastructure/decorators/fields");
|
|
15
|
-
const UserModel_1 = require("
|
|
15
|
+
const UserModel_1 = require("../../../domain/models/UserModel");
|
|
16
16
|
class UserRegistrationDto {
|
|
17
17
|
}
|
|
18
18
|
__decorate([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserRegistrationDto.js","sourceRoot":"","sources":["../../../../src/usecases/userRegistration/dtos/UserRegistrationDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+FAA0F;AAC1F,8EAA2G;AAE3G,gEAA2D;AAE3D,MAAa,mBAAmB;CAqB/B;AApBG;IAAC,IAAA,oBAAW,EAAC;QACT,QAAQ,EAAE,IAAI;KACjB,CAAC;;kDACY;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;kDACT;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;kDACT;AAEd;IAAC,IAAA,sBAAa,EAAC;QACX,QAAQ,EAAE,IAAI;KACjB,CAAC;;qDACe;AAEjB;IAAC,IAAA,qBAAY,EAAC;QACV,QAAQ,EAAE,IAAI;KACjB,CAAC;;yDACqB;AApB3B,kDAqBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ContextDto } from '@steroidsjs/nest/usecases/dtos/ContextDto';
|
|
2
|
+
import { IUserService } from '@steroidsjs/nest-modules/user/services/IUserService';
|
|
3
|
+
import { IUserUpdatePasswordUseCase } from '@steroidsjs/nest-modules/user/usecases/IUserUpdatePasswordUseCase';
|
|
4
|
+
import { ISessionService } from '@steroidsjs/nest-modules/auth/services/ISessionService';
|
|
5
|
+
export declare class UserUpdatePasswordUseCase implements IUserUpdatePasswordUseCase {
|
|
6
|
+
private readonly userService;
|
|
7
|
+
private readonly sessionService;
|
|
8
|
+
constructor(userService: IUserService, sessionService: ISessionService);
|
|
9
|
+
handle(userId: number, password: string, context: ContextDto): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserUpdatePasswordUseCase = void 0;
|
|
4
|
+
const DataMapper_1 = require("@steroidsjs/nest/usecases/helpers/DataMapper");
|
|
5
|
+
const UserSaveDto_1 = require("../../domain/dtos/UserSaveDto");
|
|
6
|
+
class UserUpdatePasswordUseCase {
|
|
7
|
+
constructor(userService, sessionService) {
|
|
8
|
+
this.userService = userService;
|
|
9
|
+
this.sessionService = sessionService;
|
|
10
|
+
}
|
|
11
|
+
async handle(userId, password, context) {
|
|
12
|
+
const userSaveDto = DataMapper_1.DataMapper.create(UserSaveDto_1.UserSaveDto, {
|
|
13
|
+
passwordHash: await this.sessionService.hashPassword(password),
|
|
14
|
+
});
|
|
15
|
+
await this.userService.update(userId, userSaveDto, context);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.UserUpdatePasswordUseCase = UserUpdatePasswordUseCase;
|
|
19
|
+
//# sourceMappingURL=UserUpdatePasswordUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserUpdatePasswordUseCase.js","sourceRoot":"","sources":["../../../src/usecases/userUpdatePassword/UserUpdatePasswordUseCase.ts"],"names":[],"mappings":";;;AACA,6EAA0E;AAI1E,+DAA4D;AAE5D,MAAa,yBAAyB;IAClC,YACqB,WAAyB,EACzB,cAA+B;QAD/B,gBAAW,GAAX,WAAW,CAAc;QACzB,mBAAc,GAAd,cAAc,CAAiB;IACjD,CAAC;IAEG,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,OAAmB;QACrE,MAAM,WAAW,GAAG,uBAAU,CAAC,MAAM,CAAC,yBAAW,EAAE;YAC/C,YAAY,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,CAAC;SACjE,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACJ;AAbD,8DAaC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserRegistrationDto.js","sourceRoot":"","sources":["../../../src/domain/dtos/UserRegistrationDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+FAA0F;AAC1F,8EAA2G;AAE3G,mDAA8C;AAE9C,MAAa,mBAAmB;CAqB/B;AApBG;IAAC,IAAA,oBAAW,EAAC;QACT,QAAQ,EAAE,IAAI;KACjB,CAAC;;kDACY;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;kDACT;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;kDACT;AAEd;IAAC,IAAA,sBAAa,EAAC;QACX,QAAQ,EAAE,IAAI;KACjB,CAAC;;qDACe;AAEjB;IAAC,IAAA,qBAAY,EAAC;QACV,QAAQ,EAAE,IAAI;KACjB,CAAC;;yDACqB;AApB3B,kDAqBC"}
|
package/infrastructure/config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const AuthModule_1 = require("@steroidsjs/nest-modules/auth/AuthModule");
|
|
4
|
-
const UserModule_1 = require("@steroidsjs/nest-modules/user/UserModule");
|
|
5
|
-
const common_1 = require("@nestjs/common");
|
|
6
|
-
exports.default = {
|
|
7
|
-
rootTarget: UserModule_1.UserModule,
|
|
8
|
-
module: (config) => ({
|
|
9
|
-
imports: [
|
|
10
|
-
(0, common_1.forwardRef)(() => AuthModule_1.AuthModule),
|
|
11
|
-
],
|
|
12
|
-
providers: [],
|
|
13
|
-
exports: [],
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/infrastructure/config.ts"],"names":[],"mappings":";;AAAA,yEAAoE;AACpE,yEAAoE;AAEpE,2CAA0C;AAE1C,kBAAe;IACX,UAAU,EAAE,uBAAU;IACtB,MAAM,EAAE,CAAC,MAAwB,EAAE,EAAE,CAAC,CAAC;QACnC,OAAO,EAAE;YACL,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,uBAAU,CAAC;SAC/B;QACD,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACd,CAAC;CACL,CAAC"}
|
|
File without changes
|