feat: retrieve asn owner
This commit is contained in:
@ -6,12 +6,14 @@ class AsnResult
|
||||
|
||||
property id : Int64?
|
||||
property country : String?
|
||||
# TODO: Deprecate?
|
||||
property description : String?
|
||||
property owner_id : Int64?
|
||||
property blocked : Bool?
|
||||
end
|
||||
|
||||
class ASN
|
||||
QUERY = "select id, country, description from asn where ? between range_start and range_end limit 1;"
|
||||
QUERY = "select asns.id, country, owners.description, owner_id from asns left join owners on owners.id = asns.owner_id where ? between range_start and range_end limit 1;"
|
||||
STATUS = "select blocked from status where id = ? limit 1;"
|
||||
|
||||
property db : DB::Database
|
||||
|
||||
@ -16,6 +16,7 @@ Log.setup_from_env
|
||||
VERSION = "0.2.0"
|
||||
ASN_ID = "id"
|
||||
ASN_DESCRIPTION = "description"
|
||||
ASN_OWNER_ID = "owner_id"
|
||||
ASN_COUNTRY = "country"
|
||||
ASN_BLOCKED = "blocked"
|
||||
|
||||
@ -70,6 +71,7 @@ RedisServer.new(interface, port) do |client, _, key|
|
||||
response =
|
||||
case field
|
||||
when ASN_ID then result.try(&.id).try(&.to_s)
|
||||
when ASN_OWNER_ID then result.try(&.owner_id).try(&.to_s)
|
||||
when ASN_COUNTRY then result.try(&.country)
|
||||
when ASN_DESCRIPTION then result.try(&.description)
|
||||
when ASN_BLOCKED then
|
||||
|
||||
Reference in New Issue
Block a user