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:GetNews #227

Merged
merged 16 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
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
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