refactor: update AS entry handling in API and database to support ASN-only entries. Remove prefix field from AS entry structure and adjust related functions and tests. Enhance OpenAPI specifications and documentation to reflect changes in AS entry representation.

This commit is contained in:
Denozordec
2026-04-05 22:38:17 +07:00
parent 73d0003281
commit 1db6b5b7b2
19 changed files with 218 additions and 115 deletions
+1 -11
View File
@@ -231,17 +231,7 @@ func (s *Server) handleListAS(w http.ResponseWriter, r *http.Request) {
}
func asEntryJSON(x *store.ASEntry) map[string]any {
m := map[string]any{"id": x.ID}
if x.ASN != nil {
m["asn"] = *x.ASN
} else {
m["asn"] = nil
}
if x.Prefix != nil {
m["prefix"] = *x.Prefix
} else {
m["prefix"] = nil
}
m := map[string]any{"id": x.ID, "asn": x.ASN}
if x.CommunityID != nil {
m["community_id"] = *x.CommunityID
} else {