@merkaly/api 0.2.4-9 → 0.2.4

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,11 +1,8 @@
1
1
  import { AbstractEntity } from '../../../abstract/abstract.entity';
2
- import { PageTypes } from './page.types';
3
- export declare class PageEntity extends AbstractEntity {
2
+ export declare class PageEntity<C = Record<string, any>> extends AbstractEntity {
4
3
  static readonly $index = "content_pages";
5
- slug: string;
4
+ name: string;
6
5
  title: string;
7
6
  description: string;
8
- image: string;
9
- type: PageTypes;
10
- content: string;
7
+ content: C;
11
8
  }
@@ -17,7 +17,6 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.PageFixture = void 0;
19
19
  var abstract_fixture_1 = require("../../../abstract/abstract.fixture");
20
- var page_types_1 = require("./page.types");
21
20
  var page_validator_1 = require("./page.validator");
22
21
  var PageFixture = (function (_super) {
23
22
  __extends(PageFixture, _super);
@@ -27,11 +26,9 @@ var PageFixture = (function (_super) {
27
26
  PageFixture.prototype.normal = function () {
28
27
  var page = new page_validator_1.CreatePageValidator();
29
28
  page.title = this.$faker.random.words(6);
30
- page.slug = this.$faker.helpers.slugify(page.title);
29
+ page.name = this.$faker.helpers.slugify(page.title);
31
30
  page.description = this.$faker.lorem.words(45);
32
- page.image = this.$faker.image.image(850, 400, true);
33
- page.content = this.$faker.lorem.paragraph(this.$faker.datatype.number({ min: 30, max: 60 }));
34
- page.type = this.$faker.helpers.arrayElement(Object.values(page_types_1.PageTypes));
31
+ page.content = {};
35
32
  return page;
36
33
  };
37
34
  return PageFixture;
@@ -1,3 +1,6 @@
1
+ import { ProductEntity } from '../../inventory/products/product.entity';
2
+ import { BrandEntity } from '../../inventory/brands/brand.entity';
3
+ import { CategoryEntity } from '../../inventory/categories/category.entity';
1
4
  export declare enum PageTypes {
2
5
  PAGE = "PAGE",
3
6
  POST = "POST"
@@ -6,3 +9,12 @@ export declare enum PageEvents {
6
9
  VALIDATE = "database.content.pages.validate",
7
10
  UPSERT_ES_DOCUMENT = "database.content.pages.upsert-es-document"
8
11
  }
12
+ export interface IndexPageContent {
13
+ hero: any[];
14
+ banners: any[];
15
+ products: ProductEntity[];
16
+ categories: CategoryEntity[];
17
+ brands: BrandEntity[];
18
+ promotions: unknown[];
19
+ services: unknown[];
20
+ }
@@ -1,11 +1,8 @@
1
- import { PageTypes } from './page.types';
2
1
  export declare class CreatePageValidator {
3
- slug: string;
2
+ name: string;
4
3
  title: string;
5
4
  description: string;
6
- image: string;
7
- type: PageTypes;
8
- content: string;
5
+ content: Record<string, any>;
9
6
  }
10
7
  export declare class UpdatePageValidator extends CreatePageValidator {
11
8
  }
@@ -26,17 +26,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.UpdatePageValidator = exports.CreatePageValidator = void 0;
28
28
  var class_validator_1 = require("class-validator");
29
- var page_types_1 = require("./page.types");
30
29
  var CreatePageValidator = (function () {
31
30
  function CreatePageValidator() {
32
31
  this.description = null;
33
- this.image = null;
34
- this.type = page_types_1.PageTypes.PAGE;
35
32
  }
36
33
  __decorate([
37
34
  (0, class_validator_1.IsString)(),
38
35
  __metadata("design:type", String)
39
- ], CreatePageValidator.prototype, "slug", void 0);
36
+ ], CreatePageValidator.prototype, "name", void 0);
40
37
  __decorate([
41
38
  (0, class_validator_1.IsString)(),
42
39
  __metadata("design:type", String)
@@ -47,18 +44,9 @@ var CreatePageValidator = (function () {
47
44
  __metadata("design:type", String)
48
45
  ], CreatePageValidator.prototype, "description", void 0);
49
46
  __decorate([
50
- (0, class_validator_1.IsUrl)(),
51
- (0, class_validator_1.IsOptional)(),
52
- __metadata("design:type", String)
53
- ], CreatePageValidator.prototype, "image", void 0);
54
- __decorate([
55
- (0, class_validator_1.IsString)(),
56
- (0, class_validator_1.IsEnum)(page_types_1.PageTypes),
47
+ (0, class_validator_1.IsObject)(),
48
+ (0, class_validator_1.IsNotEmptyObject)(),
57
49
  __metadata("design:type", Object)
58
- ], CreatePageValidator.prototype, "type", void 0);
59
- __decorate([
60
- (0, class_validator_1.IsString)(),
61
- __metadata("design:type", String)
62
50
  ], CreatePageValidator.prototype, "content", void 0);
63
51
  return CreatePageValidator;
64
52
  }());
@@ -1,6 +1,9 @@
1
1
  import { AbstractEntity } from '../../../abstract/abstract.entity';
2
+ import { AssetEntity } from '../../assets/asset.entity';
2
3
  export declare class BrandEntity extends AbstractEntity {
3
4
  static readonly $index = "inventory_brands";
4
5
  name: string;
5
6
  description: string;
7
+ image: AssetEntity;
8
+ readonly picture: string;
6
9
  }
@@ -2,8 +2,10 @@ import { AbstractValidator } from "../../../abstract/abstract.validator";
2
2
  export declare class CreateBrandValidator extends AbstractValidator {
3
3
  name: string;
4
4
  description?: string;
5
+ image: string;
5
6
  }
6
7
  export declare class UpdateBrandValidator extends AbstractValidator {
7
8
  name?: string;
8
9
  description?: string;
10
+ image: string;
9
11
  }
@@ -42,6 +42,10 @@ var CreateBrandValidator = (function (_super) {
42
42
  (0, class_validator_1.IsOptional)(),
43
43
  __metadata("design:type", String)
44
44
  ], CreateBrandValidator.prototype, "description", void 0);
45
+ __decorate([
46
+ (0, class_validator_1.IsMongoId)(),
47
+ __metadata("design:type", String)
48
+ ], CreateBrandValidator.prototype, "image", void 0);
45
49
  return CreateBrandValidator;
46
50
  }(abstract_validator_1.AbstractValidator));
47
51
  exports.CreateBrandValidator = CreateBrandValidator;
@@ -61,6 +65,11 @@ var UpdateBrandValidator = (function (_super) {
61
65
  (0, class_validator_1.IsOptional)(),
62
66
  __metadata("design:type", String)
63
67
  ], UpdateBrandValidator.prototype, "description", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsMongoId)(),
70
+ (0, class_validator_1.IsOptional)(),
71
+ __metadata("design:type", String)
72
+ ], UpdateBrandValidator.prototype, "image", void 0);
64
73
  return UpdateBrandValidator;
65
74
  }(abstract_validator_1.AbstractValidator));
