Skip to content

Commit

Permalink
fixed issues in the rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Sep 19, 2023
1 parent 0babcbd commit 4c91ba2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions server/api/tumdev/campus_backend.pb.go

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

4 changes: 2 additions & 2 deletions server/api/tumdev/campus_backend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ message GetMoviesReply {
message Movie {
string cover_name = 1;
string cover_path = 2;
int32 movie_id = 3;
int64 movie_id = 3;
google.protobuf.Timestamp date = 4;
google.protobuf.Timestamp created = 5;
string title = 6;
Expand All @@ -530,7 +530,7 @@ message Movie {
// imdb rating
string imdb_rating = 12;
string description = 13;
int32 cover_id = 14;
int64 cover_id = 14;
// was previously the trailer
reserved 15;
// Where to find additional information about this movie
Expand Down
8 changes: 4 additions & 4 deletions server/api/tumdev/campus_backend.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1445,8 +1445,8 @@
"type": "string"
},
"movieId": {
"type": "integer",
"format": "int32"
"type": "string",
"format": "int64"
},
"date": {
"type": "string",
Expand Down Expand Up @@ -1483,8 +1483,8 @@
"type": "string"
},
"coverId": {
"type": "integer",
"format": "int32"
"type": "string",
"format": "int64"
},
"link": {
"type": "string",
Expand Down
10 changes: 5 additions & 5 deletions server/backend/movie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var (
Date: timestamppb.New(time.Now()),
Created: timestamppb.New(time.Now()),
Title: "Mission Impossible 4 - Ghost Protocol",
Year: "2011",
ReleaseYear: "2011",
Runtime: "133 min",
Genre: "Action, Adventure, Thriller",
Director: "Brad Bird",
Expand All @@ -63,7 +63,7 @@ var (
Date: timestamppb.New(time.Now()),
Created: timestamppb.New(time.Now()),
Title: "Mission Impossible 5 - Rogue Nation",
Year: "2015",
ReleaseYear: "2015",
Runtime: "131 min",
Genre: "Action, Adventure, Thriller",
Director: "Christopher McQuarrie",
Expand All @@ -82,8 +82,8 @@ func (s *MovieSuite) Test_GetMoviesAll() {
s.mock.ExpectQuery("SELECT `kino`.`kino`,`kino`.`date`,`kino`.`created`,`kino`.`title`,`kino`.`year`,`kino`.`runtime`,`kino`.`genre`,`kino`.`director`,`kino`.`actors`,`kino`.`rating`,`kino`.`description`,`kino`.`trailer`,`kino`.`cover`,`kino`.`link`,`Files`.`file` AS `Files__file`,`Files`.`name` AS `Files__name`,`Files`.`path` AS `Files__path`,`Files`.`downloads` AS `Files__downloads`,`Files`.`url` AS `Files__url`,`Files`.`downloaded` AS `Files__downloaded` FROM `kino` LEFT JOIN `files` `Files` ON `kino`.`cover` = `Files`.`file` WHERE kino > ?").
WithArgs(-1).
WillReturnRows(sqlmock.NewRows([]string{"kino", "date", "created", "title", "year", "runtime", "genre", "director", "actors", "rating", "description", "trailer", "cover", "link", "Files__file", "Files__name", "Files__path", "Files__downloads", "Files__url", "Files__downloaded"}).
AddRow(movie2.MovieId, movie2.Date.AsTime(), movie2.Created.AsTime(), movie2.Title, movie2.Year, movie2.Runtime, movie2.Genre, movie2.Director, movie2.Actors, movie2.ImdbRating, movie2.Description, nil, movie2.CoverId, movie2.Link, movie2.CoverId, movie2.CoverName, movie2.CoverPath, 1, "", 1).
AddRow(movie1.MovieId, movie1.Date.AsTime(), movie1.Created.AsTime(), movie1.Title, movie1.Year, movie1.Runtime, movie1.Genre, movie1.Director, movie1.Actors, movie1.ImdbRating, movie1.Description, nil, movie1.CoverId, movie1.Link, movie1.CoverId, movie1.CoverName, movie1.CoverPath, 1, "", 1))
AddRow(movie2.MovieId, movie2.Date.AsTime(), movie2.Created.AsTime(), movie2.Title, movie2.ReleaseYear, movie2.Runtime, movie2.Genre, movie2.Director, movie2.Actors, movie2.ImdbRating, movie2.Description, nil, movie2.CoverId, movie2.Link, movie2.CoverId, movie2.CoverName, movie2.CoverPath, 1, "", 1).
AddRow(movie1.MovieId, movie1.Date.AsTime(), movie1.Created.AsTime(), movie1.Title, movie1.ReleaseYear, movie1.Runtime, movie1.Genre, movie1.Director, movie1.Actors, movie1.ImdbRating, movie1.Description, nil, movie1.CoverId, movie1.Link, movie1.CoverId, movie1.CoverName, movie1.CoverPath, 1, "", 1))
response, err := server.GetMovies(context.Background(), &pb.GetMoviesRequest{LastId: -1})
require.NoError(s.T(), err)
require.Equal(s.T(), &pb.GetMoviesReply{Movies: []*pb.Movie{&movie2, &movie1}}, response)
Expand All @@ -94,7 +94,7 @@ func (s *MovieSuite) Test_GetMoviesOne() {
s.mock.ExpectQuery("SELECT `kino`.`kino`,`kino`.`date`,`kino`.`created`,`kino`.`title`,`kino`.`year`,`kino`.`runtime`,`kino`.`genre`,`kino`.`director`,`kino`.`actors`,`kino`.`rating`,`kino`.`description`,`kino`.`trailer`,`kino`.`cover`,`kino`.`link`,`Files`.`file` AS `Files__file`,`Files`.`name` AS `Files__name`,`Files`.`path` AS `Files__path`,`Files`.`downloads` AS `Files__downloads`,`Files`.`url` AS `Files__url`,`Files`.`downloaded` AS `Files__downloaded` FROM `kino` LEFT JOIN `files` `Files` ON `kino`.`cover` = `Files`.`file` WHERE kino > ?").
WithArgs(1).
WillReturnRows(sqlmock.NewRows([]string{"kino", "date", "created", "title", "year", "runtime", "genre", "director", "actors", "rating", "description", "trailer", "cover", "link", "Files__file", "Files__name", "Files__path", "Files__downloads", "Files__url", "Files__downloaded"}).
AddRow(movie1.MovieId, movie1.Date.AsTime(), movie1.Created.AsTime(), movie1.Title, movie1.Year, movie1.Runtime, movie1.Genre, movie1.Director, movie1.Actors, movie1.ImdbRating, movie1.Description, nil, movie1.CoverId, movie1.Link, movie1.CoverId, movie1.CoverName, movie1.CoverPath, 1, "", 1))
AddRow(movie1.MovieId, movie1.Date.AsTime(), movie1.Created.AsTime(), movie1.Title, movie1.ReleaseYear, movie1.Runtime, movie1.Genre, movie1.Director, movie1.Actors, movie1.ImdbRating, movie1.Description, nil, movie1.CoverId, movie1.Link, movie1.CoverId, movie1.CoverName, movie1.CoverPath, 1, "", 1))
response, err := server.GetMovies(context.Background(), &pb.GetMoviesRequest{LastId: 1})
require.NoError(s.T(), err)
require.Equal(s.T(), &pb.GetMoviesReply{Movies: []*pb.Movie{&movie1}}, response)
Expand Down
4 changes: 2 additions & 2 deletions server/model/kino.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// Kino stores all movies
type Kino struct {
Id int32 `gorm:"primary_key;AUTO_INCREMENT;column:kino;type:int;not null;"`
Id int64 `gorm:"primary_key;AUTO_INCREMENT;column:kino;type:int;not null;"`
Date time.Time `gorm:"column:date;type:datetime;not null;"`
Created time.Time `gorm:"column:created;type:timestamp;not null;default:CURRENT_TIMESTAMP"`
Title string `gorm:"column:title;type:text;not null;"`
Expand All @@ -20,7 +20,7 @@ type Kino struct {
ImdbRating string `gorm:"column:rating;type:varchar(4);not null;"`
Description string `gorm:"column:description;type:text;not null;"`
Trailer null.String `gorm:"column:trailer"`
FilesID int32 `gorm:"column:cover"`
FilesID int64 `gorm:"column:cover"`
Files Files `gorm:"foreignKey:FilesID;references:file"`
Link string `gorm:"column:link;type:varchar(190);not null;unique;"`
}
Expand Down

0 comments on commit 4c91ba2

Please sign in to comment.