Skip to content

Commit

Permalink
Enhance functionality and fix some issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadhamzh committed Jan 9, 2025
1 parent 0fdb818 commit 17ca387
Show file tree
Hide file tree
Showing 23 changed files with 600 additions and 78 deletions.
44 changes: 42 additions & 2 deletions modules/api/cmd/kubermatic-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,38 @@
}
}
},
"/api/v1/me/readannouncements": {
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Updates read announcements of the current user.",
"operationId": "patchCurrentUserReadAnnouncements",
"responses": {
"200": {
"description": "User",
"schema": {
"$ref": "#/definitions/User"
}
},
"401": {
"$ref": "#/responses/empty"
},
"default": {
"description": "errorResponse",
"schema": {
"$ref": "#/definitions/errorResponse"
}
}
}
}
},
"/api/v1/me/settings": {
"get": {
"produces": [
Expand Down Expand Up @@ -1504,9 +1536,9 @@
],
"responses": {
"200": {
"description": "UserSettings",
"description": "User",
"schema": {
"$ref": "#/definitions/UserSettings"
"$ref": "#/definitions/User"
}
},
"401": {
Expand Down Expand Up @@ -39564,6 +39596,14 @@
},
"x-go-name": "Projects"
},
"readAnnouncements": {
"description": "ReadAnnouncements holds the IDs of admin announcements that the user has read.\n+optional",
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "ReadAnnouncements"
},
"userSettings": {
"$ref": "#/definitions/UserSettings"
}
Expand Down
6 changes: 3 additions & 3 deletions modules/api/pkg/handler/routes_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ func (r Routing) getCurrentUserSettings() http.Handler {
//
// Responses:
// default: errorResponse
// 200: UserSettings
// 200: User
// 401: empty
func (r Routing) patchCurrentUserSettings() http.Handler {
return httptransport.NewServer(
Expand All @@ -1648,7 +1648,7 @@ func (r Routing) patchCurrentUserSettings() http.Handler {
)
}

// swagger:route PATCH /api/v1/me/readannouncements readannouncements patchCurrentUserReadAnnouncements
// swagger:route PATCH /api/v1/me/readannouncements users patchCurrentUserReadAnnouncements
//
// Updates read announcements of the current user.
//
Expand All @@ -1660,7 +1660,7 @@ func (r Routing) patchCurrentUserSettings() http.Handler {
//
// Responses:
// default: errorResponse
// 200: []string
// 200: User
// 401: empty
func (r Routing) patchCurrentUserReadAnnouncements() http.Handler {
return httptransport.NewServer(
Expand Down
4 changes: 1 addition & 3 deletions modules/api/pkg/handler/v1/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,7 @@ func PatchReadAnnouncementsEndpoint(userProvider provider.UserProvider) endpoint
if err != nil {
return nil, common.KubernetesErrorToHTTPError(err)
}

return updatedUser.Spec.ReadAnnouncements, nil

}
}

Expand Down Expand Up @@ -579,7 +577,7 @@ type PatchSettingsReq struct {
}

// PatchReadAnnouncementsReq defines HTTP request for patchCurrentUserReadAnnouncements
// swagger:parameters patchCurrentUserReadAnnouncements
// swagger:parameters readAnnouncements
type PatchReadAnnouncementsReq struct {
// in: body
Body []string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2024 The Kubermatic Kubernetes Platform contributors.
Copyright 2025 The Kubermatic Kubernetes Platform contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 17ca387

Please sign in to comment.