Skip to content

Commit a572480

Browse files
feat(url-store): add platformType API endpoints for offsite URLs
Add REST API endpoints to manage and query offsite brand presence URLs (Wikipedia, YouTube, social media, etc.) alongside primary site URLs. New Endpoints: - GET /sites/{siteId}/url-store/by-platform/{platformType} Query URLs by specific platform type with sorting/pagination - GET /sites/{siteId}/url-store/offsite Get all offsite URLs with sorting/pagination Controller Changes: - Add listUrlsByPlatform() endpoint handler - Add listOffsiteUrls() endpoint handler - Update addUrls() to accept and validate platformType - Update updateUrls() to accept and validate platformType - Import PLATFORM_TYPES from data access layer OpenAPI Documentation: - Document new endpoints with full specifications - Add platformType field to all URL schemas - Include sorting parameters (rank, traffic, etc.) - Add platform type enum validation Testing: - Add 13 comprehensive controller tests - Test platform type validation - Test sorting and pagination - Test default value behavior All endpoints support sorting by rank, traffic, url, createdAt, updatedAt with asc/desc ordering and cursor-based pagination. Note: OpenAPI validation warnings for nullable fields are pre-existing and tracked separately.
1 parent 6305de3 commit a572480

File tree

6 files changed

+725
-0
lines changed

6 files changed

+725
-0
lines changed

docs/openapi/api.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ paths:
232232
$ref: './url-store-api.yaml#/url-store-by-source'
233233
/sites/{siteId}/url-store/by-audit/{auditType}:
234234
$ref: './url-store-api.yaml#/url-store-by-audit'
235+
/sites/{siteId}/url-store/by-platform/{platformType}:
236+
$ref: './url-store-api.yaml#/url-store-by-platform'
237+
/sites/{siteId}/url-store/offsite:
238+
$ref: './url-store-api.yaml#/url-store-offsite'
235239
/sites/{siteId}/url-store/{base64Url}:
236240
$ref: './url-store-api.yaml#/url-store-get'
237241
/sites/{siteId}/traffic/paid:

docs/openapi/schemas.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,12 @@ AuditUrl:
16751675
type: number
16761676
nullable: true
16771677
example: 50000
1678+
platformType:
1679+
description: Platform type classification (primary-site, wikipedia, youtube-channel, etc.)
1680+
type: string
1681+
default: primary-site
1682+
enum: [primary-site, wikipedia, youtube-channel, reddit-community, facebook-page, twitter-profile, linkedin-company, instagram-account, tiktok-account, github-org, medium-publication]
1683+
example: primary-site
16781684
createdAt:
16791685
description: ISO 8601 timestamp when created
16801686
$ref: '#/DateTime'
@@ -1696,6 +1702,7 @@ AuditUrl:
16961702
audits: ['accessibility', 'broken-backlinks']
16971703
rank: 1
16981704
traffic: 50000
1705+
platformType: 'primary-site'
16991706
createdAt: '2025-10-10T12:00:00Z'
17001707
updatedAt: '2025-10-10T15:30:00Z'
17011708
createdBy: 'user-alice'
@@ -1729,12 +1736,19 @@ AuditUrlInput:
17291736
type: number
17301737
nullable: true
17311738
example: 50000
1739+
platformType:
1740+
description: Platform type classification (optional, defaults to "primary-site")
1741+
type: string
1742+
default: primary-site
1743+
enum: [primary-site, wikipedia, youtube-channel, reddit-community, facebook-page, twitter-profile, linkedin-company, instagram-account, tiktok-account, github-org, medium-publication]
1744+
example: primary-site
17321745
example:
17331746
url: 'https://example.com/page1.html'
17341747
source: 'manual'
17351748
audits: ['accessibility', 'broken-backlinks']
17361749
rank: 1
17371750
traffic: 50000
1751+
platformType: 'primary-site'
17381752
AuditUrlUpdate:
17391753
type: object
17401754
required:
@@ -1760,11 +1774,17 @@ AuditUrlUpdate:
17601774
type: number
17611775
nullable: true
17621776
example: 75000
1777+
platformType:
1778+
description: Platform type classification (optional, updates if provided)
1779+
type: string
1780+
enum: [primary-site, wikipedia, youtube-channel, reddit-community, facebook-page, twitter-profile, linkedin-company, instagram-account, tiktok-account, github-org, medium-publication]
1781+
example: youtube-channel
17631782
example:
17641783
url: 'https://example.com/page1.html'
17651784
audits: ['accessibility']
17661785
rank: 2
17671786
traffic: 75000
1787+
platformType: 'youtube-channel'
17681788
AuditUrlListResponse:
17691789
type: object
17701790
required:

docs/openapi/url-store-api.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,139 @@ url-store-by-audit:
197197
security:
198198
- api_key: [ ]
199199

200+
url-store-by-platform:
201+
parameters:
202+
- $ref: './parameters.yaml#/siteId'
203+
- name: platformType
204+
in: path
205+
required: true
206+
schema:
207+
type: string
208+
enum: [primary-site, wikipedia, youtube-channel, reddit-community, facebook-page, twitter-profile, linkedin-company, instagram-account, tiktok-account, github-org, medium-publication]
209+
description: Platform type to filter by (e.g., "youtube-channel", "wikipedia")
210+
- name: limit
211+
in: query
212+
required: false
213+
schema:
214+
type: integer
215+
minimum: 1
216+
maximum: 500
217+
default: 100
218+
description: Number of items to return per page
219+
- name: cursor
220+
in: query
221+
required: false
222+
schema:
223+
type: string
224+
description: Pagination cursor from previous response
225+
- name: sortBy
226+
in: query
227+
required: false
228+
schema:
229+
type: string
230+
enum: [rank, traffic, url, createdAt, updatedAt]
231+
description: Field to sort by
232+
- name: sortOrder
233+
in: query
234+
required: false
235+
schema:
236+
type: string
237+
enum: [asc, desc]
238+
default: asc
239+
description: Sort order (ascending or descending)
240+
get:
241+
tags:
242+
- site
243+
- url store
244+
summary: List URLs by platform type
245+
description: |
246+
Retrieves URLs filtered by platform type (e.g., social media platforms, Wikipedia, etc.).
247+
Results are paginated and sortable.
248+
operationId: listUrlsByPlatform
249+
responses:
250+
'200':
251+
description: A paginated list of audit URLs for the specified platform type
252+
content:
253+
application/json:
254+
schema:
255+
$ref: './schemas.yaml#/AuditUrlListResponse'
256+
'400':
257+
$ref: './responses.yaml#/400'
258+
'401':
259+
$ref: './responses.yaml#/401'
260+
'403':
261+
$ref: './responses.yaml#/403'
262+
'404':
263+
$ref: './responses.yaml#/404-site-not-found-with-id'
264+
'500':
265+
$ref: './responses.yaml#/500'
266+
security:
267+
- api_key: [ ]
268+
269+
url-store-offsite:
270+
parameters:
271+
- $ref: './parameters.yaml#/siteId'
272+
get:
273+
parameters:
274+
- name: limit
275+
in: query
276+
required: false
277+
schema:
278+
type: integer
279+
minimum: 1
280+
maximum: 500
281+
default: 100
282+
description: Number of items to return per page
283+
- name: cursor
284+
in: query
285+
required: false
286+
schema:
287+
type: string
288+
description: Pagination cursor from previous response
289+
- name: sortBy
290+
in: query
291+
required: false
292+
schema:
293+
type: string
294+
enum: [rank, traffic, url, createdAt, updatedAt]
295+
description: Field to sort by
296+
- name: sortOrder
297+
in: query
298+
required: false
299+
schema:
300+
type: string
301+
enum: [asc, desc]
302+
default: asc
303+
description: Sort order (ascending or descending)
304+
tags:
305+
- site
306+
- url store
307+
summary: List all offsite platform URLs
308+
description: |
309+
Retrieves all offsite URLs (excludes primary-site URLs).
310+
This includes social media profiles, Wikipedia pages, and other external brand presence URLs.
311+
Results are paginated and sortable.
312+
operationId: listOffsiteUrls
313+
responses:
314+
'200':
315+
description: A paginated list of offsite audit URLs
316+
content:
317+
application/json:
318+
schema:
319+
$ref: './schemas.yaml#/AuditUrlListResponse'
320+
'400':
321+
$ref: './responses.yaml#/400'
322+
'401':
323+
$ref: './responses.yaml#/401'
324+
'403':
325+
$ref: './responses.yaml#/403'
326+
'404':
327+
$ref: './responses.yaml#/404-site-not-found-with-id'
328+
'500':
329+
$ref: './responses.yaml#/500'
330+
security:
331+
- api_key: [ ]
332+
200333
url-store-get:
201334
parameters:
202335
- $ref: './parameters.yaml#/siteId'

0 commit comments

Comments
 (0)