Task Vault is a task management application built with Go, utilizing MySQL for data storage and Go's native net/http for a RESTful API. The application follows Repository Architecture and Dependency Inversion principles, while also supporting custom middleware, session management, and database migration.
- User Management: Register, login, logout, update profile information, and upload avatars.
- Task Management: Create, edit, delete, and filter tasks.
- Category Management: Create, edit, and delete categories.
- Custom Middleware: Handle authentication, authorization, request logging, HTTP method restriction, and security headers.
- Session Management: Handle user authentication, session handling, and caching.
cmd/ → Initialization configuration, communication with modules, and application startup
config/ → Configuration management and database connection
internal/
├── contract/ → Defines interfaces for communication with external modules from `cmd`
├── middleware/ → Custom middleware for request processing
├── session/ → Manages user sessions
├── routes/ → Declares routes for the API
├── controller/ → Handles API requests
├── service/ → Business logic layer
├── repository/ → Database interaction layer
├── model/ → Defines models related to database entities and request/response formats
├── parser/ → Parses client input data
├── validator/ → Data validation
└── utils/ → Utility functions used throughout the application
migrations/ → Scripts to manage running database migrations
| Method |
Endpoint |
Description |
POST |
/api/v1/users/login |
Login |
POST |
/api/v1/users/register |
Register |
POST |
/api/v1/users/forgot-password |
Forgot Password |
POST |
/api/v1/users/{id}/logout |
Logout |
GET |
/api/v1/users/{id} |
View Profile |
GET |
/api/v1/users/{id}/avatar |
View Avatar |
PATCH |
/api/v1/users/{id}/avatar |
Update Avatar |
| Method |
Endpoint |
Description |
GET |
/api/v1/categories |
Get Categories |
POST |
/api/v1/categories |
Create Category |
GET |
/api/v1/categories/{id} |
Get Category Details |
PUT |
/api/v1/categories/{id} |
Update Category Name |
DELETE |
/api/v1/categories/{id} |
Delete Category |
| Method |
Endpoint |
Description |
POST |
/api/v1/tasks |
Create Task |
GET |
/api/v1/tasks |
Get Task List |
GET |
/api/v1/tasks/{id} |
View Task |
POST |
/api/v1/tasks/{id} |
Update Task |
DELETE |
/api/v1/tasks/{id} |
Delete Task |
GET |
/api/v1/tasks?category_id=1&status=complete&priority=medium&due_date=2025-04-07T08:27:57Z&sort=name&order=asc |
Filter Tasks |
| Parameter |
Description |
category_id |
(int) Filter tasks by category ID. |
status |
(string) Filter tasks by status (e.g., pending, doing, completed, overdue). |
priority |
(string) Filter tasks by priority (e.g., low, medium, high). |
due_date |
(string) Filter tasks by due date in ISO 8601 format (e.g., 2025-04-07T08:27:57Z, in UTC). |
sort |
(string) Field to sort tasks by (e.g., name, due_date, status, priority). |
order |
(string) Sort order (asc for ascending, desc for descending). |