Skip to content

phuongvt24/demo_cloud_nestjs_graphql

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

About project

This is a project to build an API system for managing tasks among team members, encompassing APIs for user registration, login authentication, and task creation. Users can create tasks and assign them to other members who can participate in those tasks with roles such as Owner, Editor, and Viewer. Each role will have different permissions for interacting with the tasks

Techs, frameworks

Build from the source

Prerequisites:

Steps to run from source:

  1. Clone this repo

  2. Open repo with terminal or cmd

  3. Start environment with Docker Compose

npm run start-docker-dev
  1. Migration database
docker exec -it training_phuongvt_nodejs-app-1 sh
npm run migration:up
  1. Starts GraphQL server at: http://localhost:3000/graphql

Feature and example

Create new user
mutation {createUser(userData: {
     userName: "userName",
     password: "password",
     name: "name",
     email:"[email protected]"
   }) {
     data{
     userId
     name
     userName
     email
   }
  }
}
Login
mutation {
     login(userData: {
       userName: "userName",
       password: "password",
  }) {
    data{
      auth{
        accessToken
        refreshToken
      }
      user{
        userId
        userName
        name
        email
      }
    }
  }
}
Refresh token
{
  getAccessToken(
    refreshToken:"Refresh_token"
  ) {
   auth{
    accessToken
    refreshToken
  }
  }
}
Create new task
mutation {
  createTask(taskData:{
    title: "Sample Task 2"
    description: "This is a sample task"
    priority: High
    start: "2023-01-10" 
    end: "2023-02-20"   
  }) {
    data {
      taskId
      title
      priority
      status
    }
  }
}
Assign task
mutation assignTask($AssignTaskInput:AssignTaskInput! ){
  assignTask(assignData: $AssignTaskInput) {
   data{
    task{
    taskId
    title
    description
    priority
    status
    start
    end
  }
    members{
      userId
      name
      roleCode
    }
  }
  }
}

Test

#1 Excute container
docker exec -it training_phuongvt_nodejs-app-1 sh
#1.1 e2e tests
$ npm run test

Migration

#1 Excute container
docker exec -it training_phuongvt_nodejs-app-1 sh
#1.1 Generate a migration
MIGRATIONNAME=<migration name> npm run migration:generate
#1.2 Run migration
npm run migration:up
#1.3 Revert migration
npm run migration:down

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published