"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EvaluationStatusMutation = void 0;
const tslib_1 = require("tslib");
const type_graphql_1 = require("type-graphql");
const evaluation_status_1 = require("./evaluation-status");
const evaluation_status_type_1 = require("./evaluation-status-type");
let EvaluationStatusMutation = class EvaluationStatusMutation {
    async createEvaluationStatus(evaluationStatus, context) {
        const { tx } = context.state;
        return await tx.getRepository(evaluation_status_1.EvaluationStatus).save(Object.assign({}, evaluationStatus));
    }
    async updateEvaluationStatus(id, patch, context) {
        const { tx } = context.state;
        const repository = tx.getRepository(evaluation_status_1.EvaluationStatus);
        const evaluateStatus = await repository.findOneBy({ id });
        return await repository.save(Object.assign(Object.assign({}, evaluateStatus), patch));
    }
};
exports.EvaluationStatusMutation = EvaluationStatusMutation;
tslib_1.__decorate([
    (0, type_graphql_1.Directive)('@transaction'),
    (0, type_graphql_1.Mutation)(returns => evaluation_status_1.EvaluationStatus, { nullable: true, description: 'To create new EvaluationStatus' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('evaluationStatus')),
    tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [evaluation_status_type_1.NewEvaluationStatus, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], EvaluationStatusMutation.prototype, "createEvaluationStatus", null);
tslib_1.__decorate([
    (0, type_graphql_1.Directive)('@transaction'),
    (0, type_graphql_1.Mutation)(returns => evaluation_status_1.EvaluationStatus, { description: 'To modify EvaluationStatus information' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
    tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
    tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, evaluation_status_type_1.EvaluationStatusPatch, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], EvaluationStatusMutation.prototype, "updateEvaluationStatus", null);
exports.EvaluationStatusMutation = EvaluationStatusMutation = tslib_1.__decorate([
    (0, type_graphql_1.Resolver)(evaluation_status_1.EvaluationStatus)
], EvaluationStatusMutation);
//# sourceMappingURL=evaluation-status-mutation.js.map