66
75
  exports.UpdateBrandValidator = UpdateBrandValidator;
@@ -1,9 +1,12 @@
1
1
  import { AbstractEntity } from '../../../abstract/abstract.entity';
2
2
  import { PropertyEntity } from '../properties/property.entity';
3
+ import { AssetEntity } from '../../assets/asset.entity';
3
4
  export declare class CategoryEntity extends AbstractEntity {
4
5
  static readonly $index = "inventory_categories";
5
6
  name: string;
6
7
  description: string;
7
8
  icon: string;
8
9
  properties: PropertyEntity[];
10
+ image: AssetEntity;
11
+ readonly picture: string;
9
12
  }
@@ -3,9 +3,11 @@ export declare class CreateCategoryValidator extends AbstractValidator {
3
3
  name: string;
4
4
  description?: string;
5
5
  icon: string;
6
+ image: string;
6
7
  }
7
8
  export declare class UpdateCategoryValidator extends AbstractValidator {
8
9
  name: string;
9
10
  description?: string;
10
11
  icon: string;
12
+ image: string;
11
13
  }
@@ -49,6 +49,10 @@ var CreateCategoryValidator = (function (_super) {
49
49
  (0, class_validator_1.IsOptional)(),
50
50
  __metadata("design:type", Object)
51
51
  ], CreateCategoryValidator.prototype, "icon", void 0);
52
+ __decorate([
53
+ (0, class_validator_1.IsMongoId)(),
54
+ __metadata("design:type", String)
55
+ ], CreateCategoryValidator.prototype, "image", void 0);
52
56
  return CreateCategoryValidator;
53
57
  }(abstract_validator_1.AbstractValidator));
