"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnalysisQuery = exports.ProcessQuery = void 0;
const tslib_1 = require("tslib");
require("@things-factory/auth-base"); /* for Resolver Context */
const type_graphql_1 = require("type-graphql");
const shell_1 = require("@things-factory/shell");
const analysis_1 = require("./analysis");
const process_1 = require("../process/process");
let ProcessQuery = class ProcessQuery {
    async analysis(process) {
        return await (0, shell_1.getRepository)(analysis_1.Analysis).findOneBy({ process: { id: process.id } });
    }
};
exports.ProcessQuery = ProcessQuery;
tslib_1.__decorate([
    (0, type_graphql_1.FieldResolver)(type => analysis_1.Analysis),
    tslib_1.__param(0, (0, type_graphql_1.Root)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [process_1.Process]),
    tslib_1.__metadata("design:returntype", Promise)
], ProcessQuery.prototype, "analysis", null);
exports.ProcessQuery = ProcessQuery = tslib_1.__decorate([
    (0, type_graphql_1.Resolver)(process_1.Process)
], ProcessQuery);
let AnalysisQuery = class AnalysisQuery {
    async analysis(id, context) {
        return await (0, shell_1.getRepository)(analysis_1.Analysis).findOne({
            where: { id }
        });
    }
};
exports.AnalysisQuery = AnalysisQuery;
tslib_1.__decorate([
    (0, type_graphql_1.Query)(returns => analysis_1.Analysis, { nullable: true, description: 'To fetch a Analysis' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
    tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], AnalysisQuery.prototype, "analysis", null);
exports.AnalysisQuery = AnalysisQuery = tslib_1.__decorate([
    (0, type_graphql_1.Resolver)(analysis_1.Analysis)
], AnalysisQuery);
//# sourceMappingURL=analysis-query.js.map