test-entity-library-asm 3.6.6 → 3.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ import { Local, Partner, Product, ProductImage } from "..";
2
+ export declare class Gallery {
3
+ id: number;
4
+ local: Local | null;
5
+ public_id: string;
6
+ image_url: string;
7
+ created: Date;
8
+ created_by: Partner;
9
+ status: number;
10
+ products_images: Product[];
11
+ product_images: ProductImage[];
12
+ }
@@ -0,0 +1,104 @@
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.Gallery = void 0;
13
+ var typeorm_1 = require("typeorm");
14
+ var __1 = require("..");
15
+ var dateTransformer_1 = require("../transformers/dateTransformer");
16
+ var Gallery = /** @class */ (function () {
17
+ function Gallery() {
18
+ }
19
+ __decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)({
21
+ type: "int",
22
+ comment: "ID único de cada registro.",
23
+ }),
24
+ __metadata("design:type", Number)
25
+ ], Gallery.prototype, "id", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.ManyToOne)(function () { return __1.Local; }, function (local) { return local.galleries; }, {
28
+ onDelete: "CASCADE",
29
+ onUpdate: "NO ACTION",
30
+ nullable: true,
31
+ }),
32
+ (0, typeorm_1.JoinColumn)({ name: "local" }),
33
+ __metadata("design:type", Object)
34
+ ], Gallery.prototype, "local", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({
37
+ type: "varchar",
38
+ length: 255,
39
+ unique: true,
40
+ comment: "ID de la imagen.",
41
+ }),
42
+ __metadata("design:type", String)
43
+ ], Gallery.prototype, "public_id", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({
46
+ type: "varchar",
47
+ length: 1024,
48
+ comment: "Url de la imagen.",
49
+ }),
50
+ __metadata("design:type", String)
51
+ ], Gallery.prototype, "image_url", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ type: "datetime",
55
+ transformer: new dateTransformer_1.DateTransformer(),
56
+ comment: "Fecha de creación de la imagen.",
57
+ }),
58
+ __metadata("design:type", Date)
59
+ ], Gallery.prototype, "created", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.ManyToOne)(function () { return __1.Partner; }, function (partner) { return partner.galleries; }, {
62
+ onDelete: "NO ACTION",
63
+ onUpdate: "NO ACTION",
64
+ }),
65
+ (0, typeorm_1.JoinColumn)({ name: "created_by" }),
66
+ __metadata("design:type", __1.Partner)
67
+ ], Gallery.prototype, "created_by", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({
70
+ default: 1,
71
+ type: "int",
72
+ width: 1,
73
+ comment: "Estado en el que se encuentra la imagen:\r\n0: Inactivo.\r\n1: Activo.",
74
+ }),
75
+ __metadata("design:type", Number)
76
+ ], Gallery.prototype, "status", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.ManyToMany)(function () { return __1.Product; }, function (product) { return product.product_images; }),
79
+ (0, typeorm_1.JoinTable)({
80
+ name: "product_image",
81
+ joinColumn: {
82
+ name: "image",
83
+ referencedColumnName: "id",
84
+ },
85
+ inverseJoinColumn: {
86
+ name: "product",
87
+ referencedColumnName: "id",
88
+ },
89
+ }),
90
+ __metadata("design:type", Array)
91
+ ], Gallery.prototype, "products_images", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.OneToMany)(function () { return __1.ProductImage; }, function (productImage) { return productImage.image; }),
94
+ __metadata("design:type", Array)
95
+ ], Gallery.prototype, "product_images", void 0);
96
+ Gallery = __decorate([
97
+ (0, typeorm_1.Entity)({
98
+ name: "gallery",
99
+ comment: "Galería de imágenes qué se usan para los productos.",
100
+ })
101
+ ], Gallery);
102
+ return Gallery;
103
+ }());
104
+ exports.Gallery = Gallery;
@@ -1,4 +1,4 @@
1
- import { DiscountCodeUser, LocalDecorationReserve, LocalPlan, LocalReserveStatus, LocalTable, LocalTableZone, PosSystem, ReceiptConfig, RequestInvoice, RequestLocal } from "..";
1
+ import { DiscountCodeUser, Gallery, LocalDecorationReserve, LocalPlan, LocalReserveStatus, LocalTable, LocalTableZone, PosSystem, ReceiptConfig, RequestInvoice, RequestLocal } from "..";
2
2
  import { BusinessTypeProduct } from "./BusinessTypeProduct";
