diff --git a/go.mod b/go.mod index 965d655..79ca8b5 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/yourname/deflated +module git.seaofstars.xyz/mohd/deflated go 1.23 @@ -9,3 +9,12 @@ require ( github.com/jackc/pgx/v5 v5.6.0 github.com/joho/godotenv v1.5.1 ) + +require ( + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/text v0.14.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..f0d8fea --- /dev/null +++ b/go.sum @@ -0,0 +1,36 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s= +github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= +github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY= +github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/api/handlers.go b/internal/api/handlers.go index 308ddda..3e465b6 100644 --- a/internal/api/handlers.go +++ b/internal/api/handlers.go @@ -12,9 +12,9 @@ import ( "github.com/go-chi/chi/v5" "github.com/google/uuid" "github.com/jackc/pgx/v5" - "github.com/yourname/deflated/internal/db" - "github.com/yourname/deflated/internal/models" - "github.com/yourname/deflated/internal/parser" + "git.seaofstars.xyz/mohd/deflated/internal/db" + "git.seaofstars.xyz/mohd/deflated/internal/models" + "git.seaofstars.xyz/mohd/deflated/internal/parser" ) // handlers holds shared dependencies (database, future: storage client, etc.) diff --git a/internal/api/router.go b/internal/api/router.go index f010aa8..b52eb46 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -8,7 +8,7 @@ import ( "github.com/go-chi/chi/v5/middleware" "github.com/go-chi/cors" "github.com/jackc/pgx/v5/pgxpool" - "github.com/yourname/deflated/internal/db" + "git.seaofstars.xyz/mohd/deflated/internal/db" ) // NewRouter builds the full Chi router with middleware and all routes. diff --git a/internal/handlers/items.go b/internal/handlers/items.go index 170ec04..14509b9 100644 --- a/internal/handlers/items.go +++ b/internal/handlers/items.go @@ -7,7 +7,7 @@ import ( "github.com/go-chi/chi/v5" - "github.com/yourname/deflated/internal/db" + "git.seaofstars.xyz/mohd/deflated/internal/db" ) // ItemHandler handles routes that return price and inflation data. diff --git a/internal/handlers/receipts.go b/internal/handlers/receipts.go index 34e559f..6770e0b 100644 --- a/internal/handlers/receipts.go +++ b/internal/handlers/receipts.go @@ -14,8 +14,8 @@ import ( "github.com/go-chi/chi/v5" "github.com/google/uuid" - "github.com/yourname/deflated/internal/db" - "github.com/yourname/deflated/internal/inflation" + "git.seaofstars.xyz/mohd/deflated/internal/db" + "git.seaofstars.xyz/mohd/deflated/internal/inflation" ) // ReceiptHandler handles HTTP requests related to receipt submissions. diff --git a/internal/inflation/worker.go b/internal/inflation/worker.go index a485b99..b560824 100644 --- a/internal/inflation/worker.go +++ b/internal/inflation/worker.go @@ -7,7 +7,7 @@ import ( "log" "time" - "github.com/yourname/deflated/internal/db" + "git.seaofstars.xyz/mohd/deflated/internal/db" ) // StartRefreshWorker runs in a goroutine and refreshes price snapshots @@ -36,7 +36,8 @@ func StartRefreshWorker(ctx context.Context, q *db.Queries, interval time.Durati func runRefresh(ctx context.Context, q *db.Queries) { start := time.Now() - if err := q.RefreshPriceSnapshots(ctx); err != nil { + // using RebuildSnapshots instead of refreshsnapshots for now + if err := q.RebuildSnapshots(ctx); err != nil { log.Printf("error refreshing price snapshots: %v", err) return }