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:News alerts #219

Merged
merged 16 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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,087 changes: 1,083 additions & 1,004 deletions server/api/tumdev/campus_backend.pb.go

Large diffs are not rendered by default.

59 changes: 43 additions & 16 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.

19 changes: 15 additions & 4 deletions server/api/tumdev/campus_backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ option java_outer_classname = "CampusApiProto";
option java_package = "app.tum.campus.api";

service Campus {
rpc GetTopNews(GetTopNewsRequest) returns (GetTopNewsReply) {
option (google.api.http) = {get: "/news/top"};
rpc GetNewsAlerts(GetNewsAlertsRequest) returns (GetNewsAlertsReply) {
option (google.api.http) = {
get: "/news/alerts"
response_body: "alerts"
};
}

rpc GetNewsSources(GetNewsSourcesRequest) returns (GetNewsSourcesReply) {
Expand Down Expand Up @@ -264,8 +267,16 @@ message NewsSource {
string icon = 3;
}

message GetTopNewsRequest {}
message GetTopNewsReply {
message GetNewsAlertsRequest {
// the last id of the news item received. 0 to get all news items
int32 last_news_alert_id = 1;
}

message GetNewsAlertsReply {
repeated NewsAlert alerts = 1;
}

message NewsAlert {
string image_url = 1;
string link = 2;
google.protobuf.Timestamp created = 3;
Expand Down
86 changes: 56 additions & 30 deletions server/api/tumdev/campus_backend.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,17 +703,17 @@
]
}
},
"/news/sources": {
"/news/alerts": {
"get": {
"operationId": "Campus_GetNewsSources",
"operationId": "Campus_GetNewsAlerts",
"responses": {
"200": {
"description": "",
"schema": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsSource"
"$ref": "#/definitions/apiNewsAlert"
}
}
},
Expand All @@ -724,19 +724,33 @@
}
}
},
"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/top": {
"/news/sources": {
"get": {
"operationId": "Campus_GetTopNews",
"operationId": "Campus_GetNewsSources",
"responses": {
"200": {
"description": "A successful response.",
"description": "",
"schema": {
"$ref": "#/definitions/apiGetTopNewsReply"
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsSource"
}
}
},
"default": {
Expand Down Expand Up @@ -1272,6 +1286,18 @@
}
}
},
"apiGetNewsAlertsReply": {
"type": "object",
"properties": {
"alerts": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiNewsAlert"
}
}
}
},
"apiGetNewsReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1362,29 +1388,6 @@
}
}
},
"apiGetTopNewsReply": {
"type": "object",
"properties": {
"imageUrl": {
"type": "string"
},
"link": {
"type": "string"
},
"created": {
"type": "string",
"format": "date-time"
},
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
}
},
"apiGetUpdateNoteReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1594,6 +1597,29 @@
}
}
},
"apiNewsAlert": {
"type": "object",
"properties": {
"imageUrl": {
"type": "string"
},
"link": {
"type": "string"
},
"created": {
"type": "string",
"format": "date-time"
},
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
}
}
},
"apiNewsSource": {
"type": "object",
"properties": {
Expand Down
Loading
Loading