UNPKG

nestjs-paginate

Version:

Pagination and filtering helper method for TypeORM repositories or query builders using Nest.js framework.

65 lines 3.18 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CatHomeEntity = void 0; const typeorm_1 = require("typeorm"); const cat_home_pillow_entity_1 = require("./cat-home-pillow.entity"); const cat_entity_1 = require("./cat.entity"); const column_option_1 = require("./column-option"); let CatHomeEntity = class CatHomeEntity { }; exports.CatHomeEntity = CatHomeEntity; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)(), __metadata("design:type", Number) ], CatHomeEntity.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)(), __metadata("design:type", String) ], CatHomeEntity.prototype, "name", void 0); __decorate([ (0, typeorm_1.Column)({ nullable: true }), __metadata("design:type", String) ], CatHomeEntity.prototype, "street", void 0); __decorate([ (0, typeorm_1.OneToOne)(() => cat_entity_1.CatEntity, (cat) => cat.home), __metadata("design:type", cat_entity_1.CatEntity) ], CatHomeEntity.prototype, "cat", void 0); __decorate([ (0, typeorm_1.OneToMany)(() => cat_home_pillow_entity_1.CatHomePillowEntity, (pillow) => pillow.home), __metadata("design:type", Array) ], CatHomeEntity.prototype, "pillows", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => cat_home_pillow_entity_1.CatHomePillowEntity, { nullable: true }), __metadata("design:type", cat_home_pillow_entity_1.CatHomePillowEntity) ], CatHomeEntity.prototype, "naptimePillow", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)(column_option_1.DateColumnNotNull), __metadata("design:type", String) ], CatHomeEntity.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.Column)({ type: process.env.DB === 'postgres' ? 'jsonb' : 'simple-json', nullable: true }), __metadata("design:type", Object) ], CatHomeEntity.prototype, "config", void 0); __decorate([ (0, typeorm_1.VirtualColumn)({ query: (alias) => { const tck = process.env.DB === 'mariadb' ? '`' : '"'; const intType = process.env.DB === 'mariadb' ? 'UNSIGNED' : 'INT'; return `SELECT CAST(COUNT(*) AS ${intType}) FROM ${tck}cat${tck} WHERE ${tck}cat${tck}.${tck}homeId${tck} = ${alias}.id`; }, }), __metadata("design:type", Number) ], CatHomeEntity.prototype, "countCat", void 0); exports.CatHomeEntity = CatHomeEntity = __decorate([ (0, typeorm_1.Entity)() ], CatHomeEntity); //# sourceMappingURL=cat-home.entity.js.map