Skip to content

The Notes API allows you to manage tasks and attach notes to them. You can create, retrieve, update, and delete tasks, as well as add detailed observations (notes) to each task.

Notifications You must be signed in to change notification settings

viniciusbavosa/Notes-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

11 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

Notes API

The Notes API allows you to manage tasks and attach notes to them. You can create, retrieve, update, and delete tasks, as well as add detailed observations (notes) to each task.

Tech Stack

  • Node
  • Express
  • TypeScript
  • Prisma
  • SQLite
  • Zod

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/ANMAR25_DSUP_TASKLY.git
    cd ANMAR25_DSUP_TASKLY
  2. Install dependencies

     npm install
  3. Database setup

    This project uses SQLite as the relational database and Prisma as the ORM (Object Relational Mapper).

    To create your database, first run npx prisma migrate dev

    This command will create a database inside your Prisma folder

    Next, run npx prisma generate to create your Prisma Client inside the config folder

  4. Environment setup

    Create a .env file in the root of your project as shown in .env-example. If you are using Prisma, it will create automatically for you

        DATABASE_URL=your_database_url
        PORT=your_server_port
    

    If PORT credential is not provided, the following will be used

      PORT=3000
    
  5. Run the application

    To start the API, run the command

    npm run server

šŸ“„ API Documentation

āœ… Task API

baseURL: http://localhost:your_server_port

[POST] /tasks

Creates a new task

Body

{
  "id": 1,
  "task": "Tarefa",
  "status": "todo",
  "priority": false,
  "notes": [],
  "created_at": "2025-04-21T00:36:28.870Z",
  "updated_at": "2025-04-21T00:36:28.870Z"
}

Responses

  • 201 Created: Returns the created task information
  • 400 Bad Request: If validation fails, returns an object with errors messages

[GET] /tasks

Retrieves a paginated list of tasks. Accepts optional query parameters for filtering and pagination:

  • limit (number): Maximum number of items per page (default: 5)
  • page (number): The page number (default: 1)
  • priority (boolean): Filter by priority

Request Example: GET /tasks?limit=10&page=1&priority=true

[
  {
    "id": 1,
    "task": "Tarefa",
    "status": "todo",
    "priority": false,
    "notes": [],
    "created_at": "2025-04-21T00:36:28.870Z",
    "updated_at": "2025-04-21T00:36:28.870Z"
  }
]

Responses

  • 200 OK: Returns the paginated list of tasks

[GET] /tasks/:id

Retrieves a specific task.

Body

{
  "id": 1,
  "task": "Tarefa",
  "status": "todo",
  "priority": false,
  "notes": [],
  "created_at": "2025-04-21T00:36:28.870Z",
  "updated_at": "2025-04-21T00:36:28.870Z"
}

Responses

  • 200 OK: Returns task information
  • 404 Not Found: The requested resource could not be found on the server

[GET] /tasks/status/:status

Retrieves a specific task by its status.

  • status (string): ["todo", "inprogress", "done"]

Body

{
  "id": 5,
  "task": "Tarefa",
  "status": "done",
  "priority": false,
  "notes": [],
  "created_at": "2025-04-21T00:36:28.870Z",
  "updated_at": "2025-04-21T00:36:28.870Z"
}

Responses

  • 200 OK: Returns task information filtered by status

[PUT] /tasks/:id/

Updates an existing one if already exists

Responses

  • 204 No Content: No body is returned
  • 404 Not Found: The requested resource could not be found on the server
  • 400 Bad Request: If validation fails, returns an object with errors messages

[DELETE] /tasks/:id/

Delete a task and its notes from the server

Responses

  • 204 No Content: No body is returned
  • 404 Not Found: The requested resource could not be found on the server

[DELETE] /tasks

Delete all tasks and its notes from the server

Responses

  • 204 No Content: No body is returned

šŸ“ Notes API

[POST] /tasks/:taskID/notes

Creates a new observation note for a task

Body

{
  "id": 1,
  "task_id": 2,
  "note": "ObservaƧƵes da task 2",
  "created_at": "2025-04-21T00:36:28.870Z",
  "updated_at": "2025-04-21T00:36:28.870Z"
}

Responses

  • 201 Created: Returns the created note information
  • 400 Bad Request: If validation fails, returns an object with errors messages
  • 404 Not Found: The requested resource could not be found on the server

[GET] /tasks/:taskID/notes

Retrieves a paginated list of notes. Accepts optional query parameters for filtering and pagination:

  • limit (number): Maximum number of items per page (default: 5)
  • page (number): The page number (default: 1)

Request Example: GET /tasks/1/notes/?limit=10&page=1

[
  {
    "id": 1,
    "task_id": 100,
    "note": "Observação da task 100",
    "created_at": "2025-04-21T00:36:28.870Z",
    "updated_at": "2025-04-21T00:36:28.870Z"
  }
]

Responses

  • 200 OK: Returns the paginated list of tasks
  • 404 Not Found: The requested resource could not be found on the server

[GET] /notes/:id

Retrieves a specific note.

Body

{
  "id": 1,
  "task_id": 5,
  "note": "ObservaƧƵes da task 5",
  "created_at": "2025-04-21T00:36:28.870Z",
  "updated_at": "2025-04-21T00:36:28.870Z"
}

Responses

  • 200 OK: Returns note information
  • 400 Bad Request: If validation fails, returns an object with errors messages
  • 404 Not Found: The requested resource could not be found on the server

[PUT] /notes/:id/

Updates an existing one if already exists

Responses

  • 204 No Content: No body is returned
  • 404 Not Found: The requested resource could not be found on the server
  • 400 Bad Request: If validation fails, returns an object with errors messages

[DELETE] /notes/:id/

Delete a specific note

Responses

  • 204 No Content: No body is returned
  • 404 Not Found: The requested resource could not be found on the server

About

The Notes API allows you to manage tasks and attach notes to them. You can create, retrieve, update, and delete tasks, as well as add detailed observations (notes) to each task.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published