Package com.espacogeek.geek.controllers
Class MediaController
java.lang.Object
com.espacogeek.geek.controllers.MediaController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalternativeTitles(List<MediaModel> medias) Batch-loads alternative titles for a list of MediaModel sources, resolving the N+1 problem.company(List<MediaModel> medias) Batch-loads companies for a list of MediaModel sources, resolving the N+1 problem.externalReference(List<MediaModel> medias) Batch-loads external references for a list of MediaModel sources, resolving the N+1 problem.genre(List<MediaModel> medias) Batch-loads genres for a list of MediaModel sources, resolving the N+1 problem.Finds Anime (MediaModel) objects by their ID or name.Finds Game (MediaModel) objects by their ID or name.getMediaById(Integer id) Finds a MediaModel object by its ID.Finds Movie (MediaModel) objects by their ID or name.Finds Series (MediaModel) objects by their ID or name.getVisualNovel(Integer id, String name, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Finds Visual Novel (MediaModel) objects by their ID or name.people(List<MediaModel> medias) Batch-loads people for a list of MediaModel sources, resolving the N+1 problem.season(List<MediaModel> medias) Batch-loads seasons for a list of MediaModel sources, resolving the N+1 problem.
-
Constructor Details
-
MediaController
public MediaController()
-
-
Method Details
-
getMediaById
Finds a MediaModel object by its ID.- Parameters:
id- The ID of the MediaModel object to find.- Returns:
- The MediaModel object that matches the provided ID.
- Throws:
GenericException- if the MediaModel object is not found.
-
getMovie
@QueryMapping(name="movie") public MediaPage getMovie(@Argument(name="id") Integer id, @Argument(name="name") String name, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Finds Movie (MediaModel) objects by their ID or name.- Parameters:
id- The ID of the Movie (MediaModel) object to find.name- The name of the Movie (MediaModel) object to find.- Returns:
- A list of Movie (MediaModel) objects that match the provided ID or name.
-
getSerie
@QueryMapping(name="tvserie") public MediaPage getSerie(@Argument(name="id") Integer id, @Argument(name="name") String name, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Finds Series (MediaModel) objects by their ID or name.- Parameters:
id- The ID of the Series (MediaModel) object to find.name- The name of the Series (MediaModel) object to find.- Returns:
- A list of Series (MediaModel) objects that match the provided ID or name.
-
getGame
@QueryMapping(name="game") public MediaPage getGame(@Argument(name="id") Integer id, @Argument(name="name") String name, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Finds Game (MediaModel) objects by their ID or name. When searching by ID, the name parameter is not used amd all fields are updated.- Parameters:
id- The ID of the Game (MediaModel) object to find.name- The name of the Game (MediaModel) object to find.- Returns:
- A list of Game (MediaModel) objects that match the provided ID or name.
-
getVisualNovel
@QueryMapping(name="vn") public MediaPage getVisualNovel(@Argument(name="id") Integer id, @Argument(name="name") String name, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Finds Visual Novel (MediaModel) objects by their ID or name.- Parameters:
id- The ID of the Visual Novel (MediaModel) object to find.name- The name of the Visual Novel (MediaModel) object to find.- Returns:
- A list of Visual Novel (MediaModel) objects that match the provided ID or name.
-
getAnime
@QueryMapping(name="anime") public MediaPage getAnime(@Argument(name="id") Integer id, @Argument(name="name") String name, graphql.schema.DataFetchingEnvironment dataFetchingEnvironment) Finds Anime (MediaModel) objects by their ID or name.- Parameters:
id- The ID of the Anime (MediaModel) object to find.name- The name of the Anime (MediaModel) object to find.- Returns:
- A list of Anime (MediaModel) objects that match the provided ID or name.
-
season
@BatchMapping(typeName="Media") public Map<MediaModel,Set<SeasonModel>> season(List<MediaModel> medias) Batch-loads seasons for a list of MediaModel sources, resolving the N+1 problem. -
genre
@BatchMapping(typeName="Media") public Map<MediaModel,Set<GenreModel>> genre(List<MediaModel> medias) Batch-loads genres for a list of MediaModel sources, resolving the N+1 problem. -
company
@BatchMapping(typeName="Media") public Map<MediaModel,Set<CompanyModel>> company(List<MediaModel> medias) Batch-loads companies for a list of MediaModel sources, resolving the N+1 problem. -
people
@BatchMapping(typeName="Media") public Map<MediaModel,Set<PeopleModel>> people(List<MediaModel> medias) Batch-loads people for a list of MediaModel sources, resolving the N+1 problem. -
externalReference
@BatchMapping(typeName="Media") public Map<MediaModel,Set<ExternalReferenceModel>> externalReference(List<MediaModel> medias) Batch-loads external references for a list of MediaModel sources, resolving the N+1 problem. -
alternativeTitles
@BatchMapping(typeName="Media") public Map<MediaModel,Set<AlternativeTitleModel>> alternativeTitles(List<MediaModel> medias) Batch-loads alternative titles for a list of MediaModel sources, resolving the N+1 problem.
-