misc changes

This commit is contained in:
Paul 2022-02-27 01:17:21 +01:00
parent 8512402488
commit 8cb9c51bde
2 changed files with 2 additions and 8 deletions

View File

@ -24,7 +24,7 @@ func GetIPs(ctx *context.Context, config *config.Config, limit int) (apimailboxe
return
}
// GetIPs ...
// GetIPsLast ...
func GetIPsLast(ctx *context.Context, config *config.Config, interval string) (apimailboxes []*api.IP, err error) {
var ips []IP
err = config.Db.Where(fmt.Sprintf("updated >= (now()-'%s'::interval)", interval)).GroupBy("ip").Find(&ips)

View File

@ -52,14 +52,8 @@ func RegisterRoutes(e *echo.Echo, ctx *context.Context, cfg *config.Config) {
ret, err := models.GetIPs(ctx, cfg, limit)
return Result(c, err, ret)
})
// retro-compat
e.GET("/ips/lastday", func(c echo.Context) (err error) {
interval := "1 day"
ret, err := models.GetIPsLast(ctx, cfg, interval)
return Result(c, err, ret)
})
e.GET("/ips/last", func(c echo.Context) (err error) {
interval := "10 minutes"
interval := "30 minutes"
ret, err := models.GetIPsLast(ctx, cfg, interval)
return Result(c, err, ret)
})