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.11 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 Country2TimezoneMap_1 = require("../persistent-classes/Country2TimezoneMap"); class Country2TimezoneMapService { constructor() { /*** generated service methods here ***/ this.findAllCountry2TimezoneMaps = () => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.findAll({ raw: true }); }); this.findAllCountry2TimezoneMapsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.findAll({ where: { Oid }, raw: true }); }); this.findOneCountry2TimezoneMapByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.findOne({ where: { Oid }, raw: true }); }); this.updateCountry2TimezoneMap = (country2timezonemap) => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.update(Object.assign({}, country2timezonemap), { where: { Oid: country2timezonemap['Oid'] } }); }); this.saveCountry2TimezoneMap = (country2timezonemap) => __awaiter(this, void 0, void 0, function* () { return yield new Country2TimezoneMap_1.Country2TimezoneMap(Object.assign({}, country2timezonemap)).save(); }); this.batchSaveCountry2TimezoneMaps = (country2timezonemaps) => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.bulkCreate(country2timezonemaps.map((x) => { // do work here return Object.assign({}, x); })); }); this.deleteCountry2TimezoneMapByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.destroy({ where: { Oid } }); }); /************************** Methods not attached to 'Controller' below here ******************************/ this.findAllCountry2TimezoneMapsByColumns = (columns) => __awaiter(this, void 0, void 0, function* () { return yield Country2TimezoneMap_1.Country2TimezoneMap.findAll({ where: Object.assign({}, columns), raw: true }); }); } } exports.default = new Country2TimezoneMapService(); //# sourceMappingURL=Country2TimezoneMap.service.js.map