Add closed_at timestamp tracking to issues
- Add closed_at field to Issue type with JSON marshaling - Implement closed_at timestamp in SQLite storage layer - Update import/export to handle closed_at field - Add comprehensive tests for closed_at functionality - Maintain backward compatibility with existing databases Amp-Thread-ID: https://ampcode.com/threads/T-f3a7799b-f91e-4432-a690-aae0aed364b3 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -37,6 +37,7 @@ func TestExportImport(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
// Create test issues
|
||||
now := time.Now()
|
||||
issues := []*types.Issue{
|
||||
{
|
||||
ID: "test-1",
|
||||
@@ -45,8 +46,8 @@ func TestExportImport(t *testing.T) {
|
||||
Status: types.StatusOpen,
|
||||
Priority: 1,
|
||||
IssueType: types.TypeBug,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
},
|
||||
{
|
||||
ID: "test-2",
|
||||
@@ -56,8 +57,8 @@ func TestExportImport(t *testing.T) {
|
||||
Priority: 2,
|
||||
IssueType: types.TypeFeature,
|
||||
Assignee: "alice",
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
},
|
||||
{
|
||||
ID: "test-3",
|
||||
@@ -66,8 +67,9 @@ func TestExportImport(t *testing.T) {
|
||||
Status: types.StatusClosed,
|
||||
Priority: 3,
|
||||
IssueType: types.TypeTask,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
ClosedAt: &now,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -177,7 +179,7 @@ func TestExportImport(t *testing.T) {
|
||||
// Import as update
|
||||
updates := map[string]interface{}{
|
||||
"title": issue.Title,
|
||||
"status": issue.Status,
|
||||
"status": string(issue.Status),
|
||||
}
|
||||
if err := store.UpdateIssue(ctx, issue.ID, updates, "test"); err != nil {
|
||||
t.Fatalf("UpdateIssue failed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user