Skip to content

Commit da89ea5

Browse files
authored
feat: add sortOptions in list APIs (#1393)
1 parent 20e1052 commit da89ea5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+644
-104
lines changed

api/openapispec/docs.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ const docTemplate = `{
3838
"description": "The size of the page. Default to 10",
3939
"name": "pageSize",
4040
"in": "query"
41+
},
42+
{
43+
"type": "string",
44+
"description": "Which field to sort the list by. Default to id",
45+
"name": "sortBy",
46+
"in": "query"
47+
},
48+
{
49+
"type": "boolean",
50+
"description": "Whether to sort the list in ascending order. Default to false",
51+
"name": "ascending",
52+
"in": "query"
4153
}
4254
],
4355
"responses": {
@@ -376,6 +388,18 @@ const docTemplate = `{
376388
"description": "The size of the page. Default to 10",
377389
"name": "pageSize",
378390
"in": "query"
391+
},
392+
{
393+
"type": "string",
394+
"description": "Which field to sort the list by. Default to id",
395+
"name": "sortBy",
396+
"in": "query"
397+
},
398+
{
399+
"type": "boolean",
400+
"description": "Whether to sort the list in ascending order. Default to false",
401+
"name": "ascending",
402+
"in": "query"
379403
}
380404
],
381405
"responses": {
@@ -702,6 +726,18 @@ const docTemplate = `{
702726
"description": "The size of the page. Default to 10",
703727
"name": "pageSize",
704728
"in": "query"
729+
},
730+
{
731+
"type": "string",
732+
"description": "Which field to sort the list by. Default to id",
733+
"name": "sortBy",
734+
"in": "query"
735+
},
736+
{
737+
"type": "boolean",
738+
"description": "Whether to sort the list in ascending order. Default to false",
739+
"name": "ascending",
740+
"in": "query"
705741
}
706742
],
707743
"responses": {
@@ -1417,6 +1453,18 @@ const docTemplate = `{
14171453
"description": "The size of the page. Default to 10",
14181454
"name": "pageSize",
14191455
"in": "query"
1456+
},
1457+
{
1458+
"type": "string",
1459+
"description": "Which field to sort the list by. Default to id",
1460+
"name": "sortBy",
1461+
"in": "query"
1462+
},
1463+
{
1464+
"type": "boolean",
1465+
"description": "Whether to sort the list in ascending order. Default to false",
1466+
"name": "ascending",
1467+
"in": "query"
14201468
}
14211469
],
14221470
"responses": {
@@ -1870,6 +1918,18 @@ const docTemplate = `{
18701918
"description": "The size of the page. Default to 10",
18711919
"name": "pageSize",
18721920
"in": "query"
1921+
},
1922+
{
1923+
"type": "string",
1924+
"description": "Which field to sort the list by. Default to id",
1925+
"name": "sortBy",
1926+
"in": "query"
1927+
},
1928+
{
1929+
"type": "boolean",
1930+
"description": "Whether to sort the list in ascending order. Default to false",
1931+
"name": "ascending",
1932+
"in": "query"
18731933
}
18741934
],
18751935
"responses": {
@@ -2220,6 +2280,18 @@ const docTemplate = `{
22202280
"description": "The size of the page. Default to 10",
22212281
"name": "pageSize",
22222282
"in": "query"
2283+
},
2284+
{
2285+
"type": "string",
2286+
"description": "Which field to sort the list by. Default to id",
2287+
"name": "sortBy",
2288+
"in": "query"
2289+
},
2290+
{
2291+
"type": "boolean",
2292+
"description": "Whether to sort the list in ascending order. Default to false",
2293+
"name": "ascending",
2294+
"in": "query"
22232295
}
22242296
],
22252297
"responses": {
@@ -3304,6 +3376,18 @@ const docTemplate = `{
33043376
"description": "The size of the page. Default to 10",
33053377
"name": "pageSize",
33063378
"in": "query"
3379+
},
3380+
{
3381+
"type": "string",
3382+
"description": "Which field to sort the list by. Default to id",
3383+
"name": "sortBy",
3384+
"in": "query"
3385+
},
3386+
{
3387+
"type": "boolean",
3388+
"description": "Whether to sort the list in ascending order. Default to false",
3389+
"name": "ascending",
3390+
"in": "query"
33073391
}
33083392
],
33093393
"responses": {

api/openapispec/swagger.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
"description": "The size of the page. Default to 10",
2828
"name": "pageSize",
2929
"in": "query"
30+
},
31+
{
32+
"type": "string",
33+
"description": "Which field to sort the list by. Default to id",
34+
"name": "sortBy",
35+
"in": "query"
36+
},
37+
{
38+
"type": "boolean",
39+
"description": "Whether to sort the list in ascending order. Default to false",
40+
"name": "ascending",
41+
"in": "query"
3042
}
3143
],
3244
"responses": {
@@ -365,6 +377,18 @@
365377
"description": "The size of the page. Default to 10",
366378
"name": "pageSize",
367379
"in": "query"
380+
},
381+
{
382+
"type": "string",
383+
"description": "Which field to sort the list by. Default to id",
384+
"name": "sortBy",
385+
"in": "query"
386+
},
387+
{
388+
"type": "boolean",
389+
"description": "Whether to sort the list in ascending order. Default to false",
390+
"name": "ascending",
391+
"in": "query"
368392
}
369393
],
370394
"responses": {
@@ -691,6 +715,18 @@
691715
"description": "The size of the page. Default to 10",
692716
"name": "pageSize",
693717
"in": "query"
718+
},
719+
{
720+
"type": "string",
721+
"description": "Which field to sort the list by. Default to id",
722+
"name": "sortBy",
723+
"in": "query"
724+
},
725+
{
726+
"type": "boolean",
727+
"description": "Whether to sort the list in ascending order. Default to false",
728+
"name": "ascending",
729+
"in": "query"
694730
}
695731
],
696732
"responses": {
@@ -1406,6 +1442,18 @@
14061442
"description": "The size of the page. Default to 10",
14071443
"name": "pageSize",
14081444
"in": "query"
1445+
},
1446+
{
1447+
"type": "string",
1448+
"description": "Which field to sort the list by. Default to id",
1449+
"name": "sortBy",
1450+
"in": "query"
1451+
},
1452+
{
1453+
"type": "boolean",
1454+
"description": "Whether to sort the list in ascending order. Default to false",
1455+
"name": "ascending",
1456+
"in": "query"
14091457
}
14101458
],
14111459
"responses": {
@@ -1859,6 +1907,18 @@
18591907
"description": "The size of the page. Default to 10",
18601908
"name": "pageSize",
18611909
"in": "query"
1910+
},
1911+
{
1912+
"type": "string",
1913+
"description": "Which field to sort the list by. Default to id",
1914+
"name": "sortBy",
1915+
"in": "query"
1916+
},
1917+
{
1918+
"type": "boolean",
1919+
"description": "Whether to sort the list in ascending order. Default to false",
1920+
"name": "ascending",
1921+
"in": "query"
18621922
}
18631923
],
18641924
"responses": {
@@ -2209,6 +2269,18 @@
22092269
"description": "The size of the page. Default to 10",
22102270
"name": "pageSize",
22112271
"in": "query"
2272+
},
2273+
{
2274+
"type": "string",
2275+
"description": "Which field to sort the list by. Default to id",
2276+
"name": "sortBy",
2277+
"in": "query"
2278+
},
2279+
{
2280+
"type": "boolean",
2281+
"description": "Whether to sort the list in ascending order. Default to false",
2282+
"name": "ascending",
2283+
"in": "query"
22122284
}
22132285
],
22142286
"responses": {
@@ -3293,6 +3365,18 @@
32933365
"description": "The size of the page. Default to 10",
32943366
"name": "pageSize",
32953367
"in": "query"
3368+
},
3369+
{
3370+
"type": "string",
3371+
"description": "Which field to sort the list by. Default to id",
3372+
"name": "sortBy",
3373+
"in": "query"
3374+
},
3375+
{
3376+
"type": "boolean",
3377+
"description": "Whether to sort the list in ascending order. Default to false",
3378+
"name": "ascending",
3379+
"in": "query"
32963380
}
32973381
],
32983382
"responses": {

api/openapispec/swagger.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,14 @@ paths:
14351435
in: query
14361436
name: pageSize
14371437
type: integer
1438+
- description: Which field to sort the list by. Default to id
1439+
in: query
1440+
name: sortBy
1441+
type: string
1442+
- description: Whether to sort the list in ascending order. Default to false
1443+
in: query
1444+
name: ascending
1445+
type: boolean
14381446
produces:
14391447
- application/json
14401448
responses:
@@ -1654,6 +1662,14 @@ paths:
16541662
in: query
16551663
name: pageSize
16561664
type: integer
1665+
- description: Which field to sort the list by. Default to id
1666+
in: query
1667+
name: sortBy
1668+
type: string
1669+
- description: Whether to sort the list in ascending order. Default to false
1670+
in: query
1671+
name: ascending
1672+
type: boolean
16571673
produces:
16581674
- application/json
16591675
responses:
@@ -1865,6 +1881,14 @@ paths:
18651881
in: query
18661882
name: pageSize
18671883
type: integer
1884+
- description: Which field to sort the list by. Default to id
1885+
in: query
1886+
name: sortBy
1887+
type: string
1888+
- description: Whether to sort the list in ascending order. Default to false
1889+
in: query
1890+
name: ascending
1891+
type: boolean
18681892
produces:
18691893
- application/json
18701894
responses:
@@ -2330,6 +2354,14 @@ paths:
23302354
in: query
23312355
name: pageSize
23322356
type: integer
2357+
- description: Which field to sort the list by. Default to id
2358+
in: query
2359+
name: sortBy
2360+
type: string
2361+
- description: Whether to sort the list in ascending order. Default to false
2362+
in: query
2363+
name: ascending
2364+
type: boolean
23332365
produces:
23342366
- application/json
23352367
responses:
@@ -2624,6 +2656,14 @@ paths:
26242656
in: query
26252657
name: pageSize
26262658
type: integer
2659+
- description: Which field to sort the list by. Default to id
2660+
in: query
2661+
name: sortBy
2662+
type: string
2663+
- description: Whether to sort the list in ascending order. Default to false
2664+
in: query
2665+
name: ascending
2666+
type: boolean
26272667
produces:
26282668
- application/json
26292669
responses:
@@ -2851,6 +2891,14 @@ paths:
28512891
in: query
28522892
name: pageSize
28532893
type: integer
2894+
- description: Which field to sort the list by. Default to id
2895+
in: query
2896+
name: sortBy
2897+
type: string
2898+
- description: Whether to sort the list in ascending order. Default to false
2899+
in: query
2900+
name: ascending
2901+
type: boolean
28542902
produces:
28552903
- application/json
28562904
responses:
@@ -3571,6 +3619,14 @@ paths:
35713619
in: query
35723620
name: pageSize
35733621
type: integer
3622+
- description: Which field to sort the list by. Default to id
3623+
in: query
3624+
name: sortBy
3625+
type: string
3626+
- description: Whether to sort the list in ascending order. Default to false
3627+
in: query
3628+
name: ascending
3629+
type: boolean
35743630
produces:
35753631
- application/json
35763632
responses:

pkg/domain/constant/global.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const (
3131
SortByModifiedTimestamp = "modifiedTimestamp"
3232
SortByName = "name"
3333
SortByID = "id"
34+
SortByResourceName = "resourceName"
35+
SortByResourceURN = "resourceURN"
3436
)
3537

3638
var (

0 commit comments

Comments
 (0)