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.26 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 VwContentAndAttachments_1 = require("../persistent-classes/VwContentAndAttachments"); class VwContentAndAttachmentsService { constructor() { /*** generated service methods here ***/ this.findAllVwContentAndAttachmentses = () => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.findAll({ raw: true }); }); this.findAllVwContentAndAttachmentsesByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.findAll({ where: { Oid }, raw: true }); }); this.findOneVwContentAndAttachmentsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.findOne({ where: { Oid }, raw: true }); }); this.updateVwContentAndAttachments = (vwcontentandattachments) => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.update(Object.assign({}, vwcontentandattachments), { where: { Oid: vwcontentandattachments['Oid'] } }); }); this.saveVwContentAndAttachments = (vwcontentandattachments) => __awaiter(this, void 0, void 0, function* () { return yield new VwContentAndAttachments_1.VwContentAndAttachments(Object.assign({}, vwcontentandattachments)).save(); }); this.batchSaveVwContentAndAttachmentses = (vwcontentandattachmentses) => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.bulkCreate(vwcontentandattachmentses.map((x) => { // do work here return Object.assign({}, x); })); }); this.deleteVwContentAndAttachmentsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.destroy({ where: { Oid } }); }); /************************** Methods not attached to 'Controller' below here ******************************/ this.findAllVwContentAndAttachmentsesByColumns = (columns) => __awaiter(this, void 0, void 0, function* () { return yield VwContentAndAttachments_1.VwContentAndAttachments.findAll({ where: Object.assign({}, columns), raw: true }); }); } } exports.default = new VwContentAndAttachmentsService(); //# sourceMappingURL=VwContentAndAttachments.service.js.map