Line data Source code
1 : // Package auth は、ユースケースが依存するポート(インターフェース)と
2 : // ドメインエンティティの型エイリアスを定義します。
3 : package auth
4 :
5 : import (
6 : "time"
7 :
8 : "resume/internal/domain/entity"
9 : "resume/internal/domain/repository"
10 : stx "resume/internal/shared/tx"
11 : )
12 :
13 : // UserRepository is the repository interface for users table used by the auth use case.
14 : // It aliases the domain repository implementation so the use case depends on abstractions.
15 : type UserRepository = repository.UserRepository
16 :
17 : // AuthIdentityRepository is the repository interface for auth_identities table used by the auth use case.
18 : // It aliases the domain repository implementation so the use case depends on abstractions.
19 : // revive:disable:exported // パッケージ名と併せた命名の都合上、stutter の警告を抑制
20 : type AuthIdentityRepository = repository.UserIdentityRepository
21 :
22 : // revive:enable:exported
23 :
24 : // User is the domain user entity the auth use case works with.
25 : // It aliases entity.User to avoid leaking infra details into the use case.
26 : type User = entity.User
27 :
28 : // Identity is the domain auth identity entity the auth use case works with.
29 : // It aliases entity.UserIdentity to avoid leaking infra details into the use case.
30 : type Identity = entity.UserIdentity
31 :
32 : // TxRunner defines a transaction boundary abstraction used by the use case layer.
33 : // The actual implementation (e.g., GormTxRunner) is provided by the infra layer via DI.
34 : type TxRunner = stx.Runner
35 :
36 : // Clock provides current time (preferably UTC) for deterministic testing and clearer ownership of "now".
37 : type Clock interface{ Now() time.Time }
38 :
39 : // sysClock is the default Clock implementation returning time.Now().UTC().
40 : type sysClock struct{}
41 :
42 : // Now returns the current time in UTC.
43 0 : func (sysClock) Now() time.Time { return time.Now().UTC() }
|