0977d3a58b
- 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)
27 lines
449 B
Go
27 lines
449 B
Go
package entities
|
|
|
|
import "time"
|
|
|
|
type User struct {
|
|
ID string
|
|
Email string
|
|
PasswordHash string
|
|
Timezone string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func NewUser(email, passwordHash, timezone string) *User {
|
|
now := time.Now()
|
|
if timezone == "" {
|
|
timezone = "UTC"
|
|
}
|
|
return &User{
|
|
Email: email,
|
|
PasswordHash: passwordHash,
|
|
Timezone: timezone,
|
|
CreatedAt: now,
|
|
UpdatedAt: now,
|
|
}
|
|
}
|