3
3
  import { Category } from "./Category";
4
4
  import { City } from "./City";
@@ -40,4 +40,5 @@ export declare class Local {
40
40
  local_decorations_reserve: LocalDecorationReserve[];
41
41
  local_reserve_status: LocalReserveStatus[];
42
42
  request_invoices: RequestInvoice[];
43
+ galleries: Gallery[];
43
44
  }
@@ -239,6 +239,10 @@ var Local = /** @class */ (function () {
239
239
  (0, typeorm_1.OneToMany)(function () { return __1.RequestInvoice; }, function (requestInvoice) { return requestInvoice.local; }),
240
240
  __metadata("design:type", Array)
241
241
  ], Local.prototype, "request_invoices", void 0);
242
+ __decorate([
243
+ (0, typeorm_1.OneToMany)(function () { return __1.Gallery; }, function (gallery) { return gallery.local; }),
244
+ __metadata("design:type", Array)
245
+ ], Local.prototype, "galleries", void 0);
242
246
  Local = __decorate([
243
247
  (0, typeorm_1.Entity)({ comment: "Locales disponibles de las empresas (company)." })
244
248
  ], Local);
@@ -1,4 +1,4 @@
1
- import { Category, LocalReserve, LocalReserveStatus, LocalTable, LocalTableReservePayment, LocalTableZone, MasterNotification, PartnerSession, Product, RequestInvoice, RequestLocal, RequestLocalHistory, RequestLocalPayment, RequestPrint, VerifyLocal } from "..";
1
+ import { Category, Gallery, LocalReserve, LocalReserveStatus, LocalTable, LocalTableReservePayment, LocalTableZone, MasterNotification, PartnerSession, Product, RequestInvoice, RequestLocal, RequestLocalHistory, RequestLocalPayment, RequestPrint, VerifyLocal } from "..";
2
2
  import { City } from "./City";
3
3
  import { Company } from "./Company";
4
4
  import { DiscountCodeUser } from "./DiscountCodeUser";
@@ -47,4 +47,5 @@ export declare class Partner {
47
47
  local_reserves: LocalReserve[];
48
48
  local_reserve_status: LocalReserveStatus[];
49
49
  request_invoices: RequestInvoice[];
50
+ galleries: Gallery[];
50
51
  }
@@ -293,6 +293,10 @@ var Partner = /** @class */ (function () {
293
293
  (0, typeorm_1.OneToMany)(function () { return __1.RequestInvoice; }, function (RequestInvoice) { return RequestInvoice.updated_by; }),
294
294
  __metadata("design:type", Array)
295
295
  ], Partner.prototype, "request_invoices", void 0);
