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.33 kB
JavaScript
;
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 NotificationRequestDetail_1 = require("../persistent-classes/NotificationRequestDetail");
class NotificationRequestDetailService {
constructor() {
/*** generated service methods here ***/
this.findAllNotificationRequestDetails = () => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.findAll({ raw: true });
});
this.findAllNotificationRequestDetailsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.findAll({ where: { Oid }, raw: true });
});
this.findOneNotificationRequestDetailByOid = (Oid) => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.findOne({ where: { Oid }, raw: true });
});
this.updateNotificationRequestDetail = (notificationrequestdetail) => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.update(Object.assign({}, notificationrequestdetail), { where: { Oid: notificationrequestdetail['Oid'] } });
});
this.saveNotificationRequestDetail = (notificationrequestdetail) => __awaiter(this, void 0, void 0, function* () {
return yield new NotificationRequestDetail_1.NotificationRequestDetail(Object.assign({}, notificationrequestdetail)).save();
});
this.batchSaveNotificationRequestDetails = (notificationrequestdetails) => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.bulkCreate(notificationrequestdetails.map((x) => {
// do work here
return Object.assign({}, x);
}));
});
this.deleteNotificationRequestDetailByOid = (Oid) => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.destroy({ where: { Oid } });
});
/************************** Methods not attached to 'Controller' below here ******************************/
this.findAllNotificationRequestDetailsByColumns = (columns) => __awaiter(this, void 0, void 0, function* () {
return yield NotificationRequestDetail_1.NotificationRequestDetail.findAll({ where: Object.assign({}, columns), raw: true });
});
}
}
exports.default = new NotificationRequestDetailService();
//# sourceMappingURL=NotificationRequestDetail.service.js.map