createUser.ts
367 Bytes
import { Context } from "../";
import User from "entity/User";
export default async (
root: {},
{ input: { email, password } },
context: Context
) => {
const { connection } = context;
const userRepo = connection.getRepository(User);
let user = new User();
user.email = email;
user.password = password;
await userRepo.save(user);
return user;
};