Implement SQLite persistence layer (TDD)

- Add SQLite and UUID dependencies (go-sqlite3, google/uuid)
- Create database connection with automatic migrations
- Implement UserRepository with full CRUD operations
- Implement HabitRepository with JSON serialization for arrays
- Implement HabitEntryRepository with date range queries
- Add comprehensive test coverage for all repositories
- Fix User entity to default timezone to UTC when empty
- All tests passing with TDD approach (Red-Green-Refactor)
This commit is contained in:
david committed 2025-11-25 14:29:51 +01:00
1 parent 64bfe80806
commit 0977d3a58b
14 files changed
+1530 -1

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@ func TestHabitEntry_SoftDelete(t *testing.T) {
t.Error("New entry should not be deleted")
}
entry.SoftDelete()
entry.Delete()
if entry.DeletedAt == nil {
t.Error("Entry should be deleted after calling SoftDelete()")
+3
View File
@@ -13,6 +13,9 @@ type User struct {
func NewUser(email, passwordHash, timezone string) *User {
now := time.Now()
if timezone == "" {
timezone = "UTC"
}
return &User{
Email: email,
PasswordHash: passwordHash,