@merkaly/api 0.2.2-1 → 0.2.2-11

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.
Files changed (118) hide show
  1. package/.output/configs/app.entity.d.ts +8 -0
  2. package/.output/configs/app.entity.js +34 -0
  3. package/.output/main.d.ts +0 -54
  4. package/.output/modules/assets/asset.entity.d.ts +10 -0
  5. package/.output/modules/assets/asset.entity.js +52 -0
  6. package/.output/{module/organization → modules/auth}/connections/connection.validator.d.ts +0 -0
  7. package/.output/modules/auth/connections/connection.validator.js +35 -0
  8. package/.output/{module/organization → modules/auth}/members/member.validator.d.ts +0 -0
  9. package/.output/modules/auth/members/member.validator.js +3 -0
  10. package/.output/modules/auth/organizations/organization.controller.d.ts +16 -0
  11. package/.output/modules/auth/organizations/organization.controller.d.ts.map +1 -0
  12. package/.output/modules/auth/organizations/organization.controller.js +101 -0
  13. package/.output/modules/auth/organizations/organization.controller.js.map +1 -0
  14. package/.output/modules/auth/organizations/organization.module.d.ts +9 -0
  15. package/.output/modules/auth/organizations/organization.module.d.ts.map +1 -0
  16. package/.output/modules/auth/organizations/organization.module.js +24 -0
  17. package/.output/modules/auth/organizations/organization.module.js.map +1 -0
  18. package/.output/modules/auth/organizations/organization.repository.d.ts +9 -0
  19. package/.output/modules/auth/organizations/organization.repository.d.ts.map +1 -0
  20. package/.output/modules/auth/organizations/organization.repository.js +42 -0
  21. package/.output/modules/auth/organizations/organization.repository.js.map +1 -0
  22. package/.output/modules/auth/organizations/organization.validator.d.ts +7 -0
  23. package/.output/modules/auth/organizations/organization.validator.d.ts.map +1 -0
  24. package/.output/modules/auth/organizations/organization.validator.js +22 -0
  25. package/.output/modules/auth/organizations/organization.validator.js.map +1 -0
  26. package/.output/modules/inventory/brands/brand.entity.d.ts +6 -0
  27. package/.output/modules/inventory/brands/brand.entity.js +32 -0
  28. package/.output/modules/inventory/brands/brand.validator.d.ts +8 -0
  29. package/.output/modules/inventory/brands/brand.validator.js +43 -0
  30. package/.output/modules/inventory/categories/category.entity.d.ts +6 -0
  31. package/.output/modules/inventory/categories/category.entity.js +32 -0
  32. package/.output/modules/inventory/categories/category.validator.d.ts +8 -0
  33. package/.output/modules/inventory/categories/category.validator.js +43 -0
  34. package/.output/{module → modules}/inventory/products/product.entity.d.ts +5 -6
  35. package/.output/modules/inventory/products/product.entity.js +55 -0
  36. package/.output/modules/inventory/products/product.validator.d.ts +17 -0
  37. package/.output/modules/inventory/products/product.validator.js +91 -0
  38. package/.output/modules/settings/organization/organization.entity.d.ts +10 -0
  39. package/.output/modules/settings/organization/organization.entity.d.ts.map +1 -0
  40. package/.output/modules/settings/organization/organization.entity.js +11 -0
  41. package/.output/modules/settings/organization/organization.entity.js.map +1 -0
  42. package/.output/modules/settings/organization/organization.validator.d.ts +15 -0
  43. package/.output/modules/settings/organization/organization.validator.js +71 -0
  44. package/.output/modules/settings/organizations/organization.controller.d.ts +16 -0
  45. package/.output/modules/settings/organizations/organization.controller.d.ts.map +1 -0
  46. package/.output/modules/settings/organizations/organization.controller.js +101 -0
  47. package/.output/modules/settings/organizations/organization.controller.js.map +1 -0
  48. package/.output/modules/settings/organizations/organization.module.d.ts +9 -0
  49. package/.output/modules/settings/organizations/organization.module.d.ts.map +1 -0
  50. package/.output/modules/settings/organizations/organization.module.js +24 -0
  51. package/.output/modules/settings/organizations/organization.module.js.map +1 -0
  52. package/.output/modules/settings/organizations/organization.repository.d.ts +9 -0
  53. package/.output/modules/settings/organizations/organization.repository.d.ts.map +1 -0
  54. package/.output/modules/settings/organizations/organization.repository.js +42 -0
  55. package/.output/modules/settings/organizations/organization.repository.js.map +1 -0
  56. package/.output/modules/settings/organizations/organization.validator.d.ts +7 -0
  57. package/.output/modules/settings/organizations/organization.validator.d.ts.map +1 -0
  58. package/.output/modules/settings/organizations/organization.validator.js +22 -0
  59. package/.output/modules/settings/organizations/organization.validator.js.map +1 -0
  60. package/.output/modules/settings/payments/payment.entity.d.ts +8 -0
  61. package/.output/modules/settings/payments/payment.entity.js +38 -0
  62. package/.output/modules/settings/payments/payment.validator.d.ts +3 -0
  63. package/.output/modules/settings/payments/payment.validator.js +7 -0
  64. package/.output/modules/store/cart/cart.entity.d.ts +9 -0
  65. package/.output/modules/store/cart/cart.entity.js +39 -0
  66. package/.output/modules/store/cart/cart.validator.d.ts +19 -0
  67. package/.output/modules/store/cart/cart.validator.js +64 -0
  68. package/.output/modules/store/orders/billing/billing.entity.d.ts +7 -0
  69. package/.output/modules/store/orders/billing/billing.entity.js +46 -0
  70. package/.output/modules/store/orders/billing/billing.validator.d.ts +7 -0
  71. package/.output/modules/store/orders/billing/billing.validator.js +44 -0
  72. package/.output/modules/store/orders/item/item.entity.d.ts +7 -0
  73. package/.output/modules/store/orders/item/item.entity.js +37 -0
  74. package/.output/modules/store/orders/item/item.schema.d.ts +27 -0
  75. package/.output/modules/store/orders/item/item.schema.js +6 -0
  76. package/.output/{module/store/items → modules/store/orders/item}/item.validator.d.ts +1 -1
  77. package/.output/modules/store/orders/item/item.validator.js +27 -0
  78. package/.output/modules/store/orders/order.entity.d.ts +15 -0
  79. package/.output/modules/store/orders/order.entity.js +56 -0
  80. package/.output/modules/store/orders/order.validator.d.ts +12 -0
  81. package/.output/modules/store/orders/order.validator.js +49 -0
  82. package/.output/modules/store/orders/shipping/shipping.entity.d.ts +7 -0
  83. package/.output/modules/store/orders/shipping/shipping.entity.js +46 -0
  84. package/.output/modules/store/orders/shipping/shipping.validator.d.ts +7 -0
  85. package/.output/modules/store/orders/shipping/shipping.validator.js +44 -0
  86. package/.output/modules/store/orders/status/status.entity.d.ts +6 -0
  87. package/.output/modules/store/orders/status/status.entity.js +37 -0
  88. package/.output/modules/store/orders/status/status.validator.d.ts +8 -0
  89. package/.output/modules/store/orders/status/status.validator.js +12 -0
  90. package/.output/types.js +0 -0
  91. package/package.json +39 -46
  92. package/.output/config/app.config.d.ts +0 -27
  93. package/.output/config/app.document.d.ts +0 -10
  94. package/.output/config/app.entity.d.ts +0 -8
  95. package/.output/config/app.repository.d.ts +0 -25
  96. package/.output/config/app.validator.d.ts +0 -10
  97. package/.output/module/inventory/brands/brand.document.d.ts +0 -7
  98. package/.output/module/inventory/brands/brand.entity.d.ts +0 -7
  99. package/.output/module/inventory/brands/brand.validator.d.ts +0 -12
  100. package/.output/module/inventory/categories/category.document.d.ts +0 -7
  101. package/.output/module/inventory/categories/category.entity.d.ts +0 -7
  102. package/.output/module/inventory/categories/category.validator.d.ts +0 -12
  103. package/.output/module/inventory/media/media.document.d.ts +0 -7
  104. package/.output/module/inventory/media/media.entity.d.ts +0 -7
  105. package/.output/module/inventory/media/media.validator.d.ts +0 -10
  106. package/.output/module/inventory/products/product.document.d.ts +0 -12
  107. package/.output/module/inventory/products/product.validator.d.ts +0 -21
  108. package/.output/module/inventory/variants/variant.document.d.ts +0 -6
  109. package/.output/module/inventory/variants/variant.entity.d.ts +0 -6
  110. package/.output/module/inventory/variants/variant.validator.d.ts +0 -12
  111. package/.output/module/store/carts/cart.document.d.ts +0 -6
  112. package/.output/module/store/carts/cart.entity.d.ts +0 -6
  113. package/.output/module/store/carts/cart.validator.d.ts +0 -8
  114. package/.output/module/store/items/item.document.d.ts +0 -8
  115. package/.output/module/store/items/item.entity.d.ts +0 -8
  116. package/.output/module/store/orders/order.document.d.ts +0 -7
  117. package/.output/module/store/orders/order.entity.d.ts +0 -5
  118. package/.output/module/store/orders/order.validator.d.ts +0 -8
