Skip to content

Commit

Permalink
feat(movie-1):Implementation of the GetMovies api (#213)
Browse files Browse the repository at this point in the history
* api changes

* implemented a cronjob to save to the db

* implemnted the api

* fixed imdb rating

* regen

* fixed the naming of MovieMsgElement

* fixed naming

* fixed usages of sql instead of the null shortcuts

* Update server/api/tumdev/campus_backend.proto

Co-authored-by: Kordian Bruck <[email protected]>

* fixed the naming of ReleaseYear

* hardcoded the news source

* added the removal of the the TU Film newssource

* Update server/backend/cron/movies.go

Co-authored-by: Kordian Bruck <[email protected]>

* fixed naming things imdb if they should be omdb

* fixed one migration having a longer name

* fixed issues in the rebase

* added context

* extracted the imdb parsing to another function and added a testcase

* replaced anothe instance of null.Int with null.IntFrom

* linting fixes

* rebase

---------

Co-authored-by: Kordian Bruck <[email protected]>
  • Loading branch information
CommanderStorm and kordianbruck authored Sep 22, 2023
1 parent 888c457 commit 91e5d7e
Show file tree
Hide file tree
Showing 19 changed files with 1,060 additions and 506 deletions.
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- APNS_TEAM_ID=${APNS_TEAM_ID}
- APNS_P8_FILE_PATH=${APNS_P8_FILE_PATH}
- MensaCronDisabled=true
- OMDB_API_KEY=${OMDB_API_KEY}
- CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN}
volumes:
- backend-storage:/Storage
Expand Down
808 changes: 403 additions & 405 deletions server/api/tumdev/campus_backend.pb.go

Large diffs are not rendered by default.

32 changes: 16 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.

31 changes: 18 additions & 13 deletions server/api/tumdev/campus_backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ service Campus {
option (google.api.http) = {get: "/studyrooms"};
}

rpc GetKino(GetKinoRequest) returns (GetKinoReply) {
option (google.api.http) = {get: "/kino/{last_id}"};
rpc GetMovies(GetMoviesRequest) returns (GetMoviesReply) {
option (google.api.http) = {get: "/movies/{last_id}"};
}

rpc SendFeedback(SendFeedbackRequest) returns (SendFeedbackReply) {
Expand Down Expand Up @@ -506,30 +506,35 @@ message StudyRoom {
string building_name = 5;
}

message GetKinoRequest {
message GetMoviesRequest {
// the last Id you have requested. Use -1 to get all movies
int32 last_id = 1;
}

message GetKinoReply {
repeated KinoMsgElement kinos = 1;
message GetMoviesReply {
repeated Movie movies = 1;
}

message KinoMsgElement {
string name = 1;
string path = 2;
int32 kino = 3;
message Movie {
string cover_name = 1;
string cover_path = 2;
int64 movie_id = 3;
google.protobuf.Timestamp date = 4;
google.protobuf.Timestamp created = 5;
string title = 6;
string year = 7;
// release year of the movie
string release_year = 7;
string runtime = 8;
string genre = 9;
string director = 10;
string actors = 11;
string rating = 12;
// imdb rating
string imdb_rating = 12;
string description = 13;
int32 cover = 14;
string trailer = 15;
int64 cover_id = 14;
// was previously the trailer
reserved 15;
// Where to find additional information about this movie
string link = 16;
}

Expand Down
81 changes: 41 additions & 40 deletions server/api/tumdev/campus_backend.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,14 @@
]
}
},
"/kino/{lastId}": {
"/members/{lrzId}": {
"get": {
"operationId": "Campus_GetKino",
"operationId": "Campus_GetMembers",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiGetKinoReply"
"$ref": "#/definitions/apiGetMembersReply"
}
},
"default": {
Expand All @@ -660,26 +660,25 @@
},
"parameters": [
{
"name": "lastId",
"name": "lrzId",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
"type": "string"
}
],
"tags": [
"Campus"
]
}
},
"/members/{lrzId}": {
"/movies/{lastId}": {
"get": {
"operationId": "Campus_GetMembers",
"operationId": "Campus_GetMovies",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiGetMembersReply"
"$ref": "#/definitions/apiGetMoviesReply"
}
},
"default": {
Expand All @@ -691,10 +690,12 @@
},
"parameters": [
{
"name": "lrzId",
"name": "lastId",
"description": "the last Id you have requested. Use -1 to get all movies",
"in": "path",
"required": true,
"type": "string"
"type": "integer",
"format": "int32"
}
],
"tags": [
Expand Down Expand Up @@ -1220,18 +1221,6 @@
}
}
},
"apiGetKinoReply": {
"type": "object",
"properties": {
"kinos": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiKinoMsgElement"
}
}
}
},
"apiGetMembersReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1259,6 +1248,18 @@
}
}
},
"apiGetMoviesReply": {
"type": "object",
"properties": {
"movies": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/apiMovie"
}
}
}
},
"apiGetNameTagsReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1434,18 +1435,18 @@
}
}
},
"apiKinoMsgElement": {
"apiMovie": {
"type": "object",
"properties": {
"name": {
"coverName": {
"type": "string"
},
"path": {
"coverPath": {
"type": "string"
},
"kino": {
"type": "integer",
"format": "int32"
"movieId": {
"type": "string",
"format": "int64"
},
"date": {
"type": "string",
Expand All @@ -1458,8 +1459,9 @@
"title": {
"type": "string"
},
"year": {
"type": "string"
"releaseYear": {
"type": "string",
"title": "release year of the movie"
},
"runtime": {
"type": "string"
Expand All @@ -1473,21 +1475,20 @@
"actors": {
"type": "string"
},
"rating": {
"type": "string"
"imdbRating": {
"type": "string",
"title": "imdb rating"
},
"description": {
"type": "string"
},
"cover": {
"type": "integer",
"format": "int32"
},
"trailer": {
"type": "string"
"coverId": {
"type": "string",
"format": "int64"
},
"link": {
"type": "string"
"type": "string",
"title": "Where to find additional information about this movie"
}
}
},
Expand Down
Loading

0 comments on commit 91e5d7e

Please sign in to comment.