Skip to content

Commit

Permalink
Fix reopener bug πŸ› occurred in unusual conditions πŸ€“
Browse files Browse the repository at this point in the history
  • Loading branch information
violog committed Jun 17, 2024
1 parent 54f22b1 commit 5585bd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions internal/data/pg/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ func (q *events) SelectAbsentTypes(allTypes ...string) ([]data.ReopenableEvent,
)
SELECT u.nullifier, t.type
FROM (
SELECT DISTINCT nullifier FROM %s
SELECT nullifier FROM %s
) u
CROSS JOIN types t
LEFT JOIN %s e ON e.nullifier = u.nullifier AND e.type = t.type
WHERE e.type IS NULL;
`, strings.Join(values, ", "), eventsTable, eventsTable)
`, strings.Join(values, ", "), balancesTable, eventsTable)

var res []data.ReopenableEvent
if err := q.db.SelectRaw(&res, query); err != nil {
Expand Down
18 changes: 9 additions & 9 deletions internal/service/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ func Run(ctx context.Context, cfg config.Config) {
)
r.Route("/integrations/rarime-points-svc/v1", func(r chi.Router) {
r.Route("/public", func(r chi.Router) {
r.Route("/balances/{nullifier}", func(r chi.Router) {
r.Route("/balances", func(r chi.Router) {
r.Use(handlers.AuthMiddleware(cfg.Auth(), cfg.Log()))
r.Get("/", handlers.GetBalance)
r.Post("/verifypassport", handlers.VerifyPassport)
r.Get("/withdrawals", handlers.ListWithdrawals)
r.Post("/withdrawals", handlers.Withdraw)
r.Post("/", handlers.CreateBalance)
r.Route("/{nullifier}", func(r chi.Router) {
r.Get("/", handlers.GetBalance)
r.Post("/verifypassport", handlers.VerifyPassport)
r.Get("/withdrawals", handlers.ListWithdrawals)
r.Post("/withdrawals", handlers.Withdraw)
})
})
r.Route("/events", func(r chi.Router) {
r.Use(handlers.AuthMiddleware(cfg.Auth(), cfg.Log()))
r.Get("/", handlers.ListEvents)
r.Get("/{id}", handlers.GetEvent)
r.Patch("/{id}", handlers.ClaimEvent)
})
r.Route("/balances", func(r chi.Router) {
r.Get("/", handlers.Leaderboard)
r.Post("/", handlers.CreateBalance)
})
r.Get("/balances", handlers.Leaderboard)
r.Get("/point_price", handlers.GetPointPrice)
r.Get("/countries_config", handlers.GetCountriesConfig)
r.Get("/event_types", handlers.ListEventTypes)
Expand Down

0 comments on commit 5585bd2

Please sign in to comment.