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 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 OrderParticipant_1 = require("../persistent-classes/OrderParticipant"); class OrderParticipantService { constructor() { /*** generated service methods here ***/ this.findAllOrderParticipants = () => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.findAll({ raw: true }); }); this.findAllOrderParticipantsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.findAll({ where: { Oid }, raw: true }); }); this.findOneOrderParticipantByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.findOne({ where: { Oid }, raw: true }); }); this.updateOrderParticipant = (orderparticipant) => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.update(Object.assign({}, orderparticipant), { where: { Oid: orderparticipant['Oid'] } }); }); this.saveOrderParticipant = (orderparticipant) => __awaiter(this, void 0, void 0, function* () { return yield new OrderParticipant_1.OrderParticipant(Object.assign({}, orderparticipant)).save(); }); this.batchSaveOrderParticipants = (orderparticipants) => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.bulkCreate(orderparticipants.map((x) => { // do work here return Object.assign({}, x); })); }); this.deleteOrderParticipantByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.destroy({ where: { Oid } }); }); /************************** Methods not attached to 'Controller' below here ******************************/ this.findAllOrderParticipantsByColumns = (columns) => __awaiter(this, void 0, void 0, function* () { return yield OrderParticipant_1.OrderParticipant.findAll({ where: Object.assign({}, columns), raw: true }); }); } } exports.default = new OrderParticipantService(); //# sourceMappingURL=OrderParticipant.service.js.map