From d0d32736a64efe43b5b07da9139695cea1a76702 Mon Sep 17 00:00:00 2001 From: Kylesoda <249518290+kylesoda@users.noreply.github.com> Date: Sat, 28 Mar 2026 23:43:59 -0500 Subject: [PATCH] fix: Change UpdatedAt data type to allow nullable values --- cmd/main.go | 1 + internal/models/task.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index fa83bac..04a02f2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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) diff --git a/internal/models/task.go b/internal/models/task.go index c0da30e..3662cb3 100644 --- a/internal/models/task.go +++ b/internal/models/task.go @@ -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"` + 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 pgtype.Timestamptz `json:"updated_at"` /* evaluar la posibilidad de utilizarlo */ }