@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.
@@ -2,5 +2,5 @@ export declare class UserSaveDto {
2
2
  id: number;
3
3
  phone: string;
4
4
  email: string;
5
- password: string;
5
+ passwordHash: string;
6
6
  }
@@ -11,7 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UserSaveDto = void 0;
13
13
  const ExtendField_1 = require("@steroidsjs/nest/infrastructure/decorators/fields/ExtendField");
14
- const fields_1 = require("@steroidsjs/nest/infrastructure/decorators/fields");
15
14
  const UserModel_1 = require("../models/UserModel");
16
15
  class UserSaveDto {
17
16
  }
@@ -28,12 +27,8 @@ __decorate([
28
27
  __metadata("design:type", String)
29
28
  ], UserSaveDto.prototype, "email", void 0);
30
29
  __decorate([
31
- (0, fields_1.StringField)({
32
- nullable: true,
33
- min: 6,
34
- minConstraintMessage: 'Длина пароля должна составлять не менее 6 символов',
35
- }),
30
+ (0, ExtendField_1.ExtendField)(UserModel_1.UserModel),
36
31
  __metadata("design:type", String)
37
- ], UserSaveDto.prototype, "password", void 0);
32
+ ], UserSaveDto.prototype, "passwordHash", void 0);
38
33
  exports.UserSaveDto = UserSaveDto;
39
34
  //# sourceMappingURL=UserSaveDto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserSaveDto.js","sourceRoot":"","sources":["../../../src/domain/dtos/UserSaveDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+FAA0F;AAC1F,8EAA8E;AAC9E,mDAA8C;AAE9C,MAAa,WAAW;CAgBvB;AAfG;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;uCACZ;AAEX;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;0CACT;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;0CACT;AAEd;IAAC,IAAA,oBAAW,EAAC;QACT,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,CAAC;QACN,oBAAoB,EAAE,oDAAoD;KAC7E,CAAC;;6CACe;AAfrB,kCAgBC"}
1
+ {"version":3,"file":"UserSaveDto.js","sourceRoot":"","sources":["../../../src/domain/dtos/UserSaveDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+FAA0F;AAC1F,mDAA8C;AAE9C,MAAa,WAAW;CAYvB;AAXG;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;uCACZ;AAEX;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;0CACT;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;0CACT;AAEd;IAAC,IAAA,yBAAW,EAAC,qBAAS,CAAC;;iDACF;AAXzB,kCAYC"}
@@ -1,16 +1,12 @@
1
1
  import { CrudService } from '@steroidsjs/nest/usecases/services/CrudService';
2
- import { ISessionService } from '@steroidsjs/nest-modules/auth/services/ISessionService';
3
2
  import { IUserService } from '@steroidsjs/nest-modules/user/services/IUserService';
4
3
  import { UserSearchDto } from '../dtos/UserSearchDto';
5
4
  import { UserSaveDto } from '../dtos/UserSaveDto';
6
5
  import { UserModel } from '../models/UserModel';
7
6
  import { IUserRepository } from '../interfaces/IUserRepository';
8
- import { UserRegistrationDto } from '../dtos/UserRegistrationDto';
9
7
  export declare class UserService extends CrudService<UserModel, UserSearchDto, UserSaveDto | UserModel> implements IUserService {
10
8
  repository: IUserRepository;
11
- session: ISessionService;
12
9
  protected modelClass: typeof UserModel;
13
- constructor(repository: IUserRepository, session: ISessionService);
10
+ constructor(repository: IUserRepository);
14
11
  findByLogin(login: string): Promise<UserModel>;
15
- registration(dto: UserRegistrationDto): Promise<UserModel>;
16
12
  }
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserService = void 0;
4
4
  const CrudService_1 = require("@steroidsjs/nest/usecases/services/CrudService");
5
5
  const PhoneField_1 = require("@steroidsjs/nest/infrastructure/decorators/fields/PhoneField");
6
- const DataMapper_1 = require("@steroidsjs/nest/usecases/helpers/DataMapper");
7
6
  const UserModel_1 = require("../models/UserModel");
8
7
  class UserService extends CrudService_1.CrudService {
9
- constructor(repository, session) {
8
+ constructor(repository) {
10
9
  super();
11
10
  this.repository = repository;
12
- this.session = session;
13
11
  this.modelClass = UserModel_1.UserModel;
14
12
  }
15
13
  async findByLogin(login) {
@@ -21,13 +19,6 @@ class UserService extends CrudService_1.CrudService {
21
19
  ]);
22
20
  return user || null;
23
21
  }
24
- async registration(dto) {
25
- const model = DataMapper_1.DataMapper.create(UserModel_1.UserModel, dto);
26
- if (dto.password) {
27
- model.passwordHash = await this.session.hashPassword(dto.password);
28
- }
29
- return this.create(model);
30
- }
31
22
  }
32
23
  exports.UserService = UserService;
33
24
  //# sourceMappingURL=UserService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/domain/services/UserService.ts"],"names":[],"mappings":";;;AAAA,gFAA2E;AAC3E,6FAA4F;AAC5F,6EAAwE;AAKxE,mDAA8C;AAI9C,MAAa,WAAY,SAAQ,yBAEL;IAGxB,YAEW,UAA2B,EAC3B,OAAwB;QAE/B,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAAiB;QAC3B,YAAO,GAAP,OAAO,CAAiB;QALzB,eAAU,GAAG,qBAAS,CAAC;IAQjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACvC,IAAI;YACJ,EAAC,KAAK,EAAE,KAAK,EAAC;YACd,EAAC,KAAK,EAAC;YACP,EAAC,KAAK,EAAE,IAAA,2BAAc,EAAC,KAAK,CAAC,EAAC;SACjC,CAAC,CAAC;QACH,OAAO,IAAI,IAAI,IAAI,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAwB;QACvC,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,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACJ;AAhCD,kCAgCC"}
1
+ {"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/domain/services/UserService.ts"],"names":[],"mappings":";;;AAAA,gFAA2E;AAC3E,6FAA4F;AAI5F,mDAA8C;AAG9C,MAAa,WAAY,SAAQ,yBAEL;IAGxB,YAEW,UAA2B;QAElC,KAAK,EAAE,CAAC;QAFD,eAAU,GAAV,UAAU,CAAiB;QAJ5B,eAAU,GAAG,qBAAS,CAAC;IAOjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACvC,IAAI;YACJ,EAAC,KAAK,EAAE,KAAK,EAAC;YACd,EAAC,KAAK,EAAC;YACP,EAAC,KAAK,EAAE,IAAA,2BAAc,EAAC,KAAK,CAAC,EAAC;SACjC,CAAC,CAAC;QACH,OAAO,IAAI,IAAI,IAAI,CAAC;IACxB,CAAC;CACJ;AArBD,kCAqBC"}
@@ -1,8 +1,7 @@
1
1
  import { UserModule } from '@steroidsjs/nest-modules/user/UserModule';
