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.54 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 MilestoneNotificationPreference_1 = require("../persistent-classes/MilestoneNotificationPreference"); class MilestoneNotificationPreferenceService { constructor() { /*** generated service methods here ***/ this.findAllMilestoneNotificationPreferences = () => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.findAll({ raw: true }); }); this.findAllMilestoneNotificationPreferencesByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.findAll({ where: { Oid }, raw: true }); }); this.findOneMilestoneNotificationPreferenceByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.findOne({ where: { Oid }, raw: true }); }); this.updateMilestoneNotificationPreference = (milestonenotificationpreference) => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.update(Object.assign({}, milestonenotificationpreference), { where: { Oid: milestonenotificationpreference['Oid'] } }); }); this.saveMilestoneNotificationPreference = (milestonenotificationpreference) => __awaiter(this, void 0, void 0, function* () { return yield new MilestoneNotificationPreference_1.MilestoneNotificationPreference(Object.assign({}, milestonenotificationpreference)).save(); }); this.batchSaveMilestoneNotificationPreferences = (milestonenotificationpreferences) => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.bulkCreate(milestonenotificationpreferences.map((x) => { // do work here return Object.assign({}, x); })); }); this.deleteMilestoneNotificationPreferenceByOid = (Oid) => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.destroy({ where: { Oid } }); }); /************************** Methods not attached to 'Controller' below here ******************************/ this.findAllMilestoneNotificationPreferencesByColumns = (columns) => __awaiter(this, void 0, void 0, function* () { return yield MilestoneNotificationPreference_1.MilestoneNotificationPreference.findAll({ where: Object.assign({}, columns), raw: true }); }); } } exports.default = new MilestoneNotificationPreferenceService(); //# sourceMappingURL=MilestoneNotificationPreference.service.js.map