implement proper timestamps

This commit is contained in:
2025-03-24 11:45:54 -04:00
parent d1e77ad4e2
commit 8948640311
3 changed files with 38 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ package api
import (
"errors"
"time"
"git.dubyatp.xyz/chat-api-server/db"
)
@@ -39,7 +40,7 @@ func dbGetMessage(id string) (*Message, error) {
ID: message["ID"].(string),
UserID: int64(message["UserID"].(float64)),
Body: message["Body"].(string),
Timestamp: int64(message["Timestamp"].(float64)),
Timestamp: time.Time(time.Now()),
}, nil
}
}
@@ -61,7 +62,7 @@ func dbGetAllMessages() ([]*Message, error) {
ID: message["ID"].(string),
UserID: int64(message["UserID"].(float64)),
Body: message["Body"].(string),
Timestamp: int64(message["Timestamp"].(float64)),
Timestamp: time.Time(time.Now()),
})
}
if len(result) == 0 {