296
+ __decorate([
297
+ (0, typeorm_1.OneToMany)(function () { return __1.Gallery; }, function (gallery) { return gallery.created_by; }),
298
+ __metadata("design:type", Array)
299
+ ], Partner.prototype, "galleries", void 0);
296
300
  Partner = __decorate([
297
301
  (0, typeorm_1.Entity)({
298
302
  comment: "Tabla agregada para los usuarios qué quieran registrar su local o empresa de comida rápida en la plataforma.\r\n\r\nEste usuario es independiente a los usuarios de la tabla `user` ya que tiene diferentes plataformas.\r\n\r\nTambién van a estar los usuarios qué el administrador/dueño desee agregar como empleados/colaboradores.",
@@ -1,4 +1,4 @@
1
- import { Partner, ProductDate, ProductSchedule } from "..";
1
+ import { Gallery, Partner, ProductDate, ProductImage, ProductSchedule } from "..";
2
2
  import { Category } from "./Category";
3
3
  import { ProductGroup } from "./ProductGroup";
4
4
  import { ProductIngredient } from "./ProductIngredient";
@@ -13,7 +13,6 @@ export declare class Product {
13
13
  age_restriction: number;
14
14
  combo: number;
15
15
  position: number;
16
- photo: any | null;
17
16
  additional_information: any | null;
18
17
  type_sales_hours: number | null;
19
18
  created_by: Partner;
@@ -30,4 +29,6 @@ export declare class Product {
30
29
  users_favorite_product: User[];
31
30
  product_schedules: ProductSchedule[];
32
31
  product_dates: ProductDate[];
32
+ products_image: ProductImage[];
33
+ product_images: Gallery[];
33
34
  }
@@ -78,16 +78,6 @@ var Product = /** @class */ (function () {
78
78
  }),
79
79
  __metadata("design:type", Number)
80
80
  ], Product.prototype, "position", void 0);
81
- __decorate([
82
- (0, typeorm_1.Column)({
83
- type: "text",
84
- nullable: true,
85
- default: null,
86
- transformer: jsonTransformer_1.jsonTransformer,
87
- comment: "Campo de tipo json para guardar el id y la url de la foto",
88
- }),
89
- __metadata("design:type", Object)
90
- ], Product.prototype, "photo", void 0);
91
81
  __decorate([
92
82
  (0, typeorm_1.Column)({
93
83
  type: "mediumtext",
@@ -216,6 +206,25 @@ var Product = /** @class */ (function () {
216
206
  (0, typeorm_1.OneToMany)(function () { return __1.ProductDate; }, function (productDate) { return productDate.product; }),
217
207
  __metadata("design:type", Array)
218
208
  ], Product.prototype, "product_dates", void 0);
209
+ __decorate([
210
+ (0, typeorm_1.OneToMany)(function () { return __1.ProductImage; }, function (productImage) { return productImage.product; }),
211
+ __metadata("design:type", Array)
212
+ ], Product.prototype, "products_image", void 0);
213
+ __decorate([
214
+ (0, typeorm_1.ManyToMany)(function () { return __1.Gallery; }, function (gallery) { return gallery.products_images; }),
215
+ (0, typeorm_1.JoinTable)({
216
+ name: "product_image",
217
+ joinColumn: {
218
+ name: "product",
219
+ referencedColumnName: "id",
220
+ },
221
+ inverseJoinColumn: {
222
+ name: "image",
223
+ referencedColumnName: "id",
224
+ },
225
+ }),
226
+ __metadata("design:type", Array)
227
+ ], Product.prototype, "product_images", void 0);
219
228
  Product = __decorate([
220
229
  (0, typeorm_1.Entity)({
221
230
  comment: "Productos qué serán visibles a los usuarios, estos están asociados a un local.",
@@ -0,0 +1,6 @@
1
+ import { Gallery, Product } from "..";
2
+ export declare class ProductImage {
3
+ id: number;
4
+ product: Product;
5
+ image: Gallery;
6
+ }
@@ -0,0 +1,49 @@
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.ProductImage = void 0;
13
+ var typeorm_1 = require("typeorm");
14
+ var __1 = require("..");
15
+ var ProductImage = /** @class */ (function () {
16
+ function ProductImage() {
17
+ }
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)({
20
+ type: "int",
21
+ comment: "Id único de cada registro.",
22
+ }),
23
+ __metadata("design:type", Number)
24
+ ], ProductImage.prototype, "id", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(function () { return __1.Product; }, function (product) { return product.products_image; }, {
27
+ onDelete: "CASCADE",
28
+ onUpdate: "NO ACTION",
29
+ }),
30
+ (0, typeorm_1.JoinColumn)({ name: "product" }),
31
+ __metadata("design:type", __1.Product)
32
+ ], ProductImage.prototype, "product", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.ManyToOne)(function () { return __1.Gallery; }, function (gallery) { return gallery.product_images; }, {
35
+ onDelete: "CASCADE",
36
+ onUpdate: "NO ACTION",
37
+ }),
38
+ (0, typeorm_1.JoinColumn)({ name: "image" }),
39
+ __metadata("design:type", __1.Gallery)
40
+ ], ProductImage.prototype, "image", void 0);
41
+ ProductImage = __decorate([
42
+ (0, typeorm_1.Entity)({
43
+ comment: "Asociación entre los productos y la galería de imágenes.",
44
+ name: "product_image",
45
+ })
46
+ ], ProductImage);
47
+ return ProductImage;
48
+ }());
49
+ exports.ProductImage = ProductImage;
@@ -66,6 +66,8 @@ export { LocalTableReserve } from "./entities/LocalTableReserve";
66
66
  export { RequestInvoice } from "./entities/RequestInvoice";
67
67
  export { RequestInvoiceCategory } from "./entities/RequestInvoiceCategory";
68
68
  export { RequestLocalTable } from "./entities/RequestLocalTable";
69
+ export { Gallery } from "./entities/Gallery";
70
+ export { ProductImage } from "./entities/ProductImage";
69
71
  export { LocalsCompany } from "./views/LocalsCompany";
70
72
  export { VerifyLocals } from "./views/VerifyLocals";
71
73
  export { MasterNotifications } from "./views/MasterNotifications";
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.ToppingImage = exports.ProductDate = exports.ProductSchedule = exports.CategoryDate = exports.Bank = exports.ServicePlan = exports.PartnerPlatform = exports.PartnerPermissionSection = exports.LocalPlan = exports.MasterNotification = exports.VerifyLocal = exports.PosSystem = exports.AuthenticationCredential = exports.BusinessType = exports.UserAddress = exports.User = exports.TypeMeasureIngredient = exports.Square = exports.RequestProductGroupComplement = exports.RequestProduct = exports.Request = exports.Region = exports.ProductTopping = exports.ProductIngredient = exports.ProductGroupComplement = exports.ProductGroup = exports.Product = exports.Plan = exports.PaymentMethod = exports.PartnerRole = exports.PartnerPermission = exports.PartnerNotification = exports.Partner = exports.MasterRole = exports.MasterPermission = exports.Master = exports.LocalQualification = exports.Local = exports.DiscountCodeUser = exports.DiscountCodeCompany = exports.Day = exports.Country = exports.Configuration = exports.Company = exports.CodeRedemptionHistoryUser = exports.CodeRedemptionHistoryCompany = exports.City = exports.ScheduleCategory = exports.Category = exports.BusinessTypeProduct = void 0;
18
- exports.CustomRepository = exports.getLocalReservesInformation = exports.getVerifyLocalsInformation = exports.getLocalsCompanyInformation = exports.getDiscountsCodeUserInformation = exports.getDiscountsCodeCompanyInformation = exports.LocalReserves = exports.LocalTableZonesFilter = exports.PartnerNotifications = exports.DiscountsCodeUser = exports.Partners = exports.ViewLocalsCompanies = exports.MasterNotifications = exports.VerifyLocals = exports.LocalsCompany = exports.RequestLocalTable = exports.RequestInvoiceCategory = exports.RequestInvoice = exports.LocalTableReserve = exports.LocalReserveStatus = exports.LocalReserve = exports.LocalTableReservePayment = exports.DecorationReserve = exports.LocalDecorationReserve = exports.LocalTable = exports.LocalTableZone = exports.RequestPrint = exports.ReceiptConfig = exports.RequestLocalPayment = exports.UserPaymentMethod = exports.RequestLocalHistory = exports.RequestLocal = exports.PartnerSession = void 0;
18
+ exports.CustomRepository = exports.getLocalReservesInformation = exports.getVerifyLocalsInformation = exports.getLocalsCompanyInformation = exports.getDiscountsCodeUserInformation = exports.getDiscountsCodeCompanyInformation = exports.LocalReserves = exports.LocalTableZonesFilter = exports.PartnerNotifications = exports.DiscountsCodeUser = exports.Partners = exports.ViewLocalsCompanies = exports.MasterNotifications = exports.VerifyLocals = exports.LocalsCompany = exports.ProductImage = exports.Gallery = exports.RequestLocalTable = exports.RequestInvoiceCategory = exports.RequestInvoice = exports.LocalTableReserve = exports.LocalReserveStatus = exports.LocalReserve = exports.LocalTableReservePayment = exports.DecorationReserve = exports.LocalDecorationReserve = exports.LocalTable = exports.LocalTableZone = exports.RequestPrint = exports.ReceiptConfig = exports.RequestLocalPayment = exports.UserPaymentMethod = exports.RequestLocalHistory = exports.RequestLocal = exports.PartnerSession = void 0;
19
19
  var BusinessTypeProduct_1 = require("./entities/BusinessTypeProduct");
20
20
  Object.defineProperty(exports, "BusinessTypeProduct", { enumerable: true, get: function () { return BusinessTypeProduct_1.BusinessTypeProduct; } });
21
21
  var Category_1 = require("./entities/Category");
@@ -152,6 +152,10 @@ var RequestInvoiceCategory_1 = require("./entities/RequestInvoiceCategory");
152
152
  Object.defineProperty(exports, "RequestInvoiceCategory", { enumerable: true, get: function () { return RequestInvoiceCategory_1.RequestInvoiceCategory; } });
153
153
  var RequestLocalTable_1 = require("./entities/RequestLocalTable");
154
154
  Object.defineProperty(exports, "RequestLocalTable", { enumerable: true, get: function () { return RequestLocalTable_1.RequestLocalTable; } });
155
+ var Gallery_1 = require("./entities/Gallery");
156
+ Object.defineProperty(exports, "Gallery", { enumerable: true, get: function () { return Gallery_1.Gallery; } });
157
+ var ProductImage_1 = require("./entities/ProductImage");
158
+ Object.defineProperty(exports, "ProductImage", { enumerable: true, get: function () { return ProductImage_1.ProductImage; } });
155
159
  var LocalsCompany_1 = require("./views/LocalsCompany");
156
160
  Object.defineProperty(exports, "LocalsCompany", { enumerable: true, get: function () { return LocalsCompany_1.LocalsCompany; } });
157
161
  var VerifyLocals_1 = require("./views/VerifyLocals");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.6.6",
3
+ "version": "3.6.7",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,87 @@
1
+ import {
2
+ Column,
3
+ Entity,
4
+ JoinColumn,
5
+ JoinTable,
6
+ ManyToMany,
7
+ ManyToOne,
8
+ OneToMany,
9
+ PrimaryGeneratedColumn,
10
+ } from "typeorm";
11
+ import { Local, Partner, Product, ProductImage } from "..";
12
+ import { DateTransformer } from "../transformers/dateTransformer";
13
+
14
+ @Entity({
15
+ name: "gallery",
16
+ comment: "Galería de imágenes qué se usan para los productos.",
17
+ })
18
+ export class Gallery {
19
+ @PrimaryGeneratedColumn({
20
+ type: "int",
21
+ comment: "ID único de cada registro.",
22
+ })
23
+ id: number;
24
+
25
+ @ManyToOne(() => Local, (local) => local.galleries, {
26
+ onDelete: "CASCADE",
27
+ onUpdate: "NO ACTION",
28
+ nullable: true,
29
+ })
30
+ @JoinColumn({ name: "local" })
31
+ local: Local | null;
32
+
33
+ @Column({
34
+ type: "varchar",
35
+ length: 255,
36
+ unique: true,
37
+ comment: "ID de la imagen.",
38
+ })
39
+ public_id: string;
40
+
41
+ @Column({
42
+ type: "varchar",
43
+ length: 1024,
44
+ comment: "Url de la imagen.",
45
+ })
46
+ image_url: string;
47
+
48
+ @Column({
49
+ type: "datetime",
50
+ transformer: new DateTransformer(),
51
+ comment: "Fecha de creación de la imagen.",
52
+ })
53
+ created: Date;
54
+
55
+ @ManyToOne(() => Partner, (partner) => partner.galleries, {
56
+ onDelete: "NO ACTION",
57
+ onUpdate: "NO ACTION",
58
+ })
59
+ @JoinColumn({ name: "created_by" })
60
+ created_by: Partner;
61
+
62
+ @Column({
63
+ default: 1,
64
+ type: "int",
65
+ width: 1,
66
+ comment:
67
+ "Estado en el que se encuentra la imagen:\r\n0: Inactivo.\r\n1: Activo.",
68
+ })
69
+ status: number;
70
+
71
+ @ManyToMany(() => Product, (product) => product.product_images)
72
+ @JoinTable({
73
+ name: "product_image",
74
+ joinColumn: {
75
+ name: "image",
76
+ referencedColumnName: "id",
77
+ },
78
+ inverseJoinColumn: {
79
+ name: "product",
80
+ referencedColumnName: "id",
81
+ },
82
+ })
83
+ products_images: Product[];
84
+
85
+ @OneToMany(() => ProductImage, (productImage) => productImage.image)
86
+ product_images: ProductImage[];
87
+ }
@@ -10,6 +10,7 @@ import {
10
10
  } from "typeorm";
11
11
  import {
12
12
  DiscountCodeUser,
13
+ Gallery,
13
14
  LocalDecorationReserve,
14
15
  LocalPlan,
15
16
  LocalReserveStatus,
@@ -233,4 +234,7 @@ export class Local {
233
234
 
234
235
  @OneToMany(() => RequestInvoice, (requestInvoice) => requestInvoice.local)
235
236
  request_invoices: RequestInvoice[];
237
+
238
+ @OneToMany(() => Gallery, (gallery) => gallery.local)
239
+ galleries: Gallery[];
236
240
  }
@@ -10,6 +10,7 @@ import {
10
10
  } from "typeorm";
11
11
  import {
12
12
  Category,
13
+ Gallery,
13
14
  LocalReserve,
14
15
  LocalReserveStatus,
15
16
  LocalTable,
@@ -300,4 +301,7 @@ export class Partner {
300
301
  (RequestInvoice) => RequestInvoice.updated_by
301
302
  )
302
303
  request_invoices: RequestInvoice[];
304
+
305
+ @OneToMany(() => Gallery, (gallery) => gallery.created_by)
306
+ galleries: Gallery[];
303
307
  }
@@ -8,7 +8,7 @@ import {
8
8
  OneToMany,
9
9
  PrimaryGeneratedColumn,
10
10
  } from "typeorm";
11
- import { Partner, ProductDate, ProductSchedule } from "..";
11
+ import { Gallery, Partner, ProductDate, ProductImage, ProductSchedule } from "..";
12
12
  import { DateTransformer } from "../transformers/dateTransformer";
13
13
  import { jsonTransformer } from "../transformers/jsonTransformer";
14
14
  import { Category } from "./Category";
@@ -71,15 +71,6 @@ export class Product {
71
71
  })
72
72
  position: number;
73
73
 
74
- @Column({
75
- type: "text",
76
- nullable: true,
77
- default: null,
78
- transformer: jsonTransformer,
79
- comment: "Campo de tipo json para guardar el id y la url de la foto",
80
- })
81
- photo: any | null;
82
-
83
74
  @Column({
84
75
  type: "mediumtext",
85
76
  transformer: jsonTransformer,
@@ -202,4 +193,21 @@ export class Product {
202
193
 
203
194
  @OneToMany(() => ProductDate, (productDate) => productDate.product)
204
195
  product_dates: ProductDate[];
196
+
197
+ @OneToMany(() => ProductImage, (productImage) => productImage.product)
198
+ products_image: ProductImage[];
199
+
200
+ @ManyToMany(() => Gallery, (gallery) => gallery.products_images)
201
+ @JoinTable({
202
+ name: "product_image",
203
+ joinColumn: {
204
+ name: "product",
205
+ referencedColumnName: "id",
206
+ },
207
+ inverseJoinColumn: {
208
+ name: "image",
209
+ referencedColumnName: "id",
210
+ },
211
+ })
212
+ product_images: Gallery[];
205
213
  }
@@ -0,0 +1,28 @@
1
+ import { Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
2
+ import { Gallery, Product } from "..";
3
+
4
+ @Entity({
5
+ comment: "Asociación entre los productos y la galería de imágenes.",
6
+ name: "product_image",
7
+ })
8
+ export class ProductImage {
9
+ @PrimaryGeneratedColumn({
10
+ type: "int",
11
+ comment: "Id único de cada registro.",
12
+ })
13
+ id: number;
14
+
15
+ @ManyToOne(() => Product, (product) => product.products_image, {
16
+ onDelete: "CASCADE",
17
+ onUpdate: "NO ACTION",
18
+ })
19
+ @JoinColumn({ name: "product" })
20
+ product: Product;
21
+
22
+ @ManyToOne(() => Gallery, (gallery) => gallery.product_images, {
23
+ onDelete: "CASCADE",
24
+ onUpdate: "NO ACTION",
25
+ })
26
+ @JoinColumn({ name: "image" })
27
+ image: Gallery;
28
+ }
@@ -66,6 +66,8 @@ export { LocalTableReserve } from "./entities/LocalTableReserve";
66
66
  export { RequestInvoice } from "./entities/RequestInvoice";
67
67
  export { RequestInvoiceCategory } from "./entities/RequestInvoiceCategory";
68
68
  export { RequestLocalTable } from "./entities/RequestLocalTable";
69
+ export { Gallery } from "./entities/Gallery";
70
+ export { ProductImage } from "./entities/ProductImage";
69
71
 
70
72
  export { LocalsCompany } from "./views/LocalsCompany";
71
73
  export { VerifyLocals } from "./views/VerifyLocals";