fix: Change UpdatedAt data type to allow nullable values

This commit is contained in:
2026-03-28 23:43:59 -05:00
parent 35314e6e85
commit d0d32736a6
2 changed files with 11 additions and 6 deletions

View File

@@ -173,6 +173,7 @@ func getAllTasks() ([]models.Task, error) {
SELECT id, text, completed, created_at, updated_at
FROM tasks
ORDER BY created_at DESC
LIMIT 1000
`
rows, err := pool.Query(ctx, sql)

View File

@@ -1,11 +1,15 @@
package models
import "time"
import (
"time"
// "github.com/jackc/pgx/v5/pgtype"
)
type Task struct {
Id int `json:"id"`
Text string `json:"text"`
Completed bool `json:"completed"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedAt *time.Time `json:"updated_at"`
// UpdatedAt pgtype.Timestamptz `json:"updated_at"` /* evaluar la posibilidad de utilizarlo */
}