Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sort options in runs and projects list api #1381

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: add sort options in runs and projects list api
  • Loading branch information
ffforest committed Jan 15, 2025
commit 4920c3c98b6e66377850c7627ceea8421060247f
36 changes: 32 additions & 4 deletions api/openapispec/docs.go
Original file line number Diff line number Diff line change
@@ -1046,6 +1046,18 @@ const docTemplate = `{
"description": "The size of the page. Default to 10",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"description": "Which field to sort the list by. Default to id",
"name": "sortBy",
"in": "query"
},
{
"type": "boolean",
"description": "Whether to sort the list in ascending order. Default to false",
"name": "ascending",
"in": "query"
}
],
"responses": {
@@ -1649,6 +1661,18 @@ const docTemplate = `{
"description": "The size of the page. Default to 10",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"description": "Which field to sort the list by. Default to id",
"name": "sortBy",
"in": "query"
},
{
"type": "boolean",
"description": "Whether to sort the list in ascending order. Default to false",
"name": "ascending",
"in": "query"
}
],
"responses": {
@@ -3866,18 +3890,18 @@ const docTemplate = `{
"constant.SourceProviderType": {
"type": "string",
"enum": [
"git",
"git",
"github",
"oci",
"local"
"local",
"git"
],
"x-enum-varnames": [
"DefaultSourceType",
"SourceProviderTypeGit",
"SourceProviderTypeGithub",
"SourceProviderTypeOCI",
"SourceProviderTypeLocal"
"SourceProviderTypeLocal",
"DefaultSourceType"
]
},
"constant.StackState": {
@@ -4277,6 +4301,10 @@ const docTemplate = `{
"description": "ResourceType is the type of the resource.",
"type": "string"
},
"resourceURN": {
"description": "ResourceURN is the urn of the resource.",
"type": "string"
},
"status": {
"description": "Status is the status of the resource.",
"type": "string"
36 changes: 32 additions & 4 deletions api/openapispec/swagger.json
Original file line number Diff line number Diff line change
@@ -1035,6 +1035,18 @@
"description": "The size of the page. Default to 10",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"description": "Which field to sort the list by. Default to id",
"name": "sortBy",
"in": "query"
},
{
"type": "boolean",
"description": "Whether to sort the list in ascending order. Default to false",
"name": "ascending",
"in": "query"
}
],
"responses": {
@@ -1638,6 +1650,18 @@
"description": "The size of the page. Default to 10",
"name": "pageSize",
"in": "query"
},
{
"type": "string",
"description": "Which field to sort the list by. Default to id",
"name": "sortBy",
"in": "query"
},
{
"type": "boolean",
"description": "Whether to sort the list in ascending order. Default to false",
"name": "ascending",
"in": "query"
}
],
"responses": {
@@ -3855,18 +3879,18 @@
"constant.SourceProviderType": {
"type": "string",
"enum": [
"git",
"git",
"github",
"oci",
"local"
"local",
"git"
],
"x-enum-varnames": [
"DefaultSourceType",
"SourceProviderTypeGit",
"SourceProviderTypeGithub",
"SourceProviderTypeOCI",
"SourceProviderTypeLocal"
"SourceProviderTypeLocal",
"DefaultSourceType"
]
},
"constant.StackState": {
@@ -4266,6 +4290,10 @@
"description": "ResourceType is the type of the resource.",
"type": "string"
},
"resourceURN": {
"description": "ResourceURN is the urn of the resource.",
"type": "string"
},
"status": {
"description": "Status is the status of the resource.",
"type": "string"
23 changes: 21 additions & 2 deletions api/openapispec/swagger.yaml
Original file line number Diff line number Diff line change
@@ -30,17 +30,17 @@ definitions:
constant.SourceProviderType:
enum:
- git
- git
- github
- oci
- local
- git
type: string
x-enum-varnames:
- DefaultSourceType
- SourceProviderTypeGit
- SourceProviderTypeGithub
- SourceProviderTypeOCI
- SourceProviderTypeLocal
- DefaultSourceType
constant.StackState:
enum:
- UnSynced
@@ -325,6 +325,9 @@ definitions:
resourceType:
description: ResourceType is the type of the resource.
type: string
resourceURN:
description: ResourceURN is the urn of the resource.
type: string
status:
description: Status is the status of the resource.
type: string
@@ -2086,6 +2089,14 @@ paths:
in: query
name: pageSize
type: integer
- description: Which field to sort the list by. Default to id
in: query
name: sortBy
type: string
- description: Whether to sort the list in ascending order. Default to false
in: query
name: ascending
type: boolean
produces:
- application/json
responses:
@@ -2478,6 +2489,14 @@ paths:
in: query
name: pageSize
type: integer
- description: Which field to sort the list by. Default to id
in: query
name: sortBy
type: string
- description: Whether to sort the list in ascending order. Default to false
in: query
name: ascending
type: boolean
produces:
- application/json
responses:
4 changes: 2 additions & 2 deletions pkg/server/handler/module/handler.go
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ func (h *Handler) DeleteModule() http.HandlerFunc {
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/modules/{moduleName} [put]
// @Router /api/v1/modules/{moduleName} [put]
func (h *Handler) UpdateModule() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
@@ -139,7 +139,7 @@ func (h *Handler) UpdateModule() http.HandlerFunc {
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/modules/{moduleName} [get]
// @Router /api/v1/modules/{moduleName} [get]
func (h *Handler) GetModule() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
2 changes: 2 additions & 0 deletions pkg/server/handler/project/handler.go
Original file line number Diff line number Diff line change
@@ -174,6 +174,8 @@ func (h *Handler) GetProject() http.HandlerFunc {
// @Param fuzzyName query string false "Fuzzy match project name to filter project list by."
// @Param page query uint false "The current page to fetch. Default to 1"
// @Param pageSize query uint false "The size of the page. Default to 10"
// @Param sortBy query string false "Which field to sort the list by. Default to id"
// @Param ascending query bool false "Whether to sort the list in ascending order. Default to false"
// @Success 200 {object} handler.Response{data=[]response.PaginatedProjectResponse} "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
2 changes: 2 additions & 0 deletions pkg/server/handler/stack/run.go
Original file line number Diff line number Diff line change
@@ -86,6 +86,8 @@ func (h *Handler) GetRunResult() http.HandlerFunc {
// @Param endTime query string false "EndTime to filter runs by. Default to all. Format: RFC3339"
// @Param page query uint false "The current page to fetch. Default to 1"
// @Param pageSize query uint false "The size of the page. Default to 10"
// @Param sortBy query string false "Which field to sort the list by. Default to id"
// @Param ascending query bool false "Whether to sort the list in ascending order. Default to false"
// @Success 200 {object} handler.Response{data=response.PaginatedRunResponse} "Success"
// @Failure 400 {object} error "Bad Request"
// @Failure 401 {object} error "Unauthorized"
2 changes: 1 addition & 1 deletion pkg/server/handler/workspace/configs.go
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ func (h *Handler) UpdateWorkspaceConfigs() http.HandlerFunc {
// @Failure 429 {object} error "Too Many Requests"
// @Failure 404 {object} error "Not Found"
// @Failure 500 {object} error "Internal Server Error"
// @Router /api/v1/workspaces/{workspaceID}/configs/mod-deps [post]
// @Router /api/v1/workspaces/{workspaceID}/configs/mod-deps [post]
func (h *Handler) CreateWorkspaceModDeps() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Getting stuff from context.
Loading