@merkaly/api 0.1.10-9 → 0.1.10

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 (76) hide show
  1. package/package.json +18 -13
  2. package/src/account/connections/index.d.ts +5 -0
  3. package/src/account/connections/index.d.ts.map +1 -0
  4. package/src/account/connections/index.ts +5 -0
  5. package/src/account/index.d.ts +9 -0
  6. package/src/account/index.d.ts.map +1 -0
  7. package/src/account/index.ts +9 -0
  8. package/src/account/organizations/connections/index.d.ts +5 -0
  9. package/src/account/organizations/connections/index.d.ts.map +1 -0
  10. package/src/account/organizations/connections/index.ts +6 -0
  11. package/src/account/organizations/index.d.ts +9 -0
  12. package/src/account/organizations/index.d.ts.map +1 -0
  13. package/src/account/organizations/index.ts +9 -0
  14. package/src/account/organizations/members/index.d.ts +5 -0
  15. package/src/account/organizations/members/index.d.ts.map +1 -0
  16. package/src/account/organizations/members/index.ts +6 -0
  17. package/src/account/roles/index.d.ts +7 -0
  18. package/src/account/roles/index.d.ts.map +1 -0
  19. package/src/account/roles/index.ts +7 -0
  20. package/src/account/roles/users/index.d.ts +5 -0
  21. package/src/account/roles/users/index.d.ts.map +1 -0
  22. package/src/account/roles/users/index.ts +5 -0
  23. package/src/account/users/index.d.ts +7 -0
  24. package/src/account/users/index.d.ts.map +1 -0
  25. package/src/account/users/index.ts +7 -0
  26. package/src/account/users/roles/index.d.ts +5 -0
  27. package/src/account/users/roles/index.d.ts.map +1 -0
  28. package/src/account/users/roles/index.ts +5 -0
  29. package/src/app.entity.d.ts +5 -3
  30. package/src/app.entity.d.ts.map +1 -1
  31. package/src/app.entity.ts +13 -3
  32. package/src/index.d.ts +3 -0
  33. package/src/index.d.ts.map +1 -0
  34. package/src/index.ts +3 -0
  35. package/src/inventory/brands/brand.entity.d.ts +4 -1
  36. package/src/inventory/brands/brand.entity.d.ts.map +1 -1
  37. package/src/inventory/brands/brand.entity.ts +11 -3
  38. package/src/inventory/categories/category.entity.d.ts +8 -1
  39. package/src/inventory/categories/category.entity.d.ts.map +1 -1
  40. package/src/inventory/categories/category.entity.ts +20 -3
  41. package/src/inventory/categories/category.validator.d.ts +1 -0
  42. package/src/inventory/categories/category.validator.d.ts.map +1 -1
  43. package/src/inventory/categories/category.validator.ts +5 -1
  44. package/src/inventory/products/media/media.entity.d.ts +3 -2
  45. package/src/inventory/products/media/media.entity.d.ts.map +1 -1
  46. package/src/inventory/products/media/media.entity.ts +8 -2
  47. package/src/inventory/products/product.entity.d.ts +11 -9
  48. package/src/inventory/products/product.entity.d.ts.map +1 -1
  49. package/src/inventory/products/product.entity.ts +33 -30
  50. package/src/inventory/products/product.validator.d.ts +9 -9
  51. package/src/inventory/products/product.validator.d.ts.map +1 -1
  52. package/src/inventory/products/product.validator.ts +14 -15
  53. package/src/inventory/products/variants/variant.entity.d.ts +5 -1
  54. package/src/inventory/products/variants/variant.entity.d.ts.map +1 -1
  55. package/src/inventory/products/variants/variant.entity.ts +18 -3
  56. package/src/inventory/properties/property.entity.d.ts +4 -2
  57. package/src/inventory/properties/property.entity.d.ts.map +1 -1
  58. package/src/inventory/properties/property.entity.ts +11 -7
  59. package/src/store/carts/cart.entity.d.ts +7 -4
  60. package/src/store/carts/cart.entity.d.ts.map +1 -1
  61. package/src/store/carts/cart.entity.ts +14 -8
  62. package/src/store/carts/cart.validator.d.ts +0 -2
  63. package/src/store/carts/cart.validator.d.ts.map +1 -1
  64. package/src/store/carts/cart.validator.ts +0 -3
  65. package/src/store/items/item.entity.d.ts +9 -0
  66. package/src/store/items/item.entity.d.ts.map +1 -0
  67. package/src/store/items/item.entity.ts +16 -0
  68. package/src/store/{orders/items → items}/item.validator.d.ts +0 -0
  69. package/src/store/{orders/items → items}/item.validator.d.ts.map +0 -0
  70. package/src/store/{orders/items → items}/item.validator.ts +0 -0
  71. package/src/store/orders/order.entity.d.ts +1 -5
  72. package/src/store/orders/order.entity.d.ts.map +1 -1
  73. package/src/store/orders/order.entity.ts +6 -15
  74. package/src/store/orders/items/item.entity.d.ts +0 -7
  75. package/src/store/orders/items/item.entity.d.ts.map +0 -1
  76. package/src/store/orders/items/item.entity.ts +0 -11
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.1.10-9",
3
+ "version": "0.1.10",
4
4
  "description": "NestJS Backend ApiRest Service",
5
5
  "author": "Randy Tellez Galan <kronhyx@gmail.com>",
6
6
  "license": "UNLICENSED",
7
+ "main": "./src/index.ts",
8
+ "types": "./src/index.d.ts",
7
9
  "scripts": {
8
10
  "prebuild": "yarn run clean",
9
11
  "prepack": "yarn build",
@@ -22,36 +24,36 @@
22
24
  "semantic-release": "yarn run build:package && semantic-release"
23
25
  },
24
26
  "dependencies": {
25
- "@nestjs/axios": "^0.0.6",
26
- "@nestjs/swagger": "^5.0.9",
27
27
  "@types/auth0": "^2.33.4",
28
- "@types/node": "^17.0.2",
29
28
  "auth0": "^2.35.0",
30
29
  "class-transformer": "^0.5.1",
31
30
  "class-validator": "^0.13.1",
32
- "fireorm": "^0.23.0",
33
31
  "reflect-metadata": "^0.1.13"
34
32
  },
