Files
apocapoc-api/internal/domain/entities/user.go
T
david 0977d3a58b 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)
2025-11-25 14:29:51 +01:00

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,
}
}