Automated Action 887703b6a2 Add Go Todo App implementation
This commit adds a complete Go implementation of the Todo application. The
application uses Gin framework for the web server, GORM for database access,
and SQLite for storage.

Key features:
- Todo CRUD operations with the same API endpoints
- Health check endpoint
- Database migrations
- Tests for models, services, and API handlers
- Documentation for the API
- Configurable settings
2025-05-17 22:20:05 +00:00

40 lines
1.0 KiB
Go

package dto
import (
"time"
)
// TodoBase contains the common fields for todo operations
type TodoBase struct {
Title string `json:"title" binding:"required"`
Description string `json:"description"`
Completed bool `json:"completed" default:"false"`
}
// TodoCreate represents the data needed to create a new todo
type TodoCreate struct {
TodoBase
}
// TodoUpdate represents the data that can be updated for a todo
type TodoUpdate struct {
Title *string `json:"title"`
Description *string `json:"description"`
Completed *bool `json:"completed"`
}
// TodoResponse represents the todo data sent back to the client
type TodoResponse struct {
ID uint `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Completed bool `json:"completed"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// HealthResponse represents the health check response
type HealthResponse struct {
Status string `json:"status"`
DBStatus string `json:"db_status"`
}