"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const user_1 = require("../../../entities/user");
exports.signup = {
    async signup(_, { user: attrs }) {
        const repository = typeorm_1.getRepository(user_1.User);
        const user = await repository.findOne({ email: attrs.email });
        if (user) {
            throw new Error('duplicated user'); // FIXME howto...
        }
        return await repository.save(Object.assign({}, attrs));
    }
};
//# sourceMappingURL=signup.js.map