35
33
  "devDependencies": {
36
34
  "@commitlint/config-conventional": "^16.0.0",
37
35
  "@elastic/elasticsearch": "^8.0.0",
38
- "@nestjs/cli": "8.2.1",
36
+ "@nestjs/axios": "^0.0.7",
37
+ "@nestjs/cli": "8.2.2",
39
38
  "@nestjs/common": "8.4.0",
40
39
  "@nestjs/config": "^1.0.0",
41
- "@nestjs/core": "8.3.1",
40
+ "@nestjs/core": "8.4.0",
42
41
  "@nestjs/elasticsearch": "8.1.0",
43
42
  "@nestjs/event-emitter": "^1.0.0",
44
43
  "@nestjs/jwt": "8.0.0",
45
44
  "@nestjs/passport": "8.2.1",
46
- "@nestjs/platform-express": "8.3.1",
47
- "@nestjs/schematics": "8.0.7",
48
- "@nestjs/testing": "8.3.1",
45
+ "@nestjs/platform-express": "8.4.0",
46
+ "@nestjs/schematics": "8.0.8",
47
+ "@nestjs/swagger": "^5.0.9",
48
+ "@nestjs/testing": "8.4.0",
49
+ "@nestjs/typeorm": "^8.0.3",
49
50
  "@semantic-release/exec": "^6.0.1",
50
51
  "@semantic-release/git": "^10.0.0",
51
52
  "@types/express": "^4.17.12",
52
53
  "@types/faker": "^5.5.9",
53
54
  "@types/jest": "^27.0.0",
54
55
  "@types/multer": "^1.4.7",
56
+ "@types/node": "^17.0.21",
55
57
  "@types/passport-jwt": "^3.0.5",
56
58
  "@types/supertest": "^2.0.11",
57
59
  "@typescript-eslint/eslint-plugin": "4.33.0",
@@ -59,11 +61,11 @@
59
61
  "commitlint": "^16.1.0",
60
62
  "eslint": "7.32.0",
61
63
  "eslint-plugin-import": "^2.23.4",
64
+ "express": "^4.17.3",
62
65
  "faker": "^5.5.3",
63
- "firebase": "^9.0.0",
64
- "firebase-admin": "^10.0.2",
65
66
  "husky": "^7.0.0",
66
67
  "jest": "27.5.1",
68
+ "mysql2": "^2.3.3",
67
69
  "passport": "^0.5.2",
68
70
  "passport-jwt": "^4.0.0",
69
71
  "rimraf": "^3.0.2",
@@ -74,7 +76,10 @@
74
76
  "ts-jest": "27.1.3",
75
77
  "ts-loader": "^9.2.3",
76
78
  "ts-node": "^10.0.0",
77
- "tsconfig-paths": "^3.9.0"
79
+ "tsconfig-paths": "^3.9.0",
80
+ "typeorm": "^0.2.45",
81
+ "typescript": "^4.6.2",
82
+ "webpack": "^5"
78
83
  },