54
58
  exports.CreateCategoryValidator = CreateCategoryValidator;
@@ -74,6 +78,11 @@ var UpdateCategoryValidator = (function (_super) {
74
78
  (0, class_validator_1.IsOptional)(),
75
79
  __metadata("design:type", Object)
76
80
  ], UpdateCategoryValidator.prototype, "icon", void 0);
81
+ __decorate([
82
+ (0, class_validator_1.IsMongoId)(),
83
+ (0, class_validator_1.IsOptional)(),
84
+ __metadata("design:type", String)
85
+ ], UpdateCategoryValidator.prototype, "image", void 0);
77
86
  return UpdateCategoryValidator;
78
87
  }(abstract_validator_1.AbstractValidator));
79
88
  exports.UpdateCategoryValidator = UpdateCategoryValidator;
@@ -1,6 +1,6 @@
1
1
  import { User } from 'auth0';
2
2
  import { AbstractEntity } from '../../../abstract/abstract.entity';
3
- import { MetaAddress } from "../../../types";
3
+ import { MetaAddress } from '../../../types';
4
4
  export declare class ClientEntity extends AbstractEntity implements User {
5
5
  static readonly $index = "store_clients";
6
6
  readonly name: string;
@@ -8,4 +8,5 @@ export declare class ClientEntity extends AbstractEntity implements User {
8
8
  readonly phone?: string;
9
9
  readonly identificationNumber: string;
10
10
  readonly addresses: MetaAddress[];
11
+ users: string[];
11
12
  }
@@ -1,5 +1,5 @@
1
- import { MetaAddress } from "../../../types";
2
- import { AbstractValidator } from "../../../abstract/abstract.validator";
1
+ import { MetaAddress } from '../../../types';
2
+ import { AbstractValidator } from '../../../abstract/abstract.validator';
3
3
  export declare class CreateClientValidator extends AbstractValidator {
4
4
  name: string;
5
5
  email: string;
@@ -13,3 +13,6 @@ export declare class UpdateClientValidator extends CreateClientValidator {
13
13
  phone: string;
14
14
  identificationNumber: string;
15
15
  }
16
+ export declare class AddClientUsers {
17
+ ids: string[];
18
+ }
@@ -24,7 +24,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
24
24
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.UpdateClientValidator = exports.CreateClientValidator = void 0;
27
+ exports.AddClientUsers = exports.UpdateClientValidator = exports.CreateClientValidator = void 0;
28
28
  var class_transformer_1 = require("class-transformer");
29
29
  var class_validator_1 = require("class-validator");
30
30
  var abstract_validator_1 = require("../../../abstract/abstract.validator");
@@ -93,3 +93,15 @@ var UpdateClientValidator = (function (_super) {
93
93
  return UpdateClientValidator;
94
94
  }(CreateClientValidator));
95
95
  exports.UpdateClientValidator = UpdateClientValidator;
96
+ var AddClientUsers = (function () {
97
+ function AddClientUsers() {
98
+ }
99
+ __decorate([
100
+ (0, class_validator_1.IsArray)(),
101
+ (0, class_validator_1.IsString)({ each: true }),
102
+ (0, class_validator_1.ArrayMinSize)(1),
103
+ __metadata("design:type", Array)
104
+ ], AddClientUsers.prototype, "ids", void 0);
105
+ return AddClientUsers;
106
+ }());
107
+ exports.AddClientUsers = AddClientUsers;
@@ -13,5 +13,6 @@ export declare class CreateOrganizationValidator implements CreateOrganization {
13
13
  }
14
14
  export declare class UpdateOrganizationValidator implements UpdateOrganization {
15
15
  display_name?: string;
16
+ branding?: UpdateOrganization['branding'];
16
17
  metadata: OrganizationMetadataValidator;
17
18
  }
@@ -72,6 +72,11 @@ var UpdateOrganizationValidator = (function () {
72
72
  (0, class_validator_1.Length)(3, 255),
73
73
  __metadata("design:type", String)
74
74
  ], UpdateOrganizationValidator.prototype, "display_name", void 0);
75
+ __decorate([
76
+ (0, class_validator_1.IsOptional)(),
77
+ (0, class_validator_1.IsObject)(),
78
+ __metadata("design:type", Object)
79
+ ], UpdateOrganizationValidator.prototype, "branding", void 0);
75
80
  __decorate([
76
81
  (0, class_validator_1.IsOptional)(),
77
82
  (0, class_validator_1.ValidateNested)(),
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  <p align="center">
2
- <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
2
+ <a href="https://www.merkaly.io/" target="blank">
3
+ <img src="https://www.merkaly.io/icon.png" width="320" alt="Merkaly Logo" />
4
+ </a>
3
5
  </p>
4
6
 
5
7
  [travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
@@ -34,33 +36,31 @@
34
36
  ## Installation
35
37
 
36
38
  ```bash
37
- $ npm install
39
+ $ yarn install
40
+ ```
41
+
42
+ ## Generate OpenSSL certificate
43
+
44
+ ```bash
45
+ $ mkdir ".cert"
46
+ $ openssl req -x509 -newkey rsa:4096 -nodes -keyout ./.cert/key.pem -out ./.cert/cert.pem -days 365
38
47
  ```
39
48
 
40
49
  ## Running the app
41
50
 
42
51
  ```bash
43
52
  # development
44
- $ npm run start
45
-
46
- # watch mode
47
- $ npm run start:dev
53
+ $ yarn dev
48
54
 
49
55
  # production mode
50
- $ npm run start:prod
56
+ $ npm start
51
57
  ```
52
58
 
53
59
  ## Test
54
60
 
55
61
  ```bash
56
62
  # unit tests
57
- $ npm run test
58
-
59
- # e2e tests
60
- $ npm run test:e2e
61
-
62
- # test coverage
63
- $ npm run test:cov
63
+ $ yarn test
64
64
  ```
65
65
 
66
66
  ## Support
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.2.4-9",
3
+ "version": "0.2.4",
4
4
  "description": "NestJS Backend ApiRest Service",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "license": "UNLICENSED",
10
10
  "author": "Randy Tellez Galan <kronhyx@gmail.com>",
11
- "main": "./src/main",
11
+ "main": "./.output/main",
12
12
  "types": "./.output/types.d.ts",
13
13
  "files": [
14
14
  ".output"
@@ -35,6 +35,7 @@
35
35
  "*.**": "yarn lint --cache --fix"
36
36
  },
37
37
  "dependencies": {
38
+ "@nestjs/common": "^9.0.11",
38
39
  "@types/auth0": "^3.3.1",
39
40
  "class-transformer": "^0.5.1",
40
41
  "class-validator": "^0.14.0",
@@ -47,7 +48,6 @@
47
48
  "@google-cloud/storage": "^6.4.1",
48
49
  "@nestjs/axios": "^2.0.0",
49
50
  "@nestjs/cli": "^9.1.1",
50
- "@nestjs/common": "^9.0.11",
51
51
  "@nestjs/config": "^2.2.0",
52
52
  "@nestjs/core": "^9.0.11",
53
53
  "@nestjs/event-emitter": "^1.3.1",
@@ -55,17 +55,17 @@
55
55
  "@nestjs/mongoose": "^9.2.0",
56
56
  "@nestjs/passport": "^9.0.0",
57
57
  "@nestjs/platform-express": "^9.0.11",
58
- "@nestjs/platform-socket.io": "^9.3.9",
58
+ "@nestjs/platform-socket.io": "^9.4.0",
59
59
  "@nestjs/schematics": "^9.0.1",
60
60
  "@nestjs/swagger": "^6.1.0",
61
61
  "@nestjs/testing": "^9.0.11",
62
- "@nestjs/websockets": "^9.3.9",
62
+ "@nestjs/websockets": "^9.4.0",
63
63
  "@types/cache-manager": "^4.0.1",
64
64
  "@types/express": "^4.17.12",
65
65
  "@types/express-session": "^1.17.5",
66
66
  "@types/jest": "^27.0.0",
67
67
  "@types/multer": "^1.4.7",
68
- "@types/node": "^18.0.0",
68
+ "@types/node": "^20.1.0",
69
69
  "@types/passport-jwt": "^3.0.5",
70
70
  "@types/supertest": "^2.0.11",
71
71
  "@types/uuid": "^9.0.1",
@@ -98,10 +98,10 @@
98
98
  "typescript": "4.4.4",
99
99
  "webpack": "^5"
100
100
  },
101
- "engines": {
102
- "node": ">=16"
103
- },
104
101
  "publishConfig": {
105
102
  "access": "public"
103
+ },
104
+ "engines": {
105
+ "node": ">=16"
106
106
  }
107
107
  }