test-entity-library-asm 3.2.7 → 3.2.9

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,4 +1,4 @@
1
- import { RequestLocal } from "..";
1
+ import { RequestLocal, UserAddress } from "..";
2
2
  import { PaymentMethod } from "./PaymentMethod";
3
3
  import { RequestProduct } from "./RequestProduct";
4
4
  import { RequestProductGroupComplement } from "./RequestProductGroupComplement";
@@ -7,6 +7,7 @@ export declare class Request {
7
7
  id: number;
8
8
  code: string;
9
9
  user: User;
10
+ address: UserAddress | null;
10
11
  order_mode: number;
11
12
  order_type: number;
12
13
  payment_method: PaymentMethod;
@@ -43,6 +43,15 @@ var Request = /** @class */ (function () {
43
43
  (0, typeorm_1.JoinColumn)({ name: "user" }),
44
44
  __metadata("design:type", User_1.User)
45
45
  ], Request.prototype, "user", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.ManyToOne)(function () { return __1.UserAddress; }, function (userAddress) { return userAddress.requests; }, {
48
+ nullable: true,
49
+ onDelete: "NO ACTION",
50
+ onUpdate: "NO ACTION",
51
+ }),
52
+ (0, typeorm_1.JoinColumn)({ name: "address" }),
53
+ __metadata("design:type", Object)
54
+ ], Request.prototype, "address", void 0);
46
55
  __decorate([
47
56
  (0, typeorm_1.Column)({
48
57
  default: 1,
@@ -50,6 +50,7 @@ var RequestLocal = /** @class */ (function () {
50
50
  ], RequestLocal.prototype, "status", void 0);
51
51
  __decorate([
52
52
  (0, typeorm_1.Column)({
53
+ type: "varchar",
53
54
  length: 4,
54
55
  nullable: true,
55
56
  comment: "Columna para saber cuánto tiempo máximo (minutos) nos tomará en preparar los productos y sus toppings.\r\n\r\nEsta columna viene también al momento de crear.",
@@ -1,5 +1,6 @@
1
- import { City } from './City';
2
- import { User } from './User';
1
+ import { Request } from "..";
2
+ import { City } from "./City";
3
+ import { User } from "./User";
3
4
  export declare class UserAddress {
4
5
  id: number;
5
6
  user: User;
@@ -11,4 +12,7 @@ export declare class UserAddress {
11
12
  tag: string;
12
13
  delivery_details: number;
13
14
  description: string;
15
+ selected: number | null;
16
+ deleted: number;
17
+ requests: Request[];
14
18
  }
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UserAddress = void 0;
13
13
  var typeorm_1 = require("typeorm");
14
+ var __1 = require("..");
14
15
  var City_1 = require("./City");
15
16
  var User_1 = require("./User");
16
17
  var UserAddress = /** @class */ (function () {
@@ -18,45 +19,45 @@ var UserAddress = /** @class */ (function () {
18
19
  }
19
20
  __decorate([
20
21
  (0, typeorm_1.PrimaryGeneratedColumn)({
21
- comment: 'Número de identificación (ID) único de cada registro.',
22
+ comment: "Número de identificación (ID) único de cada registro.",
22
23
  }),
23
24
  __metadata("design:type", Number)
24
25
  ], UserAddress.prototype, "id", void 0);
25
26
  __decorate([
26
27
  (0, typeorm_1.ManyToOne)(function () { return User_1.User; }, function (user) { return user.addresses; }, {
27
- onDelete: 'CASCADE',
28
- onUpdate: 'NO ACTION',
28
+ onDelete: "CASCADE",
29
+ onUpdate: "NO ACTION",
29
30
  }),
30
- (0, typeorm_1.JoinColumn)({ name: 'user' }),
31
+ (0, typeorm_1.JoinColumn)({ name: "user" }),
31
32
  __metadata("design:type", User_1.User)
32
33
  ], UserAddress.prototype, "user", void 0);
33
34
  __decorate([
34
35
  (0, typeorm_1.ManyToOne)(function () { return City_1.City; }, function (city) { return city.user_addresses; }, {
35
- onDelete: 'RESTRICT',
36
- onUpdate: 'NO ACTION',
36
+ onDelete: "RESTRICT",
37
+ onUpdate: "NO ACTION",
37
38
  }),
38
- (0, typeorm_1.JoinColumn)({ name: 'city' }),
39
+ (0, typeorm_1.JoinColumn)({ name: "city" }),
39
40
  __metadata("design:type", City_1.City)
40
41
  ], UserAddress.prototype, "city", void 0);
41
42
  __decorate([
42
- (0, typeorm_1.Column)({ length: 120, comment: 'Dirección.' }),
43
+ (0, typeorm_1.Column)({ length: 120, comment: "Dirección." }),
43
44
  __metadata("design:type", String)
44
45
  ], UserAddress.prototype, "address", void 0);
45
46
  __decorate([
46
47
  (0, typeorm_1.Column)({
47
- type: 'decimal',
48
+ type: "decimal",
48
49
  precision: 10,
49
50
  scale: 8,
50
- comment: 'Latitud de la dirección.',
51
+ comment: "Latitud de la dirección.",
51
52
  }),
52
53
  __metadata("design:type", Number)
53
54
  ], UserAddress.prototype, "latitude", void 0);
54
55
  __decorate([
55
56
  (0, typeorm_1.Column)({
56
- type: 'decimal',
57
+ type: "decimal",
57
58
  precision: 10,
58
59
  scale: 8,
59
- comment: 'Longitud de la dirección.',
60
+ comment: "Longitud de la dirección.",
60
61
  }),
61
62
  __metadata("design:type", Number)
62
63
  ], UserAddress.prototype, "longitude", void 0);
@@ -64,33 +65,52 @@ var UserAddress = /** @class */ (function () {
64
65
  (0, typeorm_1.Column)({
65
66
  length: 400,
66
67
  nullable: true,
67
- comment: 'Detalles de la dirección, si es una casa, un conjunto, el apartamento.',
68
+ comment: "Detalles de la dirección, si es una casa, un conjunto, el apartamento.",
68
69
  }),
69
70
  __metadata("design:type", String)
70
71
  ], UserAddress.prototype, "details", void 0);
71
72
  __decorate([
72
73
  (0, typeorm_1.Column)({
73
74
  length: 20,
74
- comment: 'Tipo de ubicación:\r\n1. Casa.\r\n2. Oficina.\r\n3. Pareja.\r\n4. Otro.\r\n\r\nEsto me agrega un campo de tipo texto con el tag.',
75
+ comment: "Tipo de ubicación:\r\n1. Casa.\r\n2. Oficina.\r\n3. Pareja.\r\n4. Otro.\r\n\r\nEsto me agrega un campo de tipo texto con el tag.",
75
76
  }),
76
77
  __metadata("design:type", String)
77
78
  ], UserAddress.prototype, "tag", void 0);
78
79
  __decorate([
79
80
  (0, typeorm_1.Column)({
80
- comment: 'Campo que me dice si:\r\n1. Personal: Lo recibo yo.\r\n2. Portería: Lo recibe la portería.',
81
+ comment: "Campo que me dice si:\r\n1. Personal: Lo recibo yo.\r\n2. Portería: Lo recibe la portería.",
81
82
  }),
82
83
  __metadata("design:type", Number)
83
84
  ], UserAddress.prototype, "delivery_details", void 0);
84
85
  __decorate([
85
86
  (0, typeorm_1.Column)({
86
87
  length: 400,
87
- comment: 'Campo para agregar una descripción más detallada de cómo llegar, o donde es la ubicación.',
88
+ comment: "Campo para agregar una descripción más detallada de cómo llegar, o donde es la ubicación.",
88
89
  }),
89
90
  __metadata("design:type", String)
90
91
  ], UserAddress.prototype, "description", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({
94
+ comment: "Columna para saber el el registro se eliminó o no:\r\n0. No eliminado.\r\n1. Eliminado.",
95
+ nullable: true,
96
+ default: 0,
97
+ }),
98
+ __metadata("design:type", Object)
99
+ ], UserAddress.prototype, "selected", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.Column)({
102
+ comment: "CColumna para saber sí la dirección está seleccionada por defecto:\r\n1. Por defecto.\r\n0. No está por defecto.",
103
+ default: 0,
104
+ }),
105
+ __metadata("design:type", Number)
106
+ ], UserAddress.prototype, "deleted", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.OneToMany)(function () { return __1.Request; }, function (request) { return request.address; }),
109
+ __metadata("design:type", Array)
110
+ ], UserAddress.prototype, "requests", void 0);
91
111
  UserAddress = __decorate([
92
- (0, typeorm_1.Entity)('user_address', {
93
- comment: 'Tabla creada para agregar las direcciones del usuario.\r\n\r\nEsta tabla es útil para cuando se tenga la opción de domicilios.',
112
+ (0, typeorm_1.Entity)("user_address", {
113
+ comment: "Tabla creada para agregar las direcciones del usuario.\r\n\r\nEsta tabla es util para cuando se tenga la opción de domicilios.",
94
114
  })
95
115
  ], UserAddress);
96
116
  return UserAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.2.7",
3
+ "version": "3.2.9",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@ import {
8
8
  OneToMany,
9
9
  PrimaryGeneratedColumn,
10
10
  } from "typeorm";
11
- import { RequestLocal } from "..";
11
+ import { RequestLocal, UserAddress } from "..";
12
12
  import { DateTransformer } from "../transformers/dateTransformer";
13
13
  import { PaymentMethod } from "./PaymentMethod";
14
14
  import { RequestProduct } from "./RequestProduct";
@@ -41,6 +41,14 @@ export class Request {
41
41
  @JoinColumn({ name: "user" })
42
42
  user: User;
43
43
 
44
+ @ManyToOne(() => UserAddress, (userAddress) => userAddress.requests, {
45
+ nullable: true,
46
+ onDelete: "NO ACTION",
47
+ onUpdate: "NO ACTION",
48
+ })
49
+ @JoinColumn({ name: "address" })
50
+ address: UserAddress | null;
51
+
44
52
  @Column({
45
53
  default: 1,
46
54
  comment:
@@ -43,6 +43,7 @@ export class RequestLocal {
43
43
  status: number;
44
44
 
45
45
  @Column({
46
+ type: "varchar",
46
47
  length: 4,
47
48
  nullable: true,
48
49
  comment:
@@ -3,79 +3,99 @@ import {
3
3
  Entity,
4
4
  JoinColumn,
5
5
  ManyToOne,
6
+ OneToMany,
6
7
  PrimaryGeneratedColumn,
7
- } from 'typeorm'
8
- import { City } from './City'
9
- import { User } from './User'
8
+ } from "typeorm";
9
+ import { Request } from "..";
10
+ import { City } from "./City";
11
+ import { User } from "./User";
10
12
 
11
- @Entity('user_address', {
13
+ @Entity("user_address", {
12
14
  comment:
13
- 'Tabla creada para agregar las direcciones del usuario.\r\n\r\nEsta tabla es útil para cuando se tenga la opción de domicilios.',
15
+ "Tabla creada para agregar las direcciones del usuario.\r\n\r\nEsta tabla es util para cuando se tenga la opción de domicilios.",
14
16
  })
15
17
  export class UserAddress {
16
18
  @PrimaryGeneratedColumn({
17
- comment: 'Número de identificación (ID) único de cada registro.',
19
+ comment: "Número de identificación (ID) único de cada registro.",
18
20
  })
19
- id: number
21
+ id: number;
20
22
 
21
23
  @ManyToOne(() => User, (user) => user.addresses, {
22
- onDelete: 'CASCADE',
23
- onUpdate: 'NO ACTION',
24
+ onDelete: "CASCADE",
25
+ onUpdate: "NO ACTION",
24
26
  })
25
- @JoinColumn({ name: 'user' })
26
- user: User
27
+ @JoinColumn({ name: "user" })
28
+ user: User;
27
29
 
28
30
  @ManyToOne(() => City, (city) => city.user_addresses, {
29
- onDelete: 'RESTRICT',
30
- onUpdate: 'NO ACTION',
31
+ onDelete: "RESTRICT",
32
+ onUpdate: "NO ACTION",
31
33
  })
32
- @JoinColumn({ name: 'city' })
33
- city: City
34
+ @JoinColumn({ name: "city" })
35
+ city: City;
34
36
 
35
- @Column({ length: 120, comment: 'Dirección.' })
36
- address: string
37
+ @Column({ length: 120, comment: "Dirección." })
38
+ address: string;
37
39
 
38
40
  @Column({
39
- type: 'decimal',
41
+ type: "decimal",
40
42
  precision: 10,
41
43
  scale: 8,
42
- comment: 'Latitud de la dirección.',
44
+ comment: "Latitud de la dirección.",
43
45
  })
44
- latitude: number
46
+ latitude: number;
45
47
 
46
48
  @Column({
47
- type: 'decimal',
49
+ type: "decimal",
48
50
  precision: 10,
49
51
  scale: 8,
50
- comment: 'Longitud de la dirección.',
52
+ comment: "Longitud de la dirección.",
51
53
  })
52
- longitude: number
54
+ longitude: number;
53
55
 
54
56
  @Column({
55
57
  length: 400,
56
58
  nullable: true,
57
59
  comment:
58
- 'Detalles de la dirección, si es una casa, un conjunto, el apartamento.',
60
+ "Detalles de la dirección, si es una casa, un conjunto, el apartamento.",
59
61
  })
60
- details: string
62
+ details: string;
61
63
 
62
64
  @Column({
63
65
  length: 20,
64
66
  comment:
65
- 'Tipo de ubicación:\r\n1. Casa.\r\n2. Oficina.\r\n3. Pareja.\r\n4. Otro.\r\n\r\nEsto me agrega un campo de tipo texto con el tag.',
67
+ "Tipo de ubicación:\r\n1. Casa.\r\n2. Oficina.\r\n3. Pareja.\r\n4. Otro.\r\n\r\nEsto me agrega un campo de tipo texto con el tag.",
66
68
  })
67
- tag: string
69
+ tag: string;
68
70
 
69
71
  @Column({
70
72
  comment:
71
- 'Campo que me dice si:\r\n1. Personal: Lo recibo yo.\r\n2. Portería: Lo recibe la portería.',
73
+ "Campo que me dice si:\r\n1. Personal: Lo recibo yo.\r\n2. Portería: Lo recibe la portería.",
72
74
  })
73
- delivery_details: number
75
+ delivery_details: number;
74
76
 
75
77
  @Column({
76
78
  length: 400,
77
79
  comment:
78
- 'Campo para agregar una descripción más detallada de cómo llegar, o donde es la ubicación.',
80
+ "Campo para agregar una descripción más detallada de cómo llegar, o donde es la ubicación.",
79
81
  })
80
- description: string
82
+ description: string;
83
+
84
+ @Column({
85
+ comment:
86
+ "Columna para saber el el registro se eliminó o no:\r\n0. No eliminado.\r\n1. Eliminado.",
87
+ nullable: true,
88
+ default: 0,
89
+ })
90
+ selected: number | null;
91
+
92
+ @Column({
93
+ comment:
94
+ "CColumna para saber sí la dirección está seleccionada por defecto:\r\n1. Por defecto.\r\n0. No está por defecto.",
95
+ default: 0,
96
+ })
97
+ deleted: number;
98
+
99
+ @OneToMany(() => Request, (request) => request.address)
100
+ requests: Request[];
81
101
  }