79
84
  "repository": {
80
85
  "type": "git",
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0';
2
+ import * as validator from './connection.validator';
3
+ export import Entity = Auth0.Connection;
4
+ export import Validator = validator;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAEnD,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,UAAU,CAAA;AACvC,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0'
2
+ import * as validator from './connection.validator'
3
+
4
+ export import Entity = Auth0.Connection
5
+ export import Validator = validator
@@ -0,0 +1,9 @@
1
+ import * as connections from './connections';
2
+ import * as organizations from './organizations';
3
+ import * as roles from './roles';
4
+ import * as users from './users';
5
+ export import Connection = connections;
6
+ export import Organization = organizations;
7
+ export import Role = roles;
8
+ export import User = users;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAEhC,MAAM,QAAQ,UAAU,GAAG,WAAW,CAAA;AACtC,MAAM,QAAQ,YAAY,GAAG,aAAa,CAAA;AAC1C,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAA;AAC1B,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAA"}
@@ -0,0 +1,9 @@
1
+ import * as connections from './connections'
2
+ import * as organizations from './organizations'
3
+ import * as roles from './roles'
4
+ import * as users from './users'
5
+
6
+ export import Connection = connections
7
+ export import Organization = organizations
8
+ export import Role = roles
9
+ export import User = users
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0';
2
+ import * as validator from './connection.validator';
3
+ export import Entity = Auth0.OrganizationConnection;
4
+ export import Validator = validator;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAEnD,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,sBAAsB,CAAA;AAEnD,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ import Auth0 from 'auth0'
2
+ import * as validator from './connection.validator'
3
+
4
+ export import Entity = Auth0.OrganizationConnection
5
+
6
+ export import Validator = validator
@@ -0,0 +1,9 @@
1
+ import Auth0 from 'auth0';
2
+ import * as connections from './connections';
3
+ import * as members from './members';
4
+ import * as validator from './organization.validator';
5
+ export import Entity = Auth0.Organization;
6
+ export import Connection = connections;
7
+ export import Member = members;
8
+ export import Validator = validator;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,WAAW,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAA;AAErD,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,YAAY,CAAA;AACzC,MAAM,QAAQ,UAAU,GAAG,WAAW,CAAA;AACtC,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAA;AAC9B,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,9 @@
1
+ import Auth0 from 'auth0'
2
+ import * as connections from './connections'
3
+ import * as members from './members'
4
+ import * as validator from './organization.validator'
5
+
6
+ export import Entity = Auth0.Organization
7
+ export import Connection = connections
8
+ export import Member = members
9
+ export import Validator = validator
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0';
2
+ import * as validator from './member.validator';
3
+ export import Entity = Auth0.OrganizationMember;
4
+ export import Validator = validator;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAE/C,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,kBAAkB,CAAA;AAE/C,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ import Auth0 from 'auth0'
2
+ import * as validator from './member.validator'
3
+
4
+ export import Entity = Auth0.OrganizationMember
5
+
6
+ export import Validator = validator
@@ -0,0 +1,7 @@
1
+ import Auth0 from 'auth0';
2
+ import * as validator from './role.validator';
3
+ import * as users from './users';
4
+ export import Entity = Auth0.Role;
5
+ export import User = users;
6
+ export import Validator = validator;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAEhC,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,IAAI,CAAA;AACjC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAA;AAC1B,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,7 @@
1
+ import Auth0 from 'auth0'
2
+ import * as validator from './role.validator'
3
+ import * as users from './users'
4
+
5
+ export import Entity = Auth0.Role
6
+ export import User = users
7
+ export import Validator = validator
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0';
2
+ import * as validator from './user.validator';
3
+ export import Entity = Auth0.User;
4
+ export import Validator = validator;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAE7C,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,IAAI,CAAA;AACjC,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0'
2
+ import * as validator from './user.validator'
3
+
4
+ export import Entity = Auth0.User
5
+ export import Validator = validator
@@ -0,0 +1,7 @@
1
+ import Auth0 from 'auth0';
2
+ import * as roles from './roles';
3
+ import * as validator from './user.validator';
4
+ export import Entity = Auth0.User;
5
+ export import Role = roles;
6
+ export import Validator = validator;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAE7C,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,IAAI,CAAA;AACjC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAA;AAC1B,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,7 @@
1
+ import Auth0 from 'auth0'
2
+ import * as roles from './roles'
3
+ import * as validator from './user.validator'
4
+
5
+ export import Entity = Auth0.User
6
+ export import Role = roles
7
+ export import Validator = validator
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0';
2
+ import * as validator from './role.validator';
3
+ export import Entity = Auth0.Role;
4
+ export import Validator = validator;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAE7C,MAAM,QAAQ,MAAM,GAAG,KAAK,CAAC,IAAI,CAAA;AACjC,MAAM,QAAQ,SAAS,GAAG,SAAS,CAAA"}
@@ -0,0 +1,5 @@
1
+ import Auth0 from 'auth0'
2
+ import * as validator from './role.validator'
3
+
4
+ export import Entity = Auth0.Role
5
+ export import Validator = validator
@@ -1,7 +1,9 @@
1
1
  import { TransformFnParams } from 'class-transformer';
2
- import { IEntity } from 'fireorm';
3
- export default abstract class AppEntity implements IEntity {
4
- id: string;
2
+ export declare abstract class AppEntity {
3
+ id: number;
4
+ readonly createdAt: any;
5
+ readonly updatedAt: any;
6
+ readonly deletedAt: any;
5
7
  static transformSubCollection({ value }: TransformFnParams): string;
6
8
  }
7
9
  //# sourceMappingURL=app.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.entity.d.ts","sourceRoot":"","sources":["app.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAU,YAAW,OAAO;IACjD,EAAE,EAAE,MAAM,CAAA;WAEH,sBAAsB,CAAE,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAI5E"}
1
+ {"version":3,"file":"app.entity.d.ts","sourceRoot":"","sources":["app.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAGrD,8BAAsB,SAAS;IAEtB,EAAE,EAAE,MAAM,CAAA;IAEjB,SACgB,SAAS,MAAA;IAEzB,SACgB,SAAS,MAAA;IAEzB,SACgB,SAAS,MAAA;WAEX,sBAAsB,CAAE,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAI5E"}
package/src/app.entity.ts CHANGED
@@ -1,8 +1,18 @@
1
1
  import { TransformFnParams } from 'class-transformer'
2
- import { IEntity } from 'fireorm'
2
+ import { CreateDateColumn, DeleteDateColumn, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
3
3
 
4
- export default abstract class AppEntity implements IEntity {
5
- public id: string
4
+ export abstract class AppEntity {
5
+ @PrimaryGeneratedColumn()
6
+ public id: number
7
+
8
+ @CreateDateColumn()
9
+ public readonly createdAt
10
+
11
+ @UpdateDateColumn()
12
+ public readonly updatedAt
13
+
14
+ @DeleteDateColumn()
15
+ public readonly deletedAt
6
16
 
7
17
  public static transformSubCollection ({ value }: TransformFnParams): string {
8
18
  return value.path
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import * as account from './account';
2
+ export import Account = account;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AAEpC,MAAM,QAAQ,OAAO,GAAG,OAAO,CAAA"}
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ import * as account from './account'
2
+
3
+ export import Account = account
@@ -1,5 +1,8 @@
1
- import AppEntity from '../../app.entity';
1
+ import { AppEntity } from '../../app.entity';
2
+ import { ProductEntity } from '../products/product.entity';
2
3
  export declare class BrandEntity extends AppEntity {
3
4
  name: string;
5
+ description: string;
6
+ products: ProductEntity[];
4
7
  }
5
8
  //# sourceMappingURL=brand.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"brand.entity.d.ts","sourceRoot":"","sources":["brand.entity.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAA;AAExC,qBACa,WAAY,SAAQ,SAAS;IACxC,IAAI,EAAE,MAAM,CAAA;CACb"}
1
+ {"version":3,"file":"brand.entity.d.ts","sourceRoot":"","sources":["brand.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,qBACa,WAAY,SAAQ,SAAS;IAExC,IAAI,EAAE,MAAM,CAAA;IAGZ,WAAW,EAAE,MAAM,CAAA;IAGnB,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B"}
@@ -1,7 +1,15 @@
1
- import { Collection } from 'fireorm'
2
- import AppEntity from '../../app.entity'
1
+ import { Column, Entity, OneToMany } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
3
+ import { ProductEntity } from '../products/product.entity'
3
4
 
4
- @Collection('inventory-brands')
5
+ @Entity('inventory_brands')
5
6
  export class BrandEntity extends AppEntity {
7
+ @Column({ length: 32, unique: true })
6
8
  name: string
9
+
10
+ @Column({ type: 'text', nullable: true })
11
+ description: string
12
+
13
+ @OneToMany(() => ProductEntity, product => product.brand)
14
+ products: ProductEntity[]
7
15
  }
@@ -1,5 +1,12 @@
1
- import AppEntity from '../../app.entity';
1
+ import { AppEntity } from '../../app.entity';
2
+ import { ProductEntity } from '../products/product.entity';
3
+ import { PropertyEntity } from '../properties/property.entity';
2
4
  export declare class CategoryEntity extends AppEntity {
3
5
  name: string;
6
+ description: string;
7
+ parent?: CategoryEntity;
8
+ children: CategoryEntity[];
9
+ products: ProductEntity[];
10
+ properties: PropertyEntity[];
4
11
  }
5
12
  //# sourceMappingURL=category.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"category.entity.d.ts","sourceRoot":"","sources":["category.entity.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAA;AAExC,qBACa,cAAe,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAA;CAEb"}
1
+ {"version":3,"file":"category.entity.d.ts","sourceRoot":"","sources":["category.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,qBACa,cAAe,SAAQ,SAAS;IAE3C,IAAI,EAAE,MAAM,CAAA;IAGZ,WAAW,EAAE,MAAM,CAAA;IAGnB,MAAM,CAAC,EAAE,cAAc,CAAA;IAGvB,QAAQ,EAAE,cAAc,EAAE,CAAA;IAG1B,QAAQ,EAAE,aAAa,EAAE,CAAA;IAGlB,UAAU,EAAE,cAAc,EAAE,CAAA;CACpC"}
@@ -1,8 +1,25 @@
1
- import { Collection } from 'fireorm'
2
- import AppEntity from '../../app.entity'
1
+ import { Column, Entity, ManyToOne, OneToMany } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
3
+ import { ProductEntity } from '../products/product.entity'
4
+ import { PropertyEntity } from '../properties/property.entity'
3
5
 
4
- @Collection('inventory-categories')
6
+ @Entity('inventory_categories')
5
7
  export class CategoryEntity extends AppEntity {
8
+ @Column({ length: 32, unique: true })
6
9
  name: string
7
10
 
11
+ @Column({ type: 'text', nullable: true })
12
+ description: string
13
+
14
+ @ManyToOne(() => CategoryEntity, c => c.children)
15
+ parent?: CategoryEntity
16
+
17
+ @OneToMany(() => CategoryEntity, c => c.parent)
18
+ children: CategoryEntity[]
19
+
20
+ @OneToMany(() => ProductEntity, p => p.category)
21
+ products: ProductEntity[]
22
+
23
+ @OneToMany(() => PropertyEntity, p => p.category, { eager: true })
24
+ public properties: PropertyEntity[]
8
25
  }
@@ -2,6 +2,7 @@ export declare class FindCategoryValidator {
2
2
  }
3
3
  export declare class CreateCategoryValidator {
4
4
  name: string;
5
+ description?: string;
5
6
  }
6
7
  export declare type IdCategoryValidator = string;
7
8
  export declare class UpdateCategoryValidator {
@@ -1 +1 @@
1
- {"version":3,"file":"category.validator.d.ts","sourceRoot":"","sources":["category.validator.ts"],"names":[],"mappings":"AAEA,qBAAa,qBAAqB;CACjC;AAED,qBAAa,uBAAuB;IAElC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,oBAAY,mBAAmB,GAAG,MAAM,CAAA;AAExC,qBAAa,uBAAuB;IAElC,IAAI,EAAE,MAAM,CAAA;CACb"}
1
+ {"version":3,"file":"category.validator.d.ts","sourceRoot":"","sources":["category.validator.ts"],"names":[],"mappings":"AAEA,qBAAa,qBAAqB;CACjC;AAED,qBAAa,uBAAuB;IAElC,IAAI,EAAE,MAAM,CAAA;IAIZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,oBAAY,mBAAmB,GAAG,MAAM,CAAA;AAExC,qBAAa,uBAAuB;IAElC,IAAI,EAAE,MAAM,CAAA;CACb"}
@@ -1,4 +1,4 @@
1
- import { IsString } from 'class-validator'
1
+ import { IsOptional, IsString } from 'class-validator'
2
2
 
3
3
  export class FindCategoryValidator {
4
4
  }
@@ -6,6 +6,10 @@ export class FindCategoryValidator {
6
6
  export class CreateCategoryValidator {
7
7
  @IsString()
8
8
  name: string
9
+
10
+ @IsString()
11
+ @IsOptional()
12
+ description?: string
9
13
  }
10
14
 
11
15
  export type IdCategoryValidator = string
@@ -1,6 +1,7 @@
1
- import AppEntity from '../../../app.entity';
1
+ import { AppEntity } from '../../../app.entity';
2
+ import { ProductEntity } from '../product.entity';
2
3
  export declare class MediaEntity extends AppEntity {
3
4
  name: string;
4
- price: number;
5
+ products: ProductEntity;
5
6
  }
6
7
  //# sourceMappingURL=media.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"media.entity.d.ts","sourceRoot":"","sources":["media.entity.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAE3C,qBAAa,WAAY,SAAQ,SAAS;IACxC,IAAI,EAAE,MAAM,CAAA;IAEZ,KAAK,EAAE,MAAM,CAAA;CACd"}
1
+ {"version":3,"file":"media.entity.d.ts","sourceRoot":"","sources":["media.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,qBACa,WAAY,SAAQ,SAAS;IAGxC,IAAI,EAAE,MAAM,CAAA;IAGL,QAAQ,EAAE,aAAa,CAAA;CAC/B"}
@@ -1,7 +1,13 @@
1
- import AppEntity from '../../../app.entity'
1
+ import { Column, Entity, ManyToOne } from 'typeorm'
2
+ import { AppEntity } from '../../../app.entity'
3
+ import { ProductEntity } from '../product.entity'
2
4
 
5
+ @Entity('inventory_products_media')
3
6
  export class MediaEntity extends AppEntity {
7
+
8
+ @Column({})
4
9
  name: string
5
10
 
6
- price: number
11
+ @ManyToOne(() => ProductEntity, (p) => p.media)
12
+ public products: ProductEntity
7
13
  }
@@ -1,7 +1,7 @@
1
- import { ISubCollection } from 'fireorm';
2
- import AppEntity from '../../app.entity';
1
+ import { AppEntity } from '../../app.entity';
3
2
  import { BrandEntity } from '../brands/brand.entity';
4
3
  import { CategoryEntity } from '../categories/category.entity';
4
+ import { PropertyEntity } from '../properties/property.entity';
5
5
  import { MediaEntity } from './media/media.entity';
6
6
  import { VariantEntity } from './variants/variant.entity';
7
7
  export declare enum PRODUCT_UNIT {
@@ -13,20 +13,22 @@ export declare enum PRODUCT_UNIT {
13
13
  }
14
14
  export declare enum PRODUCT_STATUS {
15
15
  DRAFT = "DRAFT",
16
- ACTIVE = "ACTIVE",
17
- INACTIVE = "INACTIVE"
16
+ PUBLISHED = "PUBLISHED",
17
+ PAUSED = "PAUSED",
18
+ EXHAUSTED = "EXHAUSTED"
18
19
  }
19
20
  export declare class ProductEntity extends AppEntity {
20
21
  name: string;
21
- description: string;
22
- price: number;
22
+ description?: string;
23
23
  unit: PRODUCT_UNIT;
24
24
  status: PRODUCT_STATUS;
25
25
  availableFrom?: Date;
26
26
  hashtags: string[];
27
27
  category?: CategoryEntity;
28
- brand: BrandEntity;
29
- variants?: ISubCollection<VariantEntity>;
30
- media?: ISubCollection<MediaEntity>;
28
+ brand?: BrandEntity;
29
+ properties: PropertyEntity[];
30
+ variants: VariantEntity[];
31
+ media: MediaEntity[];
32
+ get masterVariant(): VariantEntity;
31
33
  }
32
34
  //# sourceMappingURL=product.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.entity.d.ts","sourceRoot":"","sources":["product.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,cAAc,EAAuB,MAAM,SAAS,CAAA;AACzE,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED,qBACa,aAAc,SAAQ,SAAS;IAE1C,IAAI,EAAE,MAAM,CAAA;IAGZ,WAAW,EAAE,MAAM,CAAA;IAGnB,KAAK,EAAE,MAAM,CAAA;IAGb,IAAI,EAAE,YAAY,CAAwB;IAG1C,MAAM,EAAE,cAAc,CAAuB;IAG7C,aAAa,CAAC,EAAE,IAAI,CAAA;IAGpB,QAAQ,EAAE,MAAM,EAAE,CAAK;IAGvB,QAAQ,CAAC,EAAE,cAAc,CAAA;IAGzB,KAAK,EAAE,WAAW,CAAA;IAIlB,QAAQ,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAA;IAIxC,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CACpC"}
1
+ {"version":3,"file":"product.entity.d.ts","sourceRoot":"","sources":["product.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,qBACa,aAAc,SAAQ,SAAS;IAEnC,IAAI,EAAE,MAAM,CAAA;IAGZ,WAAW,CAAC,EAAE,MAAM,CAAA;IAGpB,IAAI,EAAE,YAAY,CAAwB;IAG1C,MAAM,EAAE,cAAc,CAAuB;IAG7C,aAAa,CAAC,EAAE,IAAI,CAAA;IAGpB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAGlB,QAAQ,CAAC,EAAE,cAAc,CAAA;IAGzB,KAAK,CAAC,EAAE,WAAW,CAAA;IAGnB,UAAU,EAAE,cAAc,EAAE,CAAA;IAG5B,QAAQ,EAAE,aAAa,EAAE,CAAA;IAGzB,KAAK,EAAE,WAAW,EAAE,CAAA;IAE3B,IAAW,aAAa,kBAEvB;CACF"}
@@ -1,8 +1,8 @@
1
- import { Transform } from 'class-transformer'
2
- import { Collection, ISubCollection, SubCollection, Type } from 'fireorm'
3
- import AppEntity from '../../app.entity'
1
+ import { Column, Entity, ManyToOne, OneToMany } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
4
3
  import { BrandEntity } from '../brands/brand.entity'
5
4
  import { CategoryEntity } from '../categories/category.entity'
5
+ import { PropertyEntity } from '../properties/property.entity'
6
6
  import { MediaEntity } from './media/media.entity'
7
7
  import { VariantEntity } from './variants/variant.entity'
8
8
 
@@ -16,44 +16,47 @@ export enum PRODUCT_UNIT {
16
16
 
17
17
  export enum PRODUCT_STATUS {
18
18
  DRAFT = 'DRAFT',
19
- ACTIVE = 'ACTIVE',
20
- INACTIVE = 'INACTIVE',
19
+ PUBLISHED = 'PUBLISHED',
20
+ PAUSED = 'PAUSED',
21
+ EXHAUSTED = 'EXHAUSTED',
21
22
  }
22
23
 
23
- @Collection('inventory-products')
24
+ @Entity('inventory_products')
24
25
  export class ProductEntity extends AppEntity {
25
- @Type(() => String)
26
- name: string
26
+ @Column({ length: 64 })
27
+ public name: string
27
28
 
28
- @Type(() => String)
29
- description: string
29
+ @Column({ nullable: true })
30
+ public description?: string
30
31
 
31
- @Type(() => Number)
32
- price: number
32
+ @Column({ type: 'enum', enum: PRODUCT_UNIT, default: PRODUCT_UNIT.QUANTITY })
33
+ public unit: PRODUCT_UNIT = PRODUCT_UNIT.QUANTITY
33
34
 
34
- @Type(() => String)
35
- unit: PRODUCT_UNIT = PRODUCT_UNIT.QUANTITY
35
+ @Column({ type: 'enum', enum: PRODUCT_STATUS, default: PRODUCT_STATUS.DRAFT })
36
+ public status: PRODUCT_STATUS = PRODUCT_STATUS.DRAFT
36
37
 
37
- @Type(() => String)
38
- status: PRODUCT_STATUS = PRODUCT_STATUS.DRAFT
38
+ @Column({ type: 'date', nullable: true })
39
+ public availableFrom?: Date
39
40
 
40
- @Type(() => Date)
41
- availableFrom?: Date
41
+ @Column('simple-array')
42
+ public hashtags: string[]
42
43
 
43
- @Type(() => Array)
44
- hashtags: string[] = []
44
+ @ManyToOne(() => CategoryEntity, c => c.products, { eager: true })
45
+ public category?: CategoryEntity
45
46
 
46
- @Type(() => CategoryEntity)
47
- category?: CategoryEntity
47
+ @ManyToOne(() => BrandEntity, b => b.products, { eager: true })
48
+ public brand?: BrandEntity
48
49
 
49
- @Type(() => BrandEntity)
50
- brand: BrandEntity
50
+ @OneToMany(() => PropertyEntity, p => p.products, { eager: true })
51
+ public properties: PropertyEntity[]
51
52
 
52
- @SubCollection(VariantEntity, 'variants')
53
- @Transform(AppEntity.transformSubCollection)
54
- variants?: ISubCollection<VariantEntity>
53
+ @OneToMany(() => VariantEntity, v => v.product, { eager: true })
54
+ public variants: VariantEntity[]
55
55
 
56
- @SubCollection(MediaEntity, 'media')
57
- @Transform(AppEntity.transformSubCollection)
58
- media?: ISubCollection<MediaEntity>
56
+ @OneToMany(() => MediaEntity, m => m.products, { eager: true })
57
+ public media: MediaEntity[]
58
+
59
+ public get masterVariant () {
60
+ return this.variants.find(variant => variant.master)
61
+ }
59
62
  }
@@ -4,22 +4,22 @@ export declare class FindProductValidator {
4
4
  export declare class CreateProductValidator {
5
5
  name: string;
6
6
  price: number;
7
- description: string;
8
- category: string;
9
- brand: string;
7
+ description?: string;
8
+ category?: number;
9
+ brand?: number;
10
10
  unit: PRODUCT_UNIT;
11
11
  status: PRODUCT_STATUS;
12
12
  hashtags: string[];
13
13
  }
14
- export declare type IdProductValidator = string;
14
+ export declare type IdProductValidator = number;
15
15
  export declare class UpdateProductValidator {
16
16
  name?: string;
17
17
  price?: number;
18
18
  description?: string;
19
- category?: string;
20
- brand?: string;
21
- unit: PRODUCT_UNIT;
22
- status: PRODUCT_STATUS;
23
- hashtags: string[];
19
+ category?: number;
20
+ brand?: number;
21
+ unit?: PRODUCT_UNIT;
22
+ status?: PRODUCT_STATUS;
23
+ hashtags?: string[];
24
24
  }
25
25
  //# sourceMappingURL=product.validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.validator.d.ts","sourceRoot":"","sources":["product.validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/D,qBAAa,oBAAoB;CAEhC;AAED,qBAAa,sBAAsB;IAGjC,IAAI,EAAE,MAAM,CAAA;IAGZ,KAAK,EAAE,MAAM,CAAA;IAIb,WAAW,EAAG,MAAM,CAAA;IAIpB,QAAQ,EAAG,MAAM,CAAA;IAIjB,KAAK,EAAG,MAAM,CAAA;IAId,IAAI,EAAE,YAAY,CAAwB;IAI1C,MAAM,EAAE,cAAc,CAAuB;IAI7C,QAAQ,EAAE,MAAM,EAAE,CAAK;CACxB;AAED,oBAAY,kBAAkB,GAAG,MAAM,CAAA;AAEvC,qBAAa,sBAAsB;IAGjC,IAAI,CAAC,EAAE,MAAM,CAAA;IAIb,KAAK,CAAC,EAAE,MAAM,CAAA;IAId,WAAW,CAAC,EAAE,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,KAAK,CAAC,EAAE,MAAM,CAAA;IAId,IAAI,EAAE,YAAY,CAAwB;IAI1C,MAAM,EAAE,cAAc,CAAuB;IAI7C,QAAQ,EAAE,MAAM,EAAE,CAAK;CAExB"}
1
+ {"version":3,"file":"product.validator.d.ts","sourceRoot":"","sources":["product.validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/D,qBAAa,oBAAoB;CAEhC;AAED,qBAAa,sBAAsB;IAGjC,IAAI,EAAE,MAAM,CAAA;IAGZ,KAAK,EAAE,MAAM,CAAA;IAIb,WAAW,CAAC,EAAE,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,KAAK,CAAC,EAAE,MAAM,CAAA;IAId,IAAI,EAAE,YAAY,CAAwB;IAI1C,MAAM,EAAE,cAAc,CAAuB;IAI7C,QAAQ,EAAE,MAAM,EAAE,CAAK;CACxB;AAED,oBAAY,kBAAkB,GAAG,MAAM,CAAA;AAEvC,qBAAa,sBAAsB;IAGjC,IAAI,CAAC,EAAE,MAAM,CAAA;IAIb,KAAK,CAAC,EAAE,MAAM,CAAA;IAId,WAAW,CAAC,EAAE,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAIjB,KAAK,CAAC,EAAE,MAAM,CAAA;IAId,IAAI,CAAC,EAAE,YAAY,CAAA;IAInB,MAAM,CAAC,EAAE,cAAc,CAAA;IAIvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB"}
@@ -1,4 +1,4 @@
1
- import { IsEnum, IsFirebasePushId, IsOptional, IsPositive, IsString } from 'class-validator'
1
+ import { IsEnum, IsOptional, IsPositive, IsString } from 'class-validator'
2
2
  import { PRODUCT_STATUS, PRODUCT_UNIT } from './product.entity'
3
3
 
4
4
  export class FindProductValidator {
@@ -15,15 +15,15 @@ export class CreateProductValidator {
15
15
 
16
16
  @IsString()
17
17
  @IsOptional()
18
- description!: string
18
+ description?: string
19
19
 
20
20
  @IsOptional()
21
- @IsFirebasePushId()
22
- category!: string
21
+ @IsPositive()
22
+ category?: number
23
23
 
24
24
  @IsOptional()
25
- @IsFirebasePushId()
26
- brand!: string
25
+ @IsPositive()
26
+ brand?: number
27
27
 
28
28
  @IsOptional()
29
29
  @IsEnum(PRODUCT_UNIT)
@@ -38,7 +38,7 @@ export class CreateProductValidator {
38
38
  hashtags: string[] = []
39
39
  }
40
40
 
41
- export type IdProductValidator = string
41
+ export type IdProductValidator = number
42
42
 
43
43
  export class UpdateProductValidator {
44
44
  @IsString()
@@ -54,23 +54,22 @@ export class UpdateProductValidator {
54
54
  description?: string
55
55
 
56
56
  @IsOptional()
57
- @IsFirebasePushId()
58
- category?: string
57
+ @IsPositive()
58
+ category?: number
59
59
 
60
60
  @IsOptional()
61
- @IsFirebasePushId()
62
- brand?: string
61
+ @IsPositive()
62
+ brand?: number
63
63
 
64
64
  @IsOptional()
65
65
  @IsEnum(PRODUCT_UNIT)
66
- unit: PRODUCT_UNIT = PRODUCT_UNIT.QUANTITY
66
+ unit?: PRODUCT_UNIT
67
67
 
68
68
  @IsOptional()
69
69
  @IsEnum(PRODUCT_STATUS)
70
- status: PRODUCT_STATUS = PRODUCT_STATUS.DRAFT
70
+ status?: PRODUCT_STATUS
71
71
 
72
72
  @IsOptional()
73
73
  @IsString({ each: true })
74
- hashtags: string[] = []
75
-
74
+ hashtags?: string[]
76
75
  }
@@ -1,6 +1,10 @@
1
- import AppEntity from '../../../app.entity';
1
+ import { AppEntity } from '../../../app.entity';
2
+ import { ProductEntity } from '../product.entity';
2
3
  export declare class VariantEntity extends AppEntity {
3
4
  name: string;
4
5
  price: number;
6
+ quantity: number;
7
+ master: boolean;
8
+ product: ProductEntity;
5
9
  }
6
10
  //# sourceMappingURL=variant.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variant.entity.d.ts","sourceRoot":"","sources":["variant.entity.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAE3C,qBAAa,aAAc,SAAQ,SAAS;IAC1C,IAAI,EAAE,MAAM,CAAA;IAEZ,KAAK,EAAE,MAAM,CAAA;CACd"}
1
+ {"version":3,"file":"variant.entity.d.ts","sourceRoot":"","sources":["variant.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,qBACa,aAAc,SAAQ,SAAS;IAGnC,IAAI,EAAE,MAAM,CAAA;IAGZ,KAAK,SAAI;IAGT,QAAQ,SAAI;IAGZ,MAAM,UAAQ;IAGd,OAAO,EAAE,aAAa,CAAA;CAC9B"}
@@ -1,7 +1,22 @@
1
- import AppEntity from '../../../app.entity'
1
+ import { Column, Entity, ManyToOne } from 'typeorm'
2
+ import { AppEntity } from '../../../app.entity'
3
+ import { ProductEntity } from '../product.entity'
2
4
 
5
+ @Entity('inventory_products_variants')
3
6
  export class VariantEntity extends AppEntity {
4
- name: string
5
7
 
6
- price: number
8
+ @Column({ length: 64 })
9
+ public name: string
10
+
11
+ @Column({ type: 'float', default: 0 })
12
+ public price = 0
13
+
14
+ @Column({ type: 'int', default: 1 })
15
+ public quantity = 1
16
+
17
+ @Column({ type: 'boolean', default: false })
18
+ public master = false
19
+
20
+ @ManyToOne(() => ProductEntity, (p) => p.variants)
21
+ public product: ProductEntity
7
22
  }
@@ -1,8 +1,10 @@
1
- import AppEntity from '../../app.entity';
1
+ import { AppEntity } from '../../app.entity';
2
2
  import { CategoryEntity } from '../categories/category.entity';
3
+ import { ProductEntity } from '../products/product.entity';
3
4
  export declare class PropertyEntity extends AppEntity {
4
5
  name: string;
5
6
  values: string[];
6
- category: CategoryEntity;
7
+ category?: CategoryEntity;
8
+ products: ProductEntity[];
7
9
  }
8
10
  //# sourceMappingURL=property.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"property.entity.d.ts","sourceRoot":"","sources":["property.entity.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,qBACa,cAAe,SAAQ,SAAS;IAE3C,IAAI,EAAE,MAAM,CAAA;IAGZ,MAAM,EAAE,MAAM,EAAE,CAAA;IAGhB,QAAQ,EAAE,cAAc,CAAA;CAEzB"}
1
+ {"version":3,"file":"property.entity.d.ts","sourceRoot":"","sources":["property.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,qBACa,cAAe,SAAQ,SAAS;IAE3C,IAAI,EAAE,MAAM,CAAA;IAGZ,MAAM,EAAE,MAAM,EAAE,CAAA;IAGT,QAAQ,CAAC,EAAE,cAAc,CAAA;IAGzB,QAAQ,EAAE,aAAa,EAAE,CAAA;CAEjC"}
@@ -1,16 +1,20 @@
1
- import { Collection, Type } from 'fireorm'
2
- import AppEntity from '../../app.entity'
1
+ import { Column, Entity, ManyToOne } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
3
3
  import { CategoryEntity } from '../categories/category.entity'
4
+ import { ProductEntity } from '../products/product.entity'
4
5
 
5
- @Collection('inventory-properties')
6
+ @Entity('inventory_properties')
6
7
  export class PropertyEntity extends AppEntity {
7
- @Type(() => String)
8
+ @Column({ length: 24 })
8
9
  name: string
9
10
 
10
- @Type(() => Array)
11
+ @Column('simple-array')
11
12
  values: string[]
12
13
 
13
- @Type(() => CategoryEntity)
14
- category: CategoryEntity
14
+ @ManyToOne(() => CategoryEntity, null, { eager: true })
15
+ public category?: CategoryEntity
16
+
17
+ @ManyToOne(() => ProductEntity, product => product.properties)
18
+ public products: ProductEntity[]
15
19
 
16
20
  }
@@ -1,14 +1,17 @@
1
- import AppEntity from '../../app.entity';
2
- import { ItemEntity } from '../orders/items/item.entity';
1
+ import { AppEntity } from '../../app.entity';
2
+ import { ItemEntity } from '../items/item.entity';
3
+ import { OrderEntity } from '../orders/order.entity';
3
4
  export declare enum CART_STATUS {
4
5
  EMPTY = "EMPTY",
5
- FILLED = "FILLED",
6
+ SAVED = "SAVED",
7
+ ACTIVE = "ACTIVE",
8
+ DELETED = "DELETED",
6
9
  ABANDONED = "ABANDONED",
7
10
  FINALIZED = "FINALIZED"
8
11
  }
9
12
  export declare class CartEntity extends AppEntity {
10
- user: string;
11
13
  status: CART_STATUS;
12
14
  items: ItemEntity[];
15
+ order: OrderEntity[];
13
16
  }
14
17
  //# sourceMappingURL=cart.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.entity.d.ts","sourceRoot":"","sources":["cart.entity.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,qBACa,UAAW,SAAQ,SAAS;IACvC,IAAI,EAAE,MAAM,CAAA;IAEZ,MAAM,EAAE,WAAW,CAAoB;IAEvC,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB"}
1
+ {"version":3,"file":"cart.entity.d.ts","sourceRoot":"","sources":["cart.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,qBACa,UAAW,SAAQ,SAAS;IAEhC,MAAM,EAAE,WAAW,CAAoB;IAGvC,KAAK,EAAE,UAAU,EAAE,CAAA;IAGnB,KAAK,EAAE,WAAW,EAAE,CAAA;CAC5B"}
@@ -1,19 +1,25 @@
1
- import { Collection } from 'fireorm'
2
- import AppEntity from '../../app.entity'
3
- import { ItemEntity } from '../orders/items/item.entity'
1
+ import { Column, Entity, OneToMany, OneToOne } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
3
+ import { ItemEntity } from '../items/item.entity'
4
+ import { OrderEntity } from '../orders/order.entity'
4
5
 
5
6
  export enum CART_STATUS {
6
7
  EMPTY = 'EMPTY',
7
- FILLED = 'FILLED',
8
+ SAVED = 'SAVED',
9
+ ACTIVE = 'ACTIVE',
10
+ DELETED = 'DELETED',
8
11
  ABANDONED = 'ABANDONED',
9
12
  FINALIZED = 'FINALIZED'
10
13
  }
11
14
 
12
- @Collection('store-carts')
15
+ @Entity('store_carts')
13
16
  export class CartEntity extends AppEntity {
14
- user: string
17
+ @Column({ type: 'enum', enum: CART_STATUS, default: CART_STATUS.EMPTY })
18
+ public status: CART_STATUS = CART_STATUS.EMPTY
15
19
 
16
- status: CART_STATUS = CART_STATUS.EMPTY
20
+ @OneToMany(() => ItemEntity, i => i.cart, { eager: true })
21
+ public items: ItemEntity[]
17
22
 
18
- items: ItemEntity[]
23
+ @OneToOne(() => OrderEntity, o => o.cart)
24
+ public order: OrderEntity[]
19
25
  }
@@ -1,10 +1,8 @@
1
1
  export declare class FindCartValidator {
2
2
  }
3
3
  export declare class CreateCartValidator {
4
- items: any[];
5
4
  }
6
5
  export declare type IdCartValidator = string;
7
6
  export declare class UpdateCartValidator {
8
- items: any[];
9
7
  }
10
8
  //# sourceMappingURL=cart.validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.validator.d.ts","sourceRoot":"","sources":["cart.validator.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB;CAE7B;AAED,qBAAa,mBAAmB;IAC9B,KAAK,EAAE,GAAG,EAAE,CAAA;CACb;AAED,oBAAY,eAAe,GAAG,MAAM,CAAA;AAEpC,qBAAa,mBAAmB;IAC9B,KAAK,EAAE,GAAG,EAAE,CAAA;CACb"}
1
+ {"version":3,"file":"cart.validator.d.ts","sourceRoot":"","sources":["cart.validator.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB;CAC7B;AAED,qBAAa,mBAAmB;CAC/B;AAED,oBAAY,eAAe,GAAG,MAAM,CAAA;AAEpC,qBAAa,mBAAmB;CAC/B"}
@@ -1,13 +1,10 @@
1
1
  export class FindCartValidator {
2
-
3
2
  }
4
3
 
5
4
  export class CreateCartValidator {
6
- items: any[]
7
5
  }
8
6
 
9
7
  export type IdCartValidator = string
10
8
 
11
9
  export class UpdateCartValidator {
12
- items: any[]
13
10
  }
@@ -0,0 +1,9 @@
1
+ import { AppEntity } from '../../app.entity';
2
+ import { VariantEntity } from '../../inventory/products/variants/variant.entity';
3
+ import { CartEntity } from '../carts/cart.entity';
4
+ export declare class ItemEntity extends AppEntity {
5
+ quantity: number;
6
+ variant: VariantEntity;
7
+ cart: CartEntity[];
8
+ }
9
+ //# sourceMappingURL=item.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item.entity.d.ts","sourceRoot":"","sources":["item.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,qBACa,UAAW,SAAQ,SAAS;IAEhC,QAAQ,EAAE,MAAM,CAAA;IAGhB,OAAO,EAAE,aAAa,CAAA;IAGtB,IAAI,EAAE,UAAU,EAAE,CAAA;CAC1B"}
@@ -0,0 +1,16 @@
1
+ import { Column, Entity, ManyToOne } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
3
+ import { VariantEntity } from '../../inventory/products/variants/variant.entity'
4
+ import { CartEntity } from '../carts/cart.entity'
5
+
6
+ @Entity('store_items')
7
+ export class ItemEntity extends AppEntity {
8
+ @Column({ type: 'float', default: 1 })
9
+ public quantity: number
10
+
11
+ @ManyToOne(() => VariantEntity, { eager: true })
12
+ public variant: VariantEntity
13
+
14
+ @ManyToOne(() => CartEntity, c => c.items)
15
+ public cart: CartEntity[]
16
+ }
@@ -1,12 +1,8 @@
1
- import { ISubCollection } from 'fireorm';
2
- import AppEntity from '../../app.entity';
1
+ import { AppEntity } from '../../app.entity';
3
2
  import { CartEntity } from '../carts/cart.entity';
4
- import { ItemEntity } from './items/item.entity';
5
3
  export declare class OrderEntity extends AppEntity {
6
4
  number: string;
7
- client: string;
8
5
  price: number;
9
6
  cart: CartEntity;
10
- items?: ISubCollection<ItemEntity>;
11
7
  }
12
8
  //# sourceMappingURL=order.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.entity.d.ts","sourceRoot":"","sources":["order.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,cAAc,EAAuB,MAAM,SAAS,CAAA;AACzE,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,qBACa,WAAY,SAAQ,SAAS;IAExC,MAAM,EAAE,MAAM,CAAA;IAGd,MAAM,EAAE,MAAM,CAAA;IAGd,KAAK,EAAE,MAAM,CAAA;IAGb,IAAI,EAAE,UAAU,CAAA;IAIhB,KAAK,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;CACnC"}
1
+ {"version":3,"file":"order.entity.d.ts","sourceRoot":"","sources":["order.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,qBACa,WAAY,SAAQ,SAAS;IAExC,MAAM,EAAE,MAAM,CAAA;IAGd,KAAK,EAAE,MAAM,CAAA;IAGb,IAAI,EAAE,UAAU,CAAA;CACjB"}
@@ -1,24 +1,15 @@
1
- import { Transform } from 'class-transformer'
2
- import { Collection, ISubCollection, SubCollection, Type } from 'fireorm'
3
- import AppEntity from '../../app.entity'
1
+ import { Column, Entity, OneToOne } from 'typeorm'
2
+ import { AppEntity } from '../../app.entity'
4
3
  import { CartEntity } from '../carts/cart.entity'
5
- import { ItemEntity } from './items/item.entity'
6
4
 
7
- @Collection('store-orders')
5
+ @Entity('store_orders')
8
6
  export class OrderEntity extends AppEntity {
9
- @Type(() => String)
7
+ @Column()
10
8
  number: string
11
9
 
12
- @Type(() => String)
13
- client: string
14
-
15
- @Type(() => Number)
10
+ @Column({ type: 'float' })
16
11
  price: number
17
12
 
18
- @Type(() => CartEntity)
13
+ @OneToOne(() => CartEntity, c => c.order, { eager: true })
19
14
  cart: CartEntity
20
-
21
- @SubCollection(ItemEntity, 'items')
22
- @Transform(AppEntity.transformSubCollection)
23
- items?: ISubCollection<ItemEntity>
24
15
  }
@@ -1,7 +0,0 @@
1
- import AppEntity from '../../../app.entity';
2
- import { ProductEntity } from '../../../inventory/products/product.entity';
3
- export declare class ItemEntity extends AppEntity {
4
- quantity: number;
5
- product: ProductEntity;
6
- }
7
- //# sourceMappingURL=item.entity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item.entity.d.ts","sourceRoot":"","sources":["item.entity.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAA;AAE1E,qBAAa,UAAW,SAAQ,SAAS;IAEvC,QAAQ,EAAE,MAAM,CAAA;IAGhB,OAAO,EAAE,aAAa,CAAA;CACvB"}
@@ -1,11 +0,0 @@
1
- import { Type } from 'fireorm'
2
- import AppEntity from '../../../app.entity'
3
- import { ProductEntity } from '../../../inventory/products/product.entity'
4
-
5
- export class ItemEntity extends AppEntity {
6
- @Type(() => Number)
7
- quantity: number
8
-
9
- @Type(() => ProductEntity)
10
- product: ProductEntity
11
- }