refactor: introduce internal/domain/ layer, rename model.go → entity.go

Move all business-logic packages from internal/ root into internal/domain/:
  auth, cuisine, diary, dish, home, ingredient, language, menu, product,
  recipe, recognition, recommendation, savedrecipe, tag, units, user

Rename model.go → entity.go in packages that hold domain entities:
  diary, dish, home, ingredient, menu, product, recipe, savedrecipe, user

Update all import paths accordingly (adapters, infra/server, cmd/server,
tests). No logic changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-03-15 22:12:07 +02:00
parent 6548f868c3
commit 6594013b53
58 changed files with 73 additions and 73 deletions

View File

@@ -0,0 +1,46 @@
package mocks
import (
"context"
"time"
"github.com/food-ai/backend/internal/domain/user"
)
type MockUserRepository struct {
UpsertByFirebaseUIDFn func(ctx context.Context, uid, email, name, avatarURL string) (*user.User, error)
GetByIDFn func(ctx context.Context, id string) (*user.User, error)
UpdateFn func(ctx context.Context, id string, req user.UpdateProfileRequest) (*user.User, error)
UpdateInTxFn func(ctx context.Context, id string, profileReq user.UpdateProfileRequest, caloriesReq *user.UpdateProfileRequest) (*user.User, error)
SetRefreshTokenFn func(ctx context.Context, id, token string, expiresAt time.Time) error
FindByRefreshTokenFn func(ctx context.Context, token string) (*user.User, error)
ClearRefreshTokenFn func(ctx context.Context, id string) error
}
func (m *MockUserRepository) UpsertByFirebaseUID(ctx context.Context, uid, email, name, avatarURL string) (*user.User, error) {
return m.UpsertByFirebaseUIDFn(ctx, uid, email, name, avatarURL)
}
func (m *MockUserRepository) GetByID(ctx context.Context, id string) (*user.User, error) {
return m.GetByIDFn(ctx, id)
}
func (m *MockUserRepository) Update(ctx context.Context, id string, req user.UpdateProfileRequest) (*user.User, error) {
return m.UpdateFn(ctx, id, req)
}
func (m *MockUserRepository) UpdateInTx(ctx context.Context, id string, profileReq user.UpdateProfileRequest, caloriesReq *user.UpdateProfileRequest) (*user.User, error) {
return m.UpdateInTxFn(ctx, id, profileReq, caloriesReq)
}
func (m *MockUserRepository) SetRefreshToken(ctx context.Context, id, token string, expiresAt time.Time) error {
return m.SetRefreshTokenFn(ctx, id, token, expiresAt)
}
func (m *MockUserRepository) FindByRefreshToken(ctx context.Context, token string) (*user.User, error) {
return m.FindByRefreshTokenFn(ctx, token)
}
func (m *MockUserRepository) ClearRefreshToken(ctx context.Context, id string) error {
return m.ClearRefreshTokenFn(ctx, id)
}