grm-shared-library 1.0.64 → 1.0.66

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.
@@ -1,6 +1,15 @@
1
- import { CreateOrganizationDto } from "../../organization";
2
- import { CreateUserDto } from "../../user";
1
+ import { MapAddressDto } from "../../common";
2
+ import { Roles } from "../../role";
3
+ import { OrganizationType } from "../../organization/enums/org-type.enum";
3
4
  export declare class RegisterDto {
4
- organizationDto: CreateOrganizationDto;
5
- userDto: CreateUserDto;
5
+ name: string;
6
+ email: string;
7
+ phoneNumber: string;
8
+ roles?: Roles[];
9
+ designation: string;
10
+ password: string;
11
+ orgName: string;
12
+ orgAddress: MapAddressDto;
13
+ orgWebsite: string;
14
+ orgType: OrganizationType;
6
15
  }
@@ -11,25 +11,72 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RegisterDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
- const organization_1 = require("../../organization");
15
- const user_1 = require("../../user");
14
+ const common_1 = require("../../common");
15
+ const role_1 = require("../../role");
16
+ const case_decorators_1 = require("../../../decorators/case-decorators");
17
+ const password_regex_const_1 = require("../../common/constants/password-regex.const");
16
18
  const class_transformer_1 = require("class-transformer");
19
+ const org_type_enum_1 = require("../../organization/enums/org-type.enum");
17
20
  class RegisterDto {
18
21
  }
19
22
  exports.RegisterDto = RegisterDto;
20
23
  __decorate([
21
- (0, class_validator_1.ValidateNested)(),
22
- (0, class_transformer_1.Type)(() => organization_1.CreateOrganizationDto),
23
- (0, class_validator_1.IsNotEmpty)({
24
- message: 'All Organization details must be provided'
25
- }),
26
- __metadata("design:type", organization_1.CreateOrganizationDto)
27
- ], RegisterDto.prototype, "organizationDto", void 0);
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.IsNotEmpty)(),
26
+ (0, class_validator_1.MinLength)(2),
27
+ (0, class_validator_1.MaxLength)(50),
28
+ (0, case_decorators_1.SentenceCase)(),
29
+ __metadata("design:type", String)
30
+ ], RegisterDto.prototype, "name", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsEmail)(),
33
+ (0, class_validator_1.IsNotEmpty)(),
34
+ (0, class_validator_1.MaxLength)(50),
35
+ __metadata("design:type", String)
36
+ ], RegisterDto.prototype, "email", void 0);
37
+ __decorate([
38
+ (0, class_validator_1.IsPhoneNumber)(),
39
+ (0, class_validator_1.MaxLength)(20),
40
+ (0, class_validator_1.IsNotEmpty)(),
41
+ __metadata("design:type", String)
42
+ ], RegisterDto.prototype, "phoneNumber", void 0);
43
+ __decorate([
44
+ (0, class_validator_1.IsArray)(),
45
+ (0, class_validator_1.IsEnum)(role_1.Roles, { each: true }),
46
+ (0, class_validator_1.IsOptional)(),
47
+ __metadata("design:type", Array)
48
+ ], RegisterDto.prototype, "roles", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.IsString)(),
51
+ (0, class_validator_1.IsNotEmpty)(),
52
+ __metadata("design:type", String)
53
+ ], RegisterDto.prototype, "designation", void 0);
54
+ __decorate([
55
+ (0, class_validator_1.IsString)(),
56
+ (0, class_validator_1.MinLength)(8),
57
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
58
+ (0, class_validator_1.IsOptional)(),
59
+ __metadata("design:type", String)
60
+ ], RegisterDto.prototype, "password", void 0);
61
+ __decorate([
62
+ (0, class_validator_1.IsString)(),
63
+ (0, class_validator_1.IsNotEmpty)(),
64
+ (0, class_validator_1.MaxLength)(50),
65
+ __metadata("design:type", String)
66
+ ], RegisterDto.prototype, "orgName", void 0);
28
67
  __decorate([
29
68
  (0, class_validator_1.ValidateNested)(),
30
- (0, class_transformer_1.Type)(() => user_1.CreateUserDto),
31
- (0, class_validator_1.IsNotEmpty)({
32
- message: 'All User details must be provided'
33
- }),
34
- __metadata("design:type", user_1.CreateUserDto)
35
- ], RegisterDto.prototype, "userDto", void 0);
69
+ (0, class_transformer_1.Type)(() => common_1.MapAddressDto),
70
+ (0, class_validator_1.IsNotEmpty)(),
71
+ __metadata("design:type", common_1.MapAddressDto)
72
+ ], RegisterDto.prototype, "orgAddress", void 0);
73
+ __decorate([
74
+ (0, class_validator_1.IsUrl)({}, { message: 'Invalid URL. Format should be http://www.example.com' }),
75
+ (0, class_validator_1.IsNotEmpty)(),
76
+ __metadata("design:type", String)
77
+ ], RegisterDto.prototype, "orgWebsite", void 0);
78
+ __decorate([
79
+ (0, class_validator_1.IsEnum)(org_type_enum_1.OrganizationType),
80
+ (0, class_validator_1.IsNotEmpty)(),
81
+ __metadata("design:type", String)
82
+ ], RegisterDto.prototype, "orgType", void 0);
@@ -1,13 +1,14 @@
1
1
  import { MapAddressDto } from "../../common/dtos/map-address.dto";
2
2
  import { OrganizationStatus } from "../enums/org-status.enum";
3
3
  import { ContactPersonDto } from "../../common/dtos/contact-person.dto";
4
+ import { OrganizationType } from "../enums/org-type.enum";
4
5
  export declare class CreateOrganizationDto {
5
6
  name: string;
6
7
  phoneNumber?: string;
7
8
  email?: string;
8
9
  physicalAddress: MapAddressDto;
9
10
  website: string;
10
- type: string;
11
+ type: OrganizationType;
11
12
  description?: string;
12
13
  status?: OrganizationStatus;
13
14
  logo?: string;
@@ -15,6 +15,7 @@ const class_transformer_1 = require("class-transformer");
15
15
  const map_address_dto_1 = require("../../common/dtos/map-address.dto");
16
16
  const org_status_enum_1 = require("../enums/org-status.enum");
17
17
  const contact_person_dto_1 = require("../../common/dtos/contact-person.dto");
18
+ const org_type_enum_1 = require("../enums/org-type.enum");
18
19
  class CreateOrganizationDto {
19
20
  }
20
21
  exports.CreateOrganizationDto = CreateOrganizationDto;
@@ -42,12 +43,12 @@ __decorate([
42
43
  __metadata("design:type", map_address_dto_1.MapAddressDto)
43
44
  ], CreateOrganizationDto.prototype, "physicalAddress", void 0);
44
45
  __decorate([
45
- (0, class_validator_1.IsString)(),
46
+ (0, class_validator_1.IsUrl)({}, { message: 'Invalid URL. Format should be http://example.com' }),
46
47
  (0, class_validator_1.IsNotEmpty)(),
47
48
  __metadata("design:type", String)
48
49
  ], CreateOrganizationDto.prototype, "website", void 0);
49
50
  __decorate([
50
- (0, class_validator_1.IsString)(),
51
+ (0, class_validator_1.IsEnum)(org_type_enum_1.OrganizationType),
51
52
  (0, class_validator_1.IsNotEmpty)(),
52
53
  __metadata("design:type", String)
53
54
  ], CreateOrganizationDto.prototype, "type", void 0);
@@ -0,0 +1,6 @@
1
+ export declare enum OrganizationType {
2
+ PUBLIC_ORGANIZATION = "Public Organization",
3
+ PRIVATE_ORGANIZATION = "Private Organization",
4
+ NGO = "Non-Governmental Organization",
5
+ OTHER = "Other"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationType = void 0;
4
+ var OrganizationType;
5
+ (function (OrganizationType) {
6
+ OrganizationType["PUBLIC_ORGANIZATION"] = "Public Organization";
7
+ OrganizationType["PRIVATE_ORGANIZATION"] = "Private Organization";
8
+ OrganizationType["NGO"] = "Non-Governmental Organization";
9
+ OrganizationType["OTHER"] = "Other";
10
+ })(OrganizationType || (exports.OrganizationType = OrganizationType = {}));
@@ -1,5 +1,6 @@
1
1
  import { ContactPersonDto } from "../../common/dtos/contact-person.dto";
2
2
  import { MapAddressDto } from "../../common/dtos/map-address.dto";
3
+ import { OrganizationType } from "../enums/org-type.enum";
3
4
  export interface Organization {
4
5
  id: number;
5
6
  name: string;
@@ -7,7 +8,7 @@ export interface Organization {
7
8
  email?: string;
8
9
  physicalAddress: MapAddressDto;
9
10
  website: string;
10
- type: string;
11
+ type: OrganizationType;
11
12
  description?: string;
12
13
  status?: string;
13
14
  logo?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [