feat(api): add endpoint to list community prefixes with pagination
Introduced a new GET endpoint `/v1/communities/{id}/prefixes` to retrieve unique prefixes associated with a community, including pagination support via cursor and limit parameters. Updated OpenAPI documentation to reflect this addition. Implemented backend logic in both PostgreSQL and in-memory storage to handle the new functionality, ensuring proper authorization checks and response formatting.
This commit is contained in:
@@ -2922,6 +2922,57 @@ paths:
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/communities/{id}/prefixes:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
- $ref: "#/components/parameters/CommunityId"
|
||||
- $ref: "#/components/parameters/Cursor"
|
||||
- name: limit
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
default: 500
|
||||
maximum: 5000
|
||||
get:
|
||||
tags: [Communities]
|
||||
summary: Префиксы community (latest revision per module)
|
||||
description: |
|
||||
Уникальные materialized-префиксы с данным community_id
|
||||
из последней ревизии каждого модуля tenant.
|
||||
Поле `prefixes` — плоский список для клиентов вроде EvoFirewall.
|
||||
operationId: listCommunityPrefixes
|
||||
responses:
|
||||
"200":
|
||||
description: Успешно.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [items, has_more]
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required: [prefix]
|
||||
properties:
|
||||
prefix:
|
||||
type: string
|
||||
source:
|
||||
type: string
|
||||
prefixes:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
next_cursor:
|
||||
type: ["string", "null"]
|
||||
has_more:
|
||||
type: boolean
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
default:
|
||||
$ref: "#/components/responses/DefaultProblem"
|
||||
|
||||
/v1/communities/{id}:
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TenantId"
|
||||
|
||||
Reference in New Issue
Block a user