added groupby to http://host/ip/last endpoint
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c759df10d0
commit
ea09905151
@ -27,7 +27,7 @@ func GetIPs(ctx *context.Context, config *config.Config, limit int) (apimailboxe
|
||||
// GetIPs ...
|
||||
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)).Asc("id").Find(&ips)
|
||||
err = config.Db.Where(fmt.Sprintf("updated >= (now()-'%s'::interval)", interval)).GroupBy("ip").Find(&ips)
|
||||
for _, ml := range ips {
|
||||
apimailboxes = append(apimailboxes, ml.APIFormat())
|
||||
}
|
||||
@ -120,7 +120,6 @@ func (ip *IP) APIFormat() *api.IP {
|
||||
return nil
|
||||
}
|
||||
return &api.IP{
|
||||
ID: ip.ID,
|
||||
IP: ip.IP,
|
||||
Rdns: ip.Rdns.String,
|
||||
Src: ip.Src,
|
||||
|
Loading…
Reference in New Issue
Block a user