Skip to content

Commit

Permalink
modified the ListNews REST API to not swallow other APIs
Browse files Browse the repository at this point in the history
Resolves #264
  • Loading branch information
CommanderStorm committed Oct 16, 2023
1 parent 371ed3f commit 50e9844
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 259 deletions.
367 changes: 183 additions & 184 deletions server/api/tumdev/campus_backend.pb.go

Large diffs are not rendered by default.

42 changes: 4 additions & 38 deletions server/api/tumdev/campus_backend.pb.gw.go

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

2 changes: 1 addition & 1 deletion server/api/tumdev/campus_backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ service Campus {

rpc ListNews(ListNewsRequest) returns (ListNewsReply) {
option (google.api.http) = {
get: "/news/{last_news_id}",
get: "/news",
response_body: "news"
};
}
Expand Down
72 changes: 36 additions & 36 deletions server/api/tumdev/campus_backend.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,17 +680,17 @@
]
}
},
"/news/alerts": {
"/news": {
"get": {
"operationId": "Campus_ListNewsAlerts",
"operationId": "Campus_ListNews",
"responses": {
"200": {
"description": "",
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsAlert"
"$ref": "#/definitions/apiNews"
}
}
},
Expand All @@ -703,30 +703,46 @@
},
"parameters": [
{
"name": "lastNewsAlertId",
"name": "lastNewsId",
"description": "the last id of the news item received. 0 to get all news items",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "newsSource",
"description": "filter by news source id. 0 to get all news items",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "oldestDateAt",
"description": "the oldest time you want to be included in the response",
"in": "query",
"required": false,
"type": "string",
"format": "date-time"
}
],
"tags": [
"Campus"
]
}
},
"/news/sources": {
"/news/alerts": {
"get": {
"operationId": "Campus_ListNewsSources",
"operationId": "Campus_ListNewsAlerts",
"responses": {
"200": {
"description": "",
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsSource"
"$ref": "#/definitions/apiNewsAlert"
}
}
},
Expand All @@ -737,22 +753,32 @@
}
}
},
"parameters": [
{
"name": "lastNewsAlertId",
"description": "the last id of the news item received. 0 to get all news items",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
}
],
"tags": [
"Campus"
]
}
},
"/news/{lastNewsId}": {
"/news/sources": {
"get": {
"operationId": "Campus_ListNews",
"operationId": "Campus_ListNewsSources",
"responses": {
"200": {
"description": "",
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNews"
"$ref": "#/definitions/apiNewsSource"
}
}
},
Expand All @@ -763,32 +789,6 @@
}
}
},
"parameters": [
{
"name": "lastNewsId",
"description": "the last id of the news item received. 0 to get all news items",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "newsSource",
"description": "filter by news source id. 0 to get all news items",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "oldestDateAt",
"description": "the oldest time you want to be included in the response",
"in": "query",
"required": false,
"type": "string",
"format": "date-time"
}
],
"tags": [
"Campus"
]
Expand Down
1 change: 1 addition & 0 deletions server/backend/movie.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package backend

import (
"context"

pb "github.com/TUM-Dev/Campus-Backend/server/api/tumdev"
"github.com/TUM-Dev/Campus-Backend/server/model"
log "github.com/sirupsen/logrus"
Expand Down
1 change: 1 addition & 0 deletions server/backend/rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package backend
import (
"context"
"errors"

pb "github.com/TUM-Dev/Campus-Backend/server/api/tumdev"
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/apns"
"github.com/TUM-Dev/Campus-Backend/server/model"
Expand Down

0 comments on commit 50e9844

Please sign in to comment.