Skip to content

JuliaKovtun/task_manager

Repository files navigation

README

Ruby on Rails-based project management system, designed to allow users to manage and track projects and tasks through a simple and intuitive RESTful API interface. It focuses on providing essential functionalities for project and task management, including creation, editing, and viewing, along with secure user authentication.

Project set up

To get started with Task Manager, clone the repository, install the required gems:

git clone https://github.com/JuliaKovtun/task_manager.git
cd task_manager
bundle install
rails db:migrate
rails db:seed

To run the project use --dev-caching for enabling caching in development environment:

rails s --dev-caching

API

Authentication

By default seeds create the user with an email user@gmail.com and a password 123456. You will need these credentials for authentication.

curl --location --request POST 'http://localhost:3000/users/sign_in' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "user": {
    "email": "user@gmail.com",
    "password": "123456"
  }
}'

On success, you will receive auth_token, which you will need to use in headers for the next requests. Example of successful result:

{
    "success": true,
    "auth_token": "byQt8nESTsfWVd22nEBH",
    "email": "user@gmail.com"
}

In the next requests you will need to replace generated_token with the one you receive in the response to this request.

GET /projects/:id

Returns one project.

curl --location --request GET 'http://localhost:3000/projects/:id' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token'

GET /projects

Returns all projects.

curl --location --request GET 'http://localhost:3000/projects/' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token' \
--header 'Accept: application/json'

POST /projects

Creates a project.

curl --location --request POST 'http://localhost:3000/projects/' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
  "project": {
    "title": "Project title",
    "description": "Project description"
  }
}'

PUT /projects

Updates a project.

curl --location --request PUT 'http://localhost:3000/projects/:id' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token' \
--header 'Content-Type: application/json' \
--data '{
  "project": {
    "title": "Project title",
    "description": "Project description"
  }
}'

DELETE /projects/:id

Deletes project.

curl --location --request DELETE 'http://localhost:3000/projects/:id' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token'

GET /projects/:project_id/tasks/:id

Returns one task.

curl --location --request GET 'http://localhost:3000/projects/:project_id/tasks/:id' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token'

GET /projects/:project_id/tasks

Returns all tasks in project. You can filter tasks by status using url params:

?status=new
?status=in_progress
?status=done

Example request with filter:

curl --location --request GET 'http://localhost:3000/projects/:project_id/tasks?status=in_progress' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token'

Example request without filter:

curl --location --request GET 'http://localhost:3000/projects/:project_id/tasks' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token'

POST /projects/:project_id/tasks

Creates a task. Possible params for task status are: new, in_progress, done.

curl --location --request POST 'http://localhost:3000/projects/:project_id/tasks' \
--header 'Accept: application/json' \
--header 'X-User-Email: user@gmail.com' \
--header 'X-User-Token: generated_token' \
--header 'Content-Type: application/json' \
--data '{
  "task": {
    "title": "Task title",
    "description": "Task description",
    "status": "in_progress"
  }
}'

PUT /projects/:project_id/tasks/:id

Updates the task.

curl --location --request PUT 'http://localhost:3000/projects/:project_id/tasks/:id' \
--header 'Accept: application/json' \
--header 'X-User-Token: generated_token' \
--header 'X-User-Email: user@gmail.com' \
--header 'Content-Type: application/json' \
--data '{
  "task": {
    "title": "Updated task title",
    "description": "Updated task description",
    "status": "new"
  }
}'

DELETE /projects/:project_id/tasks/:id

Deletes the task.

curl --location --request DELETE 'http://localhost:3000/projects/26/tasks/32' \
--header 'Accept: application/json' \
--header 'X-User-Token: generated_token' \
--header 'X-User-Email: user@gmail.com'

How to run the test suite

bundle exec rspec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages