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:
@@ -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()")
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user