ajoute snapshot

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-06-13 22:52:13 +02:00
commit 0f2d7126eb
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
11 changed files with 862 additions and 19 deletions

View file

@ -7,6 +7,7 @@ import (
"git.g3e.fr/H6N/account/internal/config"
"git.g3e.fr/H6N/account/internal/handler"
"git.g3e.fr/H6N/account/internal/snapshot"
"git.g3e.fr/H6N/account/internal/store"
"github.com/jackc/pgx/v5/pgxpool"
)
@ -35,10 +36,16 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (s *Server) routes() {
st := store.New(s.pool)
horizonDays := 30
if s.cfg != nil {
horizonDays = s.cfg.SnapshotHorizonDays
}
eng := snapshot.New(st, s.logger, horizonDays)
handler.NewInstrumentHandler(st).RegisterRoutes(s.mux)
handler.NewAccountHandler(st).RegisterRoutes(s.mux)
handler.NewTransactionHandler(st).RegisterRoutes(s.mux)
handler.NewSnapshotHandler(eng).RegisterRoutes(s.mux)
s.mux.HandleFunc("GET /health", s.handleHealth)
}