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.08 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 EntityNotification_1 = require("../persistent-classes/EntityNotification"); class EntityNotificationService { constructor() { /*** generated service methods here ***/ this.findAllEntityNotifications = () => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.findAll({ raw: true }); }); this.findAllEntityNotificationsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.findAll({ where: { Oid }, raw: true }); }); this.findOneEntityNotificationByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.findOne({ where: { Oid }, raw: true }); }); this.updateEntityNotification = (entitynotification) => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.update(Object.assign({}, entitynotification), { where: { Oid: entitynotification['Oid'] } }); }); this.saveEntityNotification = (entitynotification) => __awaiter(this, void 0, void 0, function* () { return yield new EntityNotification_1.EntityNotification(Object.assign({}, entitynotification)).save(); }); this.batchSaveEntityNotifications = (entitynotifications) => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.bulkCreate(entitynotifications.map((x) => { // do work here return Object.assign({}, x); })); }); this.deleteEntityNotificationByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.destroy({ where: { Oid } }); }); /************************** Methods not attached to 'Controller' below here ******************************/ this.findAllEntityNotificationsByColumns = (columns) => __awaiter(this, void 0, void 0, function* () { return yield EntityNotification_1.EntityNotification.findAll({ where: Object.assign({}, columns), raw: true }); }); } } exports.default = new EntityNotificationService(); //# sourceMappingURL=EntityNotification.service.js.map