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.
- Node
- Express
- TypeScript
- Prisma
- SQLite
- Zod
-
Clone the repository:
git clone https://github.com/your-username/ANMAR25_DSUP_TASKLY.git cd ANMAR25_DSUP_TASKLY
-
Install dependencies
npm install
-
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 theconfig
folder -
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 youDATABASE_URL=your_database_url PORT=your_server_port
If
PORT
credential is not provided, the following will be usedPORT=3000
-
Run the application
To start the API, run the command
npm run server
baseURL: http://localhost:your_server_port
Creates a new task
{
"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"
}
201 Created
: Returns the created task information400 Bad Request
: If validation fails, returns an object with errors messages
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"
}
]
200 OK
: Returns the paginated list of tasks
Retrieves a specific task.
{
"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"
}
200 OK
: Returns task information404 Not Found
: The requested resource could not be found on the server
Retrieves a specific task by its status.
status
(string):["todo", "inprogress", "done"]
{
"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"
}
200 OK
: Returns task information filtered by status
Updates an existing one if already exists
204 No Content
: No body is returned404 Not Found
: The requested resource could not be found on the server400 Bad Request
: If validation fails, returns an object with errors messages
Delete a task and its notes from the server
204 No Content
: No body is returned404 Not Found
: The requested resource could not be found on the server
Delete all tasks and its notes from the server
204 No Content
: No body is returned
Creates a new observation note for a task
{
"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"
}
201 Created
: Returns the created note information400 Bad Request
: If validation fails, returns an object with errors messages404 Not Found
: The requested resource could not be found on the server
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"
}
]
200 OK
: Returns the paginated list of tasks404 Not Found
: The requested resource could not be found on the server
Retrieves a specific note.
{
"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"
}
200 OK
: Returns note information400 Bad Request
: If validation fails, returns an object with errors messages404 Not Found
: The requested resource could not be found on the server
Updates an existing one if already exists
204 No Content
: No body is returned404 Not Found
: The requested resource could not be found on the server400 Bad Request
: If validation fails, returns an object with errors messages
Delete a specific note
204 No Content
: No body is returned404 Not Found
: The requested resource could not be found on the server