2
- import { IAppModuleConfig } from '@steroidsjs/nest/infrastructure/applications/IAppModuleConfig';
3
2
  declare const _default: {
4
3
  rootTarget: typeof UserModule;
5
- module: (config: IAppModuleConfig) => {
4
+ module: (config: import("@steroidsjs/nest/infrastructure/applications/IAppModuleConfig").IAppModuleConfig) => {
6
5
  imports: import("@nestjs/common").ForwardReference<any>[];
7
6
  providers: any[];
8
7
  exports: any[];
package/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const UserModule_1 = require("@steroidsjs/nest-modules/user/UserModule");
4
+ const module_1 = require("./infrastructure/module");
5
+ exports.default = {
6
+ rootTarget: UserModule_1.UserModule,
7
+ module: module_1.default,
8
+ };
9
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,yEAAoE;AACpE,oDAA6C;AAE7C,kBAAe;IACX,UAAU,EAAE,uBAAU;IACtB,MAAM,EAAN,gBAAM;CACT,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IAppModuleConfig } from '@steroidsjs/nest/infrastructure/applications/IAppModuleConfig';
2
+ declare const _default: (config: IAppModuleConfig) => {
3
+ imports: import("@nestjs/common").ForwardReference<any>[];
4
+ providers: any[];
5
+ exports: any[];
6
+ };
7
+ export default _default;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AuthModule_1 = require("@steroidsjs/nest-modules/auth/AuthModule");
4
+ const common_1 = require("@nestjs/common");
5
+ exports.default = (config) => ({
6
+ imports: [
7
+ (0, common_1.forwardRef)(() => AuthModule_1.AuthModule),
8
+ ],
9
+ providers: [],
10
+ exports: [],
11
+ });
12
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/infrastructure/module.ts"],"names":[],"mappings":";;AAAA,yEAAoE;AAEpE,2CAA0C;AAE1C,kBAAe,CAAC,MAAwB,EAAE,EAAE,CAAC,CAAC;IAC1C,OAAO,EAAE;QACL,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,uBAAU,CAAC;KAC/B;IACD,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,EAAE;CACd,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/nest-user",
3
- "version": "0.0.12",
3
+ "version": "0.1.0",
4
4
  "description": "Steroids Nest User Module",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@steroidsjs/nest": "^1",
17
- "@steroidsjs/nest-modules": "^0"
17
+ "@steroidsjs/nest-modules": "^0.1.5"
18
18
  },
19
19
  "devDependencies": {
20
- "@steroidsjs/nest": "^1.7.0",
21
- "@steroidsjs/nest-modules": "^0.0.11",
20
+ "@steroidsjs/nest": "^2.1.1",
21
+ "@steroidsjs/nest-modules": "^0.1.5",
22
22
  "@steroidsjs/eslint-config": "^2.1.2",
23
23
  "copyfiles": "^2.4.1",
24
24
  "@nestjs/schematics": "^9.0.4",