zorchenhimer / MoviePolls

Voting to decide on a movie to watch with MovieNight
https://discord.gg/F2VSgjJ
16 stars 6 forks source link

Movie rework #24,68 #73

Closed CptPie closed 4 years ago

CptPie commented 4 years ago

This PR closes #24 with 221e065 and the following commits. This PR also closes #68 with 70b4089 to e5789e6.

While adding further metadata (duration/rating) was fairly easy (although i needed to do an additional API request for imdb movies) supporting tags was on a whole different level.

To support Tags a new Tag slice was created of the structure

type Tag struct {
    Id   int
    Name string
}

This new struct was added to the database connector with some simple Add/Get/Find/Delete functions. To support searching Movies by tag a new function "FilterMoviesByTags" was created which takes a slice of movies and a slice of tags to be found and returns all movies of the original slice that contain the tags to look for.

I also added a new div in the viewMovie.html to render the new metadata and tags for the movie.

CptPie commented 4 years ago

Oh nearly forgot to tell you - to filter for tags the syntax is t:"{tag}"