refactor: разделил приложение на domain application adapters и HTTP DTO

This commit is contained in:
2026-10-20 21:44:59 +03:00
parent 13ee5a0e56
commit 3f69970b05
59 changed files with 1324 additions and 1087 deletions
+4 -12
View File
@@ -12,7 +12,7 @@ import (
"time"
"unicode/utf8"
"mtusi2026lab3/internal/store"
"mtusi2026lab3/internal/application"
"mtusi2026lab3/internal/transport/http/response"
)
@@ -30,20 +30,18 @@ type ReadinessChecker interface {
type Option func(*Handler)
type Handler struct {
store store.Repository
service *application.Service
readinessChecker ReadinessChecker
readinessTimeout time.Duration
sessionTTL time.Duration
}
func NewHandler(
repository store.Repository,
service *application.Service,
options ...Option,
) *Handler {
handler := &Handler{
store: repository,
service: service,
readinessTimeout: 2 * time.Second,
sessionTTL: time.Hour,
}
for _, option := range options {
@@ -63,12 +61,6 @@ func WithReadiness(
}
}
func WithSessionTTL(ttl time.Duration) Option {
return func(handler *Handler) {
handler.sessionTTL = ttl
}
}
func decodeJSON(r *http.Request, destination any) error {
mediaType, parameters, err := mime.ParseMediaType(
r.Header.Get("Content-Type"),