@accounter/server
Version:
Accounter GraphQL server
53 lines • 1.74 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { Injectable, Scope } from 'graphql-modules';
import { sql } from '@pgtyped/runtime';
import { TenantAwareDBClient } from '../../app-providers/tenant-db-client.js';
const getAllPensionFunds = sql `
SELECT *
FROM accounter_schema.pension_funds
WHERE accounter_schema.pension_funds.type = 'pension';`;
const getAllTrainingFunds = sql `
SELECT *
FROM accounter_schema.pension_funds
WHERE accounter_schema.pension_funds.type = 'training_fund';`;
const getAllFunds = sql `
SELECT * FROM accounter_schema.pension_funds;`;
let FundsProvider = class FundsProvider {
db;
constructor(db) {
this.db = db;
}
pensionFundsCache = null;
getAllPensionFunds() {
if (this.pensionFundsCache) {
return this.pensionFundsCache;
}
this.pensionFundsCache = getAllPensionFunds.run(undefined, this.db);
return this.pensionFundsCache;
}
trainingFundsCache = null;
getAllTrainingFunds() {
if (this.trainingFundsCache) {
return this.trainingFundsCache;
}
this.trainingFundsCache = getAllTrainingFunds.run(undefined, this.db);
return this.trainingFundsCache;
}
allFundsCache = null;
getAllFunds(params) {
if (this.allFundsCache) {
return this.allFundsCache;
}
this.allFundsCache = getAllFunds.run(params, this.db);
return this.allFundsCache;
}
};
FundsProvider = __decorate([
Injectable({
scope: Scope.Operation,
global: true,
}),
__metadata("design:paramtypes", [TenantAwareDBClient])
], FundsProvider);
export { FundsProvider };
//# sourceMappingURL=funds.provider.js.map