UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

43 lines (42 loc) 1.89 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 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) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AccountTitleRepo = void 0; const factory = require("../factory"); const accountTitle_1 = require("./mongoose/schemas/accountTitle"); /** * 科目リポジトリ */ class AccountTitleRepo { constructor(connection) { this.accountTitleModel = connection.model(accountTitle_1.modelName, (0, accountTitle_1.createSchema)()); } deleteByProject(params) { return __awaiter(this, void 0, void 0, function* () { yield this.accountTitleModel.deleteMany({ 'project.id': { $exists: true, $eq: params.project.id } }) .exec(); }); } getCursor(conditions, projection) { return this.accountTitleModel.find(conditions, projection) .sort({ codeValue: factory.sortType.Descending }) .cursor(); } unsetUnnecessaryFields(params) { return __awaiter(this, void 0, void 0, function* () { return this.accountTitleModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false }) .exec(); }); } } exports.AccountTitleRepo = AccountTitleRepo;