Skip to content

Commit

Permalink
feat:GetNews (#227)
Browse files Browse the repository at this point in the history
* simplified the saving of images
* updated the generated files

Co-authored-by: Kordian Bruck <[email protected]>
  • Loading branch information
CommanderStorm and kordianbruck authored Sep 18, 2023
1 parent d991966 commit 5ac6fe8
Show file tree
Hide file tree
Showing 9 changed files with 1,716 additions and 1,067 deletions.
2,326 changes: 1,297 additions & 1,029 deletions server/api/tumdev/campus_backend.pb.go

Large diffs are not rendered by default.

130 changes: 130 additions & 0 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.

28 changes: 28 additions & 0 deletions server/api/tumdev/campus_backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ service Campus {
};
}

rpc GetNews (GetNewsRequest) returns (GetNewsReply) {
option (google.api.http) = {
get: "/news/{last_news_id}",
response_body: "news"
};
}

rpc SearchRooms (SearchRoomsRequest) returns (SearchRoomsReply) {
option (google.api.http) = {
post: "/roomfinder/room/search",
Expand Down Expand Up @@ -376,6 +383,27 @@ message Room {
string name = 9;
}

message NewsItem{
int32 id = 1;
string title = 2;
string text = 3;
string link = 4;
string image_url = 5;
string source = 6;
google.protobuf.Timestamp created = 7;
}

message GetNewsReply {
repeated NewsItem news = 1;
}

message GetNewsRequest {
// the last id of the news item received. 0 to get all news items
int32 last_news_id = 1;
// filter by news source id. 0 to get all news items
int32 news_source = 2;
}

message NewsSourceReply {
repeated NewsSource sources = 1;
}
Expand Down
84 changes: 84 additions & 0 deletions server/api/tumdev/campus_backend.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,50 @@
]
}
},
"/news/{lastNewsId}": {
"get": {
"operationId": "Campus_GetNews",
"responses": {
"200": {
"description": "",
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsItem"
}
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"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"
}
],
"tags": [
"Campus"
]
}
},
"/notifications/confirm/{notificationId}": {
"get": {
"operationId": "Campus_GetNotificationConfirm",
Expand Down Expand Up @@ -1555,6 +1599,18 @@
}
}
},
"apiGetNewsReply": {
"type": "object",
"properties": {
"news": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsItem"
}
}
}
},
"apiGetNotificationsConfirmReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1914,6 +1970,34 @@
}
}
},
"apiNewsItem": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string"
},
"text": {
"type": "string"
},
"link": {
"type": "string"
},
"imageUrl": {
"type": "string"
},
"source": {
"type": "string"
},
"created": {
"type": "string",
"format": "date-time"
}
}
},
"apiNewsSource": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 5ac6fe8

Please sign in to comment.