-
Notifications
You must be signed in to change notification settings - Fork 0
Revert "Fix Games and Visual Novels search returning empty/errors" #63
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -87,8 +87,8 @@ public MediaModel getDetails(Integer id) { | |||||
|
|
||||||
| for (Game result : searchGames) { | ||||||
| if ((long) result.getId() != (long) 0L) { | ||||||
| media = new MediaModel(); | ||||||
| var reference = new ExternalReferenceModel(null, String.valueOf(result.getId()), media, typeReference); | ||||||
| media = new MediaModel(); | ||||||
|
|
||||||
| List<String> genresName = new ArrayList<>(); | ||||||
| result.getGenresList().forEach((genre) -> { | ||||||
|
|
@@ -114,6 +114,7 @@ public MediaModel getDetails(Integer id) { | |||||
| } | ||||||
| media.setAlternativeTitles(new java.util.LinkedHashSet<>(alternativeTitles)); | ||||||
| media.setExternalReference(new java.util.LinkedHashSet<>(List.of(reference))); | ||||||
| media.setMediaCategory(category); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -155,7 +156,8 @@ public List<MediaModel> doSearch(String search, MediaCategoryModel mediaCategory | |||||
| } | ||||||
| media.setAlternativeTitles(new java.util.LinkedHashSet<>(alternativeTitles)); | ||||||
| media.setExternalReference(new java.util.LinkedHashSet<>(List.of(reference))); | ||||||
| media.setMediaCategory(mediaCategoryModel); | ||||||
|
|
||||||
| media.setMediaCategory(category); | ||||||
|
||||||
| media.setMediaCategory(category); | |
| media.setMediaCategory(mediaCategoryModel); |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||||
| package com.espacogeek.geek.repositories; | ||||||||||||||
|
|
||||||||||||||
| import java.util.List; | ||||||||||||||
| import java.util.Map; | ||||||||||||||
|
|
||||||||||||||
| import org.springframework.data.domain.Page; | ||||||||||||||
| import org.springframework.data.domain.Pageable; | ||||||||||||||
| import org.springframework.data.web.PageableDefault; | ||||||||||||||
|
|
||||||||||||||
| import com.espacogeek.geek.models.MediaModel; | ||||||||||||||
|
|
||||||||||||||
| public interface MediaRepositoryCustom { | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Finds media by matching name or alternative title within a specific media | ||||||||||||||
| * category. | ||||||||||||||
| * | ||||||||||||||
| * This query searches for MediaModel entities where the name or any alternative | ||||||||||||||
| * title matches the provided name or alternativeTitle parameters. It filters | ||||||||||||||
| * the | ||||||||||||||
| * results to only include those within the specified media category. The | ||||||||||||||
| * requestedFields parameter is optional and can be used to return only the | ||||||||||||||
| * selected fields of the entities. | ||||||||||||||
| * | ||||||||||||||
| * @param name The name of the media to search for. | ||||||||||||||
| * @param alternativeTitle The alternative title of the media to search for. | ||||||||||||||
| * @param category The ID of the media category to filter results by. | ||||||||||||||
| * @param requestedFields A map of fields to return. If not provided, all | ||||||||||||||
| * fields will be returned. | ||||||||||||||
|
Comment on lines
+28
to
+29
|
||||||||||||||
| * @param requestedFields A map of fields to return. If not provided, all | |
| * fields will be returned. | |
| * @param requestedFields A map of fields to return. If {@code null} or empty, | |
| * the implementation will return a default projection | |
| * that includes only a subset of fields (such as | |
| * {@code id} and {@code name}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExternalReferenceModelis constructed withmediabeforemediais instantiated, so the reference’smediafield will be null. This violates@NotNullon ExternalReferenceModel.media and can break persistence/validation. Instantiatemediafirst (or set the media on the reference after creating the MediaModel).