@@ -0,0 +1,8 @@
1
+ import { Document } from 'mongoose';
2
+ export declare abstract class AppEntity extends Document {
3
+ static $index: string;
4
+ readonly _id = "";
5
+ readonly createdAt: Date;
6
+ readonly updatedAt?: Date;
7
+ readonly deletedAt?: Date;
8
+ }
@@ -0,0 +1,34 @@
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.AppEntity = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ class AppEntity extends mongoose_2.Document {
16
+ static $index;
17
+ _id = '';
18
+ createdAt = new Date();
19
+ updatedAt = null;
20
+ deletedAt = null;
21
+ }
22
+ __decorate([
23
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date, default: new Date() }),
24
+ __metadata("design:type", Object)
25
+ ], AppEntity.prototype, "createdAt", void 0);
26
+ __decorate([
27
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
28
+ __metadata("design:type", Date)
29
+ ], AppEntity.prototype, "updatedAt", void 0);
30
+ __decorate([
31
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
32
+ __metadata("design:type", Date)
33
+ ], AppEntity.prototype, "deletedAt", void 0);
34
+ exports.AppEntity = AppEntity;
package/.output/main.d.ts CHANGED
@@ -1,54 +0,0 @@
1
- import { BrandDocument } from './module/inventory/brands/brand.document';
2
- import * as BrandValidators from './module/inventory/brands/brand.validator';
3
- import { CategoryDocument } from './module/inventory/categories/category.document';
4
- import * as CategoryValidators from './module/inventory/categories/category.validator';
5
- import { MediaDocument } from './module/inventory/media/media.document';
6
- import * as MediaValidators from './module/inventory/media/media.validator';
7
- import { ProductDocument } from './module/inventory/products/product.document';
8
- import * as ProductValidators from './module/inventory/products/product.validator';
9
- import { VariantDocument } from './module/inventory/variants/variant.document';
10
- import * as VariantValidators from './module/inventory/variants/variant.validator';
11
- import { CartDocument } from './module/store/carts/cart.document';
12
- import * as CartValidator from './module/store/carts/cart.validator';
13
- import { OrderDocument } from './module/store/orders/order.document';
14
- import * as OrderValidators from './module/store/orders/order.validator';
15
- export declare const Inventory: {
16
- Brand: {
17
- CreateBrandValidator: typeof BrandValidators.CreateBrandValidator;
18
- UpdateBrandValidator: typeof BrandValidators.UpdateBrandValidator;
19
- BrandDocument: typeof BrandDocument;
20
- };
21
- Category: {
22
- CreateCategoryValidator: typeof CategoryValidators.CreateCategoryValidator;
23
- UpdateCategoryValidator: typeof CategoryValidators.UpdateCategoryValidator;
24
- CategoryDocument: typeof CategoryDocument;
25
- };
26
- Product: {
27
- CreateProductValidator: typeof ProductValidators.CreateProductValidator;
28
- UpdateProductValidator: typeof ProductValidators.UpdateProductValidator;
29
- ProductDocument: typeof ProductDocument;
30
- };
31
- Media: {
32
- CreateMediaValidator: typeof MediaValidators.CreateMediaValidator;
33
- UpdateMediaValidator: typeof MediaValidators.UpdateMediaValidator;
34
- MediaDocument: typeof MediaDocument;
35
- };
36
- Variant: {
37
- CreateVariantValidator: typeof VariantValidators.CreateVariantValidator;
38
- UpdateVariantValidator: typeof VariantValidators.UpdateVariantValidator;
39
- VariantDocument: typeof VariantDocument;
40
- };
41
- };
42
- export declare const Store: {
43
- Order: {
44
- CreateOrderValidator: typeof OrderValidators.CreateOrderValidator;
45
- UpdateOrderValidator: typeof OrderValidators.UpdateOrderValidator;
46
- OrderDocument: typeof OrderDocument;
47
- };
48
- Cart: {
49
- CreateCartValidator: typeof CartValidator.CreateCartValidator;
50
- UpdateCartValidator: typeof CartValidator.UpdateCartValidator;
51
- CartDocument: typeof CartDocument;
52
- };
53
- };
54
- export { SearchParams } from './config/app.repository';
@@ -0,0 +1,10 @@
1
+ import { AppEntity } from '../../configs/app.entity';
2
+ export declare class AssetEntity extends AppEntity {
3
+ static readonly $index = "assets";
4
+ name: string;
5
+ url: string;
6
+ weak: boolean;
7
+ description: string;
8
+ type: string;
9
+ size: number;
10
+ }
@@ -0,0 +1,52 @@
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.AssetEntity = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const app_entity_1 = require("../../configs/app.entity");
16
+ let AssetEntity = class AssetEntity extends app_entity_1.AppEntity {
17
+ static $index = 'assets';
18
+ name;
19
+ url;
20
+ weak = true;
21
+ description;
22
+ type;
23
+ size = 0;
24
+ };
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true }),
27
+ __metadata("design:type", String)
28
+ ], AssetEntity.prototype, "name", void 0);
29
+ __decorate([
30
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
31
+ __metadata("design:type", String)
32
+ ], AssetEntity.prototype, "url", void 0);
33
+ __decorate([
34
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: true }),
35
+ __metadata("design:type", Object)
36
+ ], AssetEntity.prototype, "weak", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, nullable: true }),
39
+ __metadata("design:type", String)
40
+ ], AssetEntity.prototype, "description", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
43
+ __metadata("design:type", String)
44
+ ], AssetEntity.prototype, "type", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, required: true, default: 0 }),
47
+ __metadata("design:type", Object)
48
+ ], AssetEntity.prototype, "size", void 0);
49
+ AssetEntity = __decorate([
50
+ (0, mongoose_1.Schema)({ timestamps: true })
51
+ ], AssetEntity);
52
+ exports.AssetEntity = AssetEntity;
@@ -0,0 +1,35 @@
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.UpdateConnectionValidator = exports.CreateConnectionValidator = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ require("reflect-metadata");
15
+ class CreateConnectionValidator {
16
+ connection_id;
17
+ assign_membership_on_login;
18
+ }
19
+ __decorate([
20
+ (0, class_validator_1.IsString)(),
21
+ __metadata("design:type", Object)
22
+ ], CreateConnectionValidator.prototype, "connection_id", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsBoolean)(),
25
+ __metadata("design:type", Object)
26
+ ], CreateConnectionValidator.prototype, "assign_membership_on_login", void 0);
27
+ exports.CreateConnectionValidator = CreateConnectionValidator;
28
+ class UpdateConnectionValidator {
29
+ assign_membership_on_login;
30
+ }
31
+ __decorate([
32
+ (0, class_validator_1.IsBoolean)(),
33
+ __metadata("design:type", Object)
34
+ ], UpdateConnectionValidator.prototype, "assign_membership_on_login", void 0);
35
+ exports.UpdateConnectionValidator = UpdateConnectionValidator;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("reflect-metadata");
@@ -0,0 +1,16 @@
1
+ import { Organization } from 'auth0';
2
+ import { Auth0Service } from '../../../services/auth0.service';
3
+ import { OrganizationRepository } from './organization.repository';
4
+ import { CreateOrganizationValidator } from './organization.validator';
5
+ export declare class OrganizationController {
6
+ protected readonly $auth0: Auth0Service;
7
+ protected readonly $repository: OrganizationRepository;
8
+ findAll(id: string): Promise<Organization[]>;
9
+ create(validator: CreateOrganizationValidator): Promise<Organization>;
10
+ validate(slug: string): Promise<{
11
+ name: string;
12
+ available: boolean;
13
+ }>;
14
+ current(id: string): Promise<Organization>;
15
+ }
16
+ //# sourceMappingURL=organization.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.controller.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwC,YAAY,EAAE,MAAM,OAAO,CAAC;AAI3E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAEvE,qBAEa,sBAAsB;IACvB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IACxC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAGpD,OAAO,CAAiB,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAM5D,MAAM,CAAS,SAAS,EAAE,2BAA2B,GAAG,OAAO,CAAC,YAAY,CAAC;IAwB7E,QAAQ,CAAe,IAAI,EAAE,MAAM;;;;IAiBnC,OAAO,CAAoB,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAO3E"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationController = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const swagger_1 = require("@nestjs/swagger");
6
+ const organization_decorator_1 = require("../../../decorators/organization.decorator");
7
+ const public_decorator_1 = require("../../../decorators/public.decorator");
8
+ const user_decorator_1 = require("../../../decorators/user.decorator");
9
+ const auth0_service_1 = require("../../../services/auth0.service");
10
+ const organization_repository_1 = require("./organization.repository");
11
+ const organization_validator_1 = require("./organization.validator");
12
+ let OrganizationController = class OrganizationController {
13
+ findAll(id) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ return this.$repository.find(id);
16
+ });
17
+ }
18
+ create(validator) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const organization = yield this.$repository.create(validator)
21
+ .catch(reason => {
22
+ throw new common_1.ConflictException(reason);
23
+ });
24
+ const { user_id } = yield this.$auth0.createUser({
25
+ email: validator.email,
26
+ password: validator.password,
27
+ connection: 'default',
28
+ });
29
+ const params = { id: organization.id };
30
+ const members = { members: [user_id] };
31
+ yield this.$auth0.organizations.addMembers(params, members);
32
+ return organization;
33
+ });
34
+ }
35
+ validate(slug) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const result = yield this.$auth0.organizations.getByName({ name: slug })
38
+ .catch(() => ({}));
39
+ if ('id' in result) {
40
+ throw new common_1.ConflictException('Ja existe uma loja com esse nome');
41
+ }
42
+ return ({
43
+ name: slug,
44
+ available: true,
45
+ });
46
+ });
47
+ }
48
+ current(id) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ return this.$auth0.organizations.getByID({ id })
51
+ .catch(reason => {
52
+ throw new common_1.HttpException(`${reason.message}: [${id}]`, reason.statusCode);
53
+ });
54
+ });
55
+ }
56
+ };
57
+ __decorate([
58
+ (0, common_1.Inject)(),
59
+ __metadata("design:type", auth0_service_1.Auth0Service)
60
+ ], OrganizationController.prototype, "$auth0", void 0);
61
+ __decorate([
62
+ (0, common_1.Inject)(),
63
+ __metadata("design:type", organization_repository_1.OrganizationRepository)
64
+ ], OrganizationController.prototype, "$repository", void 0);
65
+ __decorate([
66
+ (0, common_1.Get)('/'),
67
+ __param(0, (0, user_decorator_1.GetUser)('sub')),
68
+ __metadata("design:type", Function),
69
+ __metadata("design:paramtypes", [String]),
70
+ __metadata("design:returntype", Promise)
71
+ ], OrganizationController.prototype, "findAll", null);
72
+ __decorate([
73
+ (0, common_1.Post)('/'),
74
+ __param(0, (0, common_1.Body)()),
75
+ __metadata("design:type", Function),
76
+ __metadata("design:paramtypes", [organization_validator_1.CreateOrganizationValidator]),
77
+ __metadata("design:returntype", Promise)
78
+ ], OrganizationController.prototype, "create", null);
79
+ __decorate([
80
+ (0, common_1.Post)('/validate'),
81
+ (0, public_decorator_1.Public)(),
82
+ (0, common_1.HttpCode)(common_1.HttpStatus.ACCEPTED),
83
+ __param(0, (0, common_1.Body)('slug')),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [String]),
86
+ __metadata("design:returntype", Promise)
87
+ ], OrganizationController.prototype, "validate", null);
88
+ __decorate([
89
+ (0, common_1.Get)('/current'),
90
+ (0, public_decorator_1.Public)(),
91
+ __param(0, (0, organization_decorator_1.GetOrganization)()),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [String]),
94
+ __metadata("design:returntype", Promise)
95
+ ], OrganizationController.prototype, "current", null);
96
+ OrganizationController = __decorate([
97
+ (0, common_1.Controller)(),
98
+ (0, swagger_1.ApiTags)('auth')
99
+ ], OrganizationController);
100
+ exports.OrganizationController = OrganizationController;
101
+ //# sourceMappingURL=organization.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.controller.js","sourceRoot":"","sources":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"}
@@ -0,0 +1,9 @@
1
+ import { ModuleMetadata } from '@nestjs/common';
2
+ import { AppRouter } from '../../../configs/app.router';
3
+ export declare const metadata: ModuleMetadata;
4
+ export declare class OrganizationModule extends AppRouter {
5
+ static readonly path = "/organizations";
6
+ static readonly module: typeof OrganizationModule;
7
+ static readonly children: any[];
8
+ }
9
+ //# sourceMappingURL=organization.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.module.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAIxD,eAAO,MAAM,QAAQ,EAAE,cAKtB,CAAC;AAEF,qBACa,kBAAmB,SAAQ,SAAS;IAC/C,gBAAuB,IAAI,oBAAoB;IAE/C,gBAAuB,MAAM,4BAAsB;IAEnD,gBAAuB,QAAQ,QAAM;CACtC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var OrganizationModule_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.OrganizationModule = exports.metadata = void 0;
5
+ const common_1 = require("@nestjs/common");
6
+ const app_router_1 = require("../../../configs/app.router");
7
+ const organization_controller_1 = require("./organization.controller");
8
+ const organization_repository_1 = require("./organization.repository");
9
+ exports.metadata = {
10
+ imports: [],
11
+ controllers: [organization_controller_1.OrganizationController],
12
+ providers: [organization_repository_1.OrganizationRepository],
13
+ exports: [organization_repository_1.OrganizationRepository],
14
+ };
15
+ let OrganizationModule = OrganizationModule_1 = class OrganizationModule extends app_router_1.AppRouter {
16
+ };
17
+ OrganizationModule.path = '/organizations';
18
+ OrganizationModule.module = OrganizationModule_1;
19
+ OrganizationModule.children = [];
20
+ OrganizationModule = OrganizationModule_1 = __decorate([
21
+ (0, common_1.Module)(exports.metadata)
22
+ ], OrganizationModule);
23
+ exports.OrganizationModule = OrganizationModule;
24
+ //# sourceMappingURL=organization.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.module.js","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwD;AACxD,4DAAwD;AACxD,uEAAmE;AACnE,uEAAmE;AAEtD,QAAA,QAAQ,GAAmB;IACtC,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,CAAC,gDAAsB,CAAC;IACrC,SAAS,EAAE,CAAC,gDAAsB,CAAC;IACnC,OAAO,EAAE,CAAC,gDAAsB,CAAC;CAClC,CAAC;AAGF,IAAa,kBAAkB,0BAA/B,MAAa,kBAAmB,SAAQ,sBAAS;CAMhD,CAAA;AALwB,uBAAI,GAAG,gBAAiB,CAAA;AAExB,yBAAM,GAAG,oBAAmB,CAAA;AAE5B,2BAAQ,GAAG,EAAG,CAAA;AAL1B,kBAAkB;IAD9B,IAAA,eAAM,EAAC,gBAAQ,CAAC;GACJ,kBAAkB,CAM9B;AANY,gDAAkB"}
@@ -0,0 +1,9 @@
1
+ import { Organization } from 'auth0';
2
+ import { Auth0Service } from '../../../services/auth0.service';
3
+ import { CreateOrganizationValidator } from './organization.validator';
4
+ export declare class OrganizationRepository {
5
+ protected readonly $auth0: Auth0Service;
6
+ find(userId: string): Promise<Organization[]>;
7
+ create(validator: CreateOrganizationValidator): Promise<Organization>;
8
+ }
9
+ //# sourceMappingURL=organization.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.repository.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAEvE,qBACa,sBAAsB;IACvB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAErC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAI7C,MAAM,CAAC,SAAS,EAAE,2BAA2B,GAAG,OAAO,CAAC,YAAY,CAAC;CAyBnF"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrganizationRepository = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const short_unique_id_1 = __importDefault(require("short-unique-id"));
6
+ const auth0_service_1 = require("../../../services/auth0.service");
7
+ let OrganizationRepository = class OrganizationRepository {
8
+ find(userId) {
9
+ return __awaiter(this, void 0, void 0, function* () {
10
+ return this.$auth0.users.getUserOrganizations({ id: userId });
11
+ });
12
+ }
13
+ create(validator) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const uid = new short_unique_id_1.default({ length: 10 });
16
+ const createOrg = {
17
+ name: uid(),
18
+ display_name: validator.name,
19
+ };
20
+ const organization = yield this.$auth0.organizations.create(createOrg);
21
+ const allConnections = yield this.$auth0.getConnections()
22
+ .then(connections => connections.filter(({ name }) => name !== 'sms'));
23
+ const connectionsPromise = [];
24
+ for (const connection of allConnections) {
25
+ connectionsPromise.push(this.$auth0.organizations.addEnabledConnection({ id: organization.id }, {
26
+ connection_id: connection.id,
27
+ }));
28
+ }
29
+ return Promise.all(connectionsPromise)
30
+ .then(() => organization);
31
+ });
32
+ }
33
+ };
34
+ __decorate([
35
+ (0, common_1.Inject)(),
36
+ __metadata("design:type", auth0_service_1.Auth0Service)
37
+ ], OrganizationRepository.prototype, "$auth0", void 0);
38
+ OrganizationRepository = __decorate([
39
+ (0, common_1.Injectable)()
40
+ ], OrganizationRepository);
41
+ exports.OrganizationRepository = OrganizationRepository;
42
+ //# sourceMappingURL=organization.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.repository.js","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.repository.ts"],"names":[],"mappings":";;;AAAA,2C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;AADvC,sBAAsB;IADlC,IAAA,mBAAU,GAAE;GACA,sBAAsB,CAgClC;AAhCY,wDAAsB"}
@@ -0,0 +1,7 @@
1
+ import { CreateOrganization } from 'auth0';
2
+ export declare class CreateOrganizationValidator implements CreateOrganization {
3
+ name: string;
4
+ email: string;
5
+ password?: string;
6
+ }
7
+ //# sourceMappingURL=organization.validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.validator.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAG3C,qBAAa,2BAA4B,YAAW,kBAAkB;IAG7D,IAAI,EAAE,MAAM,CAAC;IAIb,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateOrganizationValidator = void 0;
4
+ const class_validator_1 = require("class-validator");
5
+ class CreateOrganizationValidator {
6
+ }
7
+ __decorate([
8
+ (0, class_validator_1.IsString)(),
9
+ (0, class_validator_1.Length)(3, 255),
10
+ __metadata("design:type", String)
11
+ ], CreateOrganizationValidator.prototype, "name", void 0);
12
+ __decorate([
13
+ (0, class_validator_1.IsString)(),
14
+ (0, class_validator_1.IsEmail)(),
15
+ __metadata("design:type", String)
16
+ ], CreateOrganizationValidator.prototype, "email", void 0);
17
+ __decorate([
18
+ (0, class_validator_1.IsString)(),
19
+ __metadata("design:type", String)
20
+ ], CreateOrganizationValidator.prototype, "password", void 0);
21
+ exports.CreateOrganizationValidator = CreateOrganizationValidator;
22
+ //# sourceMappingURL=organization.validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.validator.js","sourceRoot":"","sources":["../../../../src/modules/auth/organizations/organization.validator.ts"],"names":[],"mappings":";;;AACA,qDAA4D;AAE5D,MAAa,2BAA2B;CAWvC;AARC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAM,EAAC,CAAC,EAAE,GAAG,CAAC;;yDACK;AAIpB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,yBAAO,GAAE;;0DACW;AAGrB;IADC,IAAA,0BAAQ,GAAE;;6DACc;AAV3B,kEAWC"}
@@ -0,0 +1,6 @@
1
+ import { AppEntity } from '../../../configs/app.entity';
2
+ export declare class BrandEntity extends AppEntity {
3
+ static readonly $index = "inventory_brands";
4
+ name: string;
5
+ description: string;
6
+ }
@@ -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.BrandEntity = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const app_entity_1 = require("../../../configs/app.entity");
16
+ let BrandEntity = class BrandEntity extends app_entity_1.AppEntity {
17
+ static $index = 'inventory_brands';
18
+ name;
19
+ description;
20
+ };
21
+ __decorate([
22
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true, length: 32 }),
23
+ __metadata("design:type", String)
24
+ ], BrandEntity.prototype, "name", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
27
+ __metadata("design:type", String)
28
+ ], BrandEntity.prototype, "description", void 0);
29
+ BrandEntity = __decorate([
30
+ (0, mongoose_1.Schema)({ timestamps: true })
31
+ ], BrandEntity);
32
+ exports.BrandEntity = BrandEntity;
@@ -0,0 +1,8 @@
1
+ export declare class CreateBrandValidator {
2
+ name: string;
3
+ description?: string;
4
+ }
5
+ export declare class UpdateBrandValidator {
6
+ name?: string;
7
+ description?: string;
8
+ }
@@ -0,0 +1,43 @@
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.UpdateBrandValidator = exports.CreateBrandValidator = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class CreateBrandValidator {
15
+ name;
16
+ description;
17
+ }
18
+ __decorate([
19
+ (0, class_validator_1.IsString)(),
20
+ (0, class_validator_1.Length)(2, 32),
21
+ __metadata("design:type", String)
22
+ ], CreateBrandValidator.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.IsOptional)(),
26
+ __metadata("design:type", String)
27
+ ], CreateBrandValidator.prototype, "description", void 0);
28
+ exports.CreateBrandValidator = CreateBrandValidator;
29
+ class UpdateBrandValidator {
30
+ name;
31
+ description;
32
+ }
33
+ __decorate([
34
+ (0, class_validator_1.IsString)(),
35
+ (0, class_validator_1.IsOptional)(),
36
+ __metadata("design:type", String)
37
+ ], UpdateBrandValidator.prototype, "name", void 0);
38
+ __decorate([
39
+ (0, class_validator_1.IsString)(),
40
+ (0, class_validator_1.IsOptional)(),
41
+ __metadata("design:type", String)
42
+ ], UpdateBrandValidator.prototype, "description", void 0);
43
+ exports.UpdateBrandValidator = UpdateBrandValidator;
@@ -0,0 +1,6 @@
1
+ import { AppEntity } from '../../../configs/app.entity';
2
+ export declare class CategoryEntity extends AppEntity {
3
+ static readonly $index = "inventory_categories";
4
+ name: string;
5
+ description: string;
6
+ }
@@ -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.CategoryEntity = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const app_entity_1 = require("../../../configs/app.entity");
16
+ let CategoryEntity = class CategoryEntity extends app_entity_1.AppEntity {
17
+ static $index = 'inventory_categories';
18
+ name;
19
+ description;
20
+ };
21
+ __decorate([
22
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, length: 32, unique: true, required: true }),
23
+ __metadata("design:type", String)
24
+ ], CategoryEntity.prototype, "name", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
27
+ __metadata("design:type", String)
28
+ ], CategoryEntity.prototype, "description", void 0);
29
+ CategoryEntity = __decorate([
30
+ (0, mongoose_1.Schema)({ timestamps: true })
31
+ ], CategoryEntity);
32
+ exports.CategoryEntity = CategoryEntity;
@@ -0,0 +1,8 @@
1
+ export declare class CreateCategoryValidator {
2
+ name: string;
3
+ description?: string;
4
+ }
5
+ export declare class UpdateCategoryValidator {
6
+ name: string;
7
+ description?: string;
8
+ }