Skip to content

Commit 34bc52c

Browse files
feat(url-store): add sorting and fix linting issues
API Enhancements: - Add sortBy and sortOrder query parameters to all listing endpoints - Support sorting by: rank, traffic, url, createdAt, updatedAt - Add rank and traffic fields to add/update operations - Update OpenAPI documentation with new parameters and fields Performance Improvements: - Refactor bulk operations to use Promise.allSettled for parallel processing - Replace sequential for-loops with parallel map operations - Improve response time for bulk add/update/delete operations Code Quality: - Fix all 15 pre-existing linting errors - Remove unused encodeUrlToBase64 function - Eliminate no-continue statements (7 instances) - Eliminate no-await-in-loop violations (7 instances) - Fix trailing spaces and OpenAPI YAML syntax errors - All linting now passing (0 errors)
1 parent 5ee539e commit 34bc52c

File tree

3 files changed

+302
-100
lines changed

3 files changed

+302
-100
lines changed

docs/openapi/schemas.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,16 @@ AuditUrl:
16651665
items:
16661666
type: string
16671667
example: ['accessibility', 'broken-backlinks']
1668+
rank:
1669+
description: Rank or position of the URL (e.g., for sorting high-value pages)
1670+
type: number
1671+
nullable: true
1672+
example: 1
1673+
traffic:
1674+
description: Traffic metric for the URL (e.g., page views, visitors)
1675+
type: number
1676+
nullable: true
1677+
example: 50000
16681678
createdAt:
16691679
description: ISO 8601 timestamp when created
16701680
$ref: '#/DateTime'
@@ -1684,6 +1694,8 @@ AuditUrl:
16841694
url: 'https://example.com/documents/report.pdf'
16851695
source: 'manual'
16861696
audits: ['accessibility', 'broken-backlinks']
1697+
rank: 1
1698+
traffic: 50000
16871699
createdAt: '2025-10-10T12:00:00Z'
16881700
updatedAt: '2025-10-10T15:30:00Z'
16891701
createdBy: 'user-alice'
@@ -1707,10 +1719,22 @@ AuditUrlInput:
17071719
items:
17081720
type: string
17091721
example: ['accessibility', 'broken-backlinks']
1722+
rank:
1723+
description: Rank or position of the URL (optional, for sorting high-value pages)
1724+
type: number
1725+
nullable: true
1726+
example: 1
1727+
traffic:
1728+
description: Traffic metric for the URL (optional, e.g., page views, visitors)
1729+
type: number
1730+
nullable: true
1731+
example: 50000
17101732
example:
17111733
url: 'https://example.com/page1.html'
17121734
source: 'manual'
17131735
audits: ['accessibility', 'broken-backlinks']
1736+
rank: 1
1737+
traffic: 50000
17141738
AuditUrlUpdate:
17151739
type: object
17161740
required:
@@ -1726,9 +1750,21 @@ AuditUrlUpdate:
17261750
items:
17271751
type: string
17281752
example: ['accessibility']
1753+
rank:
1754+
description: Rank or position of the URL (optional, updates if provided)
1755+
type: number
1756+
nullable: true
1757+
example: 2
1758+
traffic:
1759+
description: Traffic metric for the URL (optional, updates if provided)
1760+
type: number
1761+
nullable: true
1762+
example: 75000
17291763
example:
17301764
url: 'https://example.com/page1.html'
17311765
audits: ['accessibility']
1766+
rank: 2
1767+
traffic: 75000
17321768
AuditUrlListResponse:
17331769
type: object
17341770
required:

docs/openapi/url-store-api.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ url-store-list:
1818
schema:
1919
type: string
2020
description: Pagination cursor from previous response
21+
- name: sortBy
22+
in: query
23+
required: false
24+
schema:
25+
type: string
26+
enum: [rank, traffic, url, createdAt, updatedAt]
27+
description: Field to sort by
28+
- name: sortOrder
29+
in: query
30+
required: false
31+
schema:
32+
type: string
33+
enum: [asc, desc]
34+
default: asc
35+
description: Sort order (ascending or descending)
2136
tags:
2237
- site
2338
- url store
@@ -70,6 +85,21 @@ url-store-by-source:
7085
schema:
7186
type: string
7287
description: Pagination cursor from previous response
88+
- name: sortBy
89+
in: query
90+
required: false
91+
schema:
92+
type: string
93+
enum: [rank, traffic, url, createdAt, updatedAt]
94+
description: Field to sort by
95+
- name: sortOrder
96+
in: query
97+
required: false
98+
schema:
99+
type: string
100+
enum: [asc, desc]
101+
default: asc
102+
description: Sort order (ascending or descending)
73103
get:
74104
tags:
75105
- site
@@ -123,6 +153,21 @@ url-store-by-audit:
123153
schema:
124154
type: string
125155
description: Pagination cursor from previous response
156+
- name: sortBy
157+
in: query
158+
required: false
159+
schema:
160+
type: string
161+
enum: [rank, traffic, url, createdAt, updatedAt]
162+
description: Field to sort by
163+
- name: sortOrder
164+
in: query
165+
required: false
166+
schema:
167+
type: string
168+
enum: [asc, desc]
169+
default: asc
170+
description: Sort order (ascending or descending)
126171
get:
127172
tags:
128173
- site

0 commit comments

Comments
 (0)