UNPKG

sequelize-ts-boilerplate

Version:

A REST API scaffolding tool designed to scale and easily generate CRUD endpoints based on database schema design

46 lines 3.18 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const Entity2AssociationMap_1 = require("../persistent-classes/Entity2AssociationMap"); class Entity2AssociationMapService { constructor() { /*** generated service methods here ***/ this.findAllEntity2AssociationMaps = () => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.findAll({ raw: true }); }); this.findAllEntity2AssociationMapsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.findAll({ where: { Oid }, raw: true }); }); this.findOneEntity2AssociationMapByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.findOne({ where: { Oid }, raw: true }); }); this.updateEntity2AssociationMap = (entity2associationmap) => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.update(Object.assign({}, entity2associationmap), { where: { Oid: entity2associationmap['Oid'] } }); }); this.saveEntity2AssociationMap = (entity2associationmap) => __awaiter(this, void 0, void 0, function* () { return yield new Entity2AssociationMap_1.Entity2AssociationMap(Object.assign({}, entity2associationmap)).save(); }); this.batchSaveEntity2AssociationMaps = (entity2associationmaps) => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.bulkCreate(entity2associationmaps.map((x) => { // do work here return Object.assign({}, x); })); }); this.deleteEntity2AssociationMapByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.destroy({ where: { Oid } }); }); /************************** Methods not attached to 'Controller' below here ******************************/ this.findAllEntity2AssociationMapsByColumns = (columns) => __awaiter(this, void 0, void 0, function* () { return yield Entity2AssociationMap_1.Entity2AssociationMap.findAll({ where: Object.assign({}, columns), raw: true }); }); } } exports.default = new Entity2AssociationMapService(); //# sourceMappingURL=Entity2AssociationMap.service.js.map