grm-shared-library 1.0.0 → 1.0.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.
@@ -0,0 +1,11 @@
1
+ import { MapLocationDto } from "./map-location.dto";
2
+ export declare class MapAddressDto {
3
+ placeId?: string;
4
+ physicalAddress: string;
5
+ location: MapLocationDto;
6
+ plusCode?: string;
7
+ buildingName: string;
8
+ phone?: string;
9
+ photo?: string;
10
+ isValid?: boolean;
11
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MapAddressDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const map_location_dto_1 = require("./map-location.dto");
16
+ class MapAddressDto {
17
+ }
18
+ exports.MapAddressDto = MapAddressDto;
19
+ __decorate([
20
+ (0, class_validator_1.IsString)(),
21
+ __metadata("design:type", String)
22
+ ], MapAddressDto.prototype, "placeId", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], MapAddressDto.prototype, "physicalAddress", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.ValidateNested)(),
29
+ (0, class_transformer_1.Type)(() => map_location_dto_1.MapLocationDto),
30
+ __metadata("design:type", map_location_dto_1.MapLocationDto)
31
+ ], MapAddressDto.prototype, "location", void 0);
32
+ __decorate([
33
+ (0, class_validator_1.IsString)(),
34
+ __metadata("design:type", String)
35
+ ], MapAddressDto.prototype, "plusCode", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
38
+ __metadata("design:type", String)
39
+ ], MapAddressDto.prototype, "buildingName", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsString)(),
42
+ __metadata("design:type", String)
43
+ ], MapAddressDto.prototype, "phone", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsString)(),
46
+ __metadata("design:type", String)
47
+ ], MapAddressDto.prototype, "photo", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsBoolean)(),
50
+ __metadata("design:type", Boolean)
51
+ ], MapAddressDto.prototype, "isValid", void 0);
@@ -0,0 +1,5 @@
1
+ export declare class MapLocationDto {
2
+ lat: number;
3
+ lng: number;
4
+ course?: number;
5
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MapLocationDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class MapLocationDto {
15
+ }
16
+ exports.MapLocationDto = MapLocationDto;
17
+ __decorate([
18
+ (0, class_validator_1.IsNumber)(),
19
+ (0, class_validator_1.Min)(-90),
20
+ (0, class_validator_1.Max)(90),
21
+ __metadata("design:type", Number)
22
+ ], MapLocationDto.prototype, "lat", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsNumber)(),
25
+ (0, class_validator_1.Min)(-180),
26
+ (0, class_validator_1.Max)(180),
27
+ __metadata("design:type", Number)
28
+ ], MapLocationDto.prototype, "lng", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsNumber)(),
31
+ __metadata("design:type", Number)
32
+ ], MapLocationDto.prototype, "course", void 0);
@@ -0,0 +1,20 @@
1
+ import { MapAddressDto } from "../location/map-address.dto";
2
+ declare class ContactPerson {
3
+ name: string;
4
+ phoneNumber: string;
5
+ email: string;
6
+ designation: string;
7
+ }
8
+ export declare class CreateOrganizationDto {
9
+ name: string;
10
+ phoneNumber?: string;
11
+ email?: string;
12
+ physicalAddress: MapAddressDto;
13
+ website: string;
14
+ type: string;
15
+ description?: string;
16
+ status: string;
17
+ logo?: string;
18
+ contactPerson: ContactPerson;
19
+ }
20
+ export {};
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CreateOrganizationDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const class_transformer_1 = require("class-transformer");
15
+ const map_address_dto_1 = require("../location/map-address.dto");
16
+ const decorators_1 = require("../../utilities/decorators");
17
+ const org_status_enum_1 = require("../../enums/org-status.enum");
18
+ class ContactPerson {
19
+ }
20
+ __decorate([
21
+ (0, class_validator_1.IsString)(),
22
+ (0, decorators_1.SentenceCase)(),
23
+ (0, class_validator_1.IsNotEmpty)(),
24
+ __metadata("design:type", String)
25
+ ], ContactPerson.prototype, "name", void 0);
26
+ __decorate([
27
+ (0, class_validator_1.IsPhoneNumber)(),
28
+ (0, class_validator_1.IsNotEmpty)(),
29
+ __metadata("design:type", String)
30
+ ], ContactPerson.prototype, "phoneNumber", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsEmail)(),
33
+ (0, class_validator_1.IsNotEmpty)(),
34
+ __metadata("design:type", String)
35
+ ], ContactPerson.prototype, "email", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
38
+ (0, class_validator_1.IsNotEmpty)(),
39
+ __metadata("design:type", String)
40
+ ], ContactPerson.prototype, "designation", void 0);
41
+ class CreateOrganizationDto {
42
+ }
43
+ exports.CreateOrganizationDto = CreateOrganizationDto;
44
+ __decorate([
45
+ (0, class_validator_1.IsString)(),
46
+ (0, class_validator_1.IsNotEmpty)(),
47
+ __metadata("design:type", String)
48
+ ], CreateOrganizationDto.prototype, "name", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.IsPhoneNumber)(),
51
+ (0, class_validator_1.IsOptional)(),
52
+ __metadata("design:type", String)
53
+ ], CreateOrganizationDto.prototype, "phoneNumber", void 0);
54
+ __decorate([
55
+ (0, class_validator_1.IsEmail)(),
56
+ (0, class_validator_1.IsOptional)(),
57
+ __metadata("design:type", String)
58
+ ], CreateOrganizationDto.prototype, "email", void 0);
59
+ __decorate([
60
+ (0, class_validator_1.ValidateNested)(),
61
+ (0, class_transformer_1.Type)(() => map_address_dto_1.MapAddressDto),
62
+ (0, class_validator_1.IsNotEmpty)(),
63
+ __metadata("design:type", map_address_dto_1.MapAddressDto)
64
+ ], CreateOrganizationDto.prototype, "physicalAddress", void 0);
65
+ __decorate([
66
+ (0, class_validator_1.IsString)(),
67
+ (0, class_validator_1.IsNotEmpty)(),
68
+ __metadata("design:type", String)
69
+ ], CreateOrganizationDto.prototype, "website", void 0);
70
+ __decorate([
71
+ (0, class_validator_1.IsString)(),
72
+ (0, class_validator_1.IsNotEmpty)(),
73
+ __metadata("design:type", String)
74
+ ], CreateOrganizationDto.prototype, "type", void 0);
75
+ __decorate([
76
+ (0, class_validator_1.IsString)(),
77
+ (0, class_validator_1.IsOptional)(),
78
+ __metadata("design:type", String)
79
+ ], CreateOrganizationDto.prototype, "description", void 0);
80
+ __decorate([
81
+ (0, class_validator_1.IsEnum)(org_status_enum_1.OrganizationStatus),
82
+ (0, class_validator_1.IsNotEmpty)(),
83
+ __metadata("design:type", String)
84
+ ], CreateOrganizationDto.prototype, "status", void 0);
85
+ __decorate([
86
+ (0, class_validator_1.IsString)(),
87
+ (0, class_validator_1.IsOptional)(),
88
+ __metadata("design:type", String)
89
+ ], CreateOrganizationDto.prototype, "logo", void 0);
90
+ __decorate([
91
+ (0, class_validator_1.IsNotEmpty)(),
92
+ (0, class_validator_1.ValidateNested)(),
93
+ (0, class_transformer_1.Type)(() => ContactPerson),
94
+ __metadata("design:type", ContactPerson)
95
+ ], CreateOrganizationDto.prototype, "contactPerson", void 0);
@@ -0,0 +1,5 @@
1
+ import { CreateOrganizationDto } from "./create-organization.dto";
2
+ declare const UpdateOrganizationDto_base: import("@nestjs/mapped-types").MappedType<Partial<CreateOrganizationDto>>;
3
+ export declare class UpdateOrganizationDto extends UpdateOrganizationDto_base {
4
+ }
5
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateOrganizationDto = void 0;
4
+ const mapped_types_1 = require("@nestjs/mapped-types");
5
+ const create_organization_dto_1 = require("./create-organization.dto");
6
+ class UpdateOrganizationDto extends (0, mapped_types_1.PartialType)(create_organization_dto_1.CreateOrganizationDto) {
7
+ }
8
+ exports.UpdateOrganizationDto = UpdateOrganizationDto;
@@ -0,0 +1,7 @@
1
+ export declare enum OrganizationStatus {
2
+ active = "Active",
3
+ inactive = "Inactive",
4
+ pending = "Pending",
5
+ suspended = "Suspended",
6
+ rejected = "Rejected"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationStatus = void 0;
4
+ var OrganizationStatus;
5
+ (function (OrganizationStatus) {
6
+ OrganizationStatus["active"] = "Active";
7
+ OrganizationStatus["inactive"] = "Inactive";
8
+ OrganizationStatus["pending"] = "Pending";
9
+ OrganizationStatus["suspended"] = "Suspended";
10
+ OrganizationStatus["rejected"] = "Rejected";
11
+ })(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
package/dist/index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  export * from './dtos/user/create-user.dto';
2
2
  export * from './dtos/user/update-user.dto';
3
+ export * from './dtos/organization/create-organization.dto';
4
+ export * from './dtos/organization/update-organization.dto';
5
+ export * from './dtos/location/map-location.dto';
6
+ export * from './dtos/location/map-address.dto';
3
7
  export * from './enums/user-role.enum';
8
+ export * from './enums/org-status.enum';
4
9
  export * from './topics';
10
+ export * from './utilities/decorators';
package/dist/index.js CHANGED
@@ -16,5 +16,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./dtos/user/create-user.dto"), exports);
18
18
  __exportStar(require("./dtos/user/update-user.dto"), exports);
19
+ __exportStar(require("./dtos/organization/create-organization.dto"), exports);
20
+ __exportStar(require("./dtos/organization/update-organization.dto"), exports);
21
+ __exportStar(require("./dtos/location/map-location.dto"), exports);
22
+ __exportStar(require("./dtos/location/map-address.dto"), exports);
19
23
  __exportStar(require("./enums/user-role.enum"), exports);
24
+ __exportStar(require("./enums/org-status.enum"), exports);
20
25
  __exportStar(require("./topics"), exports);
26
+ __exportStar(require("./utilities/decorators"), exports);
@@ -0,0 +1,3 @@
1
+ export declare function SentenceCase(): PropertyDecorator;
2
+ export declare function UpperCase(): PropertyDecorator;
3
+ export declare function LowerCase(): PropertyDecorator;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SentenceCase = SentenceCase;
4
+ exports.UpperCase = UpperCase;
5
+ exports.LowerCase = LowerCase;
6
+ const class_transformer_1 = require("class-transformer");
7
+ function SentenceCase() {
8
+ return (0, class_transformer_1.Transform)(({ value }) => {
9
+ if (typeof value !== 'string') {
10
+ return value;
11
+ }
12
+ return value
13
+ .split(' ')
14
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
15
+ .join(' ');
16
+ });
17
+ }
18
+ function UpperCase() {
19
+ return (0, class_transformer_1.Transform)(({ value }) => {
20
+ if (typeof value !== 'string') {
21
+ return value;
22
+ }
23
+ return value.toUpperCase();
24
+ });
25
+ }
26
+ function LowerCase() {
27
+ return (0, class_transformer_1.Transform)(({ value }) => typeof value === "string" ? value.toLowerCase() : value);
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -27,4 +27,4 @@
27
27
  "class-transformer": "^0.5.1",
28
28
  "class-validator": "^0.14.1"
29
29
  }
30
- }
30
+ }