This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const UserRoute = require("./user-test.spec"); | |
| const todoId = UserRoute.toDoSavedData; | |
| const query = `mutation addTodo($input: todoInput) { | |
| addTodo(input: $input) { | |
| code | |
| message | |
| data { | |
| success | |
| todo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const query = `query profileUser{ | |
| profileUser { | |
| code | |
| message | |
| data { | |
| success | |
| token | |
| user { | |
| name | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLString } from "graphql"; | |
| import { isAuthenticated } from "../middleware"; | |
| import { addTodo, deleteTodo, getAlltodosForUser, login, register, update } from "../routes"; | |
| import { todographqlSchema } from "./todographqlSchema"; | |
| import { userLoginSchema } from "./userLoginSchema"; | |
| import { userRegisterSchema } from "./userRegisterSchema"; | |
| // Define the Query type | |
| const queryType = new GraphQLObjectType({ | |
| name: "Query", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { GraphQLBoolean, GraphQLID, GraphQLInputObjectType, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLString } from "graphql"; | |
| // User type | |
| const todoType = new GraphQLObjectType({ | |
| name: "todo", | |
| fields: { | |
| id: { type: GraphQLID }, | |
| postedByid: { type: GraphQLID }, | |
| name: { type: GraphQLString }, | |
| title: { type: GraphQLString }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { model } from "mongoose"; | |
| import { completeRequest } from "../functions/complete"; | |
| import { Response } from "../models"; | |
| import { TodoSchema, UserSchema } from "../schemas"; | |
| const User = model("User", UserSchema); | |
| const Todo = model("Todo", TodoSchema); | |
| /** | |
| * This function creates a new Todo | |
| * @param args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Schema } from "mongoose"; | |
| import mongoose = require("mongoose"); | |
| mongoose.Promise = global.Promise; | |
| /** | |
| * This is Schema for Blog | |
| * @constant {BlogSchema} | |
| */ | |
| export const TodoSchema = new Schema({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jwt = require("jsonwebtoken"); | |
| import { model } from "mongoose"; | |
| import { completeRequest } from "../functions/complete"; | |
| import {Response} from "../models"; | |
| import {UserSchema} from "../schemas"; | |
| import {Config} from "../shared"; | |
| const User = model("User", UserSchema); | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import chai = require("chai"); | |
| import chaiAsPromised = require("chai-as-promised"); | |
| import chaiHttp = require("chai-http"); | |
| import { suite, test } from "mocha-typescript"; | |
| import { model } from "mongoose"; | |
| import sinon = require("sinon"); | |
| import { Response } from "../models"; | |
| import { UserSchema } from "../schemas"; | |
| import { TodoApp } from "../server"; | |
| import { Config } from "../shared"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const query = `query loginUser($input: UserInputLogin) { | |
| loginUser(input: $input) { | |
| code, | |
| message, | |
| data { | |
| success | |
| user { | |
| id | |
| name | |
| username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const query = `mutation registerUser($input: UserInputRegister) { | |
| registerUser(input: $input) { | |
| code | |
| message | |
| data { | |
| token | |
| success | |
| user { | |
| id | |
| createdAt |