/taskManager

Primary LanguageTypeScript

Task manager assignment

Task manager is consist of 3 models: User, Task, Comment

Warning If something does not work, look at the screenshots


Queries & mutations

Create user

Query

mutation createUser($input: CreateUserInput!){
  createUser(input: $input) {
    email
    _id
    name
  }
}

Input

{
  "input": {
    "email": "1@example.com",
    "name": "Jane Doe",
    "password": "password"
  }
}

test

Login

Note If login does not work firts time, play second time

Query

mutation login($input: LoginInput!){
  login(input: $input) 
}

Input

{
  "input": {
    "email": "1@example.com",
    "password": "password"
  }
}

test

Create a task

You should authorize before to create a task

HTTP HEADERS

{
  "Authorization" : "/Token that recieved from login/"
}

Query

mutation createTask($input: CreateProductInput!){
  createProduct(input: $input){
    name,
    taskUserId,
    isParent
    parentId /If sub task, add parentId, else remove parentId/
    state
  }
}

Input

{
  "input": {
    "name": "A test task",
    "taskUserId" : "/task users mongoId/"
    "isParent": false,
    "parentId": "/An id of the parent task/",
    "state" : "done"
  }
}

test test

Get tasks

query tasks {
  tasks {
    _id,
    name,
    isParent
  }
}

test

Get a single task with subtasks

Query

query task($input: GetTaskInput!) {
  task(input: $input) {
    _id,
    name,
    subTasks{
      _id,
      name
    }
  }
}

Input

{
  "input": {
    "_id": "/parent task's mongoId/"
  }
}

test

Search task

Query

query search($input: SearchTaskInput!) {
  search(input: $input) {
    _id,
    name,
    subTasks{
      _id,
      name
    }
  }
}

Input

{
  "input": {
    "search": "/name of the task/"
  }
}

test

Create a comment

You should authorize before to create a comment

HTTP HEADERS

{
  "Authorization" : "/Token that recieved from login/"
}

Query

mutation createComment($input: CreateCommentInput!){
  createComment(input: $input){
    comment,
    taskId
  }
}

Input

{
  "input": {
    "comment" : "test comment",
    "taskId": "/a mongoid of the task/"
  }
}

test test