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.3 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 VwContentWIthAttachments_1 = require("../persistent-classes/VwContentWIthAttachments");
class VwContentWIthAttachmentsService {
constructor() {
/*** generated service methods here ***/
this.findAllVwContentWIthAttachmentses = () => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.findAll({ raw: true });
});
this.findAllVwContentWIthAttachmentsesByOid = (Oid) => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.findAll({ where: { Oid }, raw: true });
});
this.findOneVwContentWIthAttachmentsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.findOne({ where: { Oid }, raw: true });
});
this.updateVwContentWIthAttachments = (vwcontentwithattachments) => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.update(Object.assign({}, vwcontentwithattachments), { where: { Oid: vwcontentwithattachments['Oid'] } });
});
this.saveVwContentWIthAttachments = (vwcontentwithattachments) => __awaiter(this, void 0, void 0, function* () {
return yield new VwContentWIthAttachments_1.VwContentWIthAttachments(Object.assign({}, vwcontentwithattachments)).save();
});
this.batchSaveVwContentWIthAttachmentses = (vwcontentwithattachmentses) => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.bulkCreate(vwcontentwithattachmentses.map((x) => {
// do work here
return Object.assign({}, x);
}));
});
this.deleteVwContentWIthAttachmentsByOid = (Oid) => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.destroy({ where: { Oid } });
});
/************************** Methods not attached to 'Controller' below here ******************************/
this.findAllVwContentWIthAttachmentsesByColumns = (columns) => __awaiter(this, void 0, void 0, function* () {
return yield VwContentWIthAttachments_1.VwContentWIthAttachments.findAll({ where: Object.assign({}, columns), raw: true });
});
}
}
exports.default = new VwContentWIthAttachmentsService();
//# sourceMappingURL=VwContentWIthAttachments.service.js.map