Implement domain layer (TDD - Green phase)
Implementation to make all tests pass: Value Objects: - HabitType: BOOLEAN, COUNTER, VALUE with validation - Frequency: DAILY, WEEKLY, MONTHLY with validation Entities: - User: email, password hash, timezone with defaults - Habit: tracking habits with type, frequency, carry-over - HabitEntry: recording habit completions with soft delete Repositories (interfaces): - UserRepository: CRUD operations for users - HabitRepository: CRUD operations for habits - HabitEntryRepository: CRUD operations for entries Shared: - Common error definitions for domain layer All domain tests now pass.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"habit-tracker-api/internal/domain/entities"
|
||||
)
|
||||
|
||||
type HabitEntryRepository interface {
|
||||
Create(ctx context.Context, entry *entities.HabitEntry) error
|
||||
FindByID(ctx context.Context, id string) (*entities.HabitEntry, error)
|
||||
FindByHabitID(ctx context.Context, habitID string) ([]*entities.HabitEntry, error)
|
||||
FindByHabitIDAndDateRange(ctx context.Context, habitID string, from, to time.Time) ([]*entities.HabitEntry, error)
|
||||
FindPendingByHabitID(ctx context.Context, habitID string, beforeDate time.Time) ([]*entities.HabitEntry, error)
|
||||
Update(ctx context.Context, entry *entities.HabitEntry) error
|
||||
Delete(ctx context.Context, id string) error
|
||||
}
|
||||
Reference in New Issue
Block a user