"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const entities_1 = require("../../../entities");
exports.updateUser = {
    async updateUser(_, { email, patch }) {
        const repository = typeorm_1.getRepository(entities_1.User);
        const user = await repository.findOne({ email });
        if (patch.password) {
            patch.password = entities_1.User.encode(patch.password);
        }
        return await repository.save(Object.assign({}, user, patch));
    }
};
//# sourceMappingURL=update-user.js.map