-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get all relations in APIv3 and plugin abstraction
Get all the relations stored locally, even if we only have half of the relation pointers because we haven't updated our database in awhile and only have the newer relations pointing to older shows, etc., without having to update the anidb anime to grab the new relations for the anime with the missing relation pointers.
- Loading branch information
Showing
13 changed files
with
234 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Shoko.Plugin.Abstractions/Extensions/RelationTypeExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
using Shoko.Plugin.Abstractions.DataModels; | ||
|
||
namespace Shoko.Plugin.Abstractions.Extensions; | ||
|
||
/// <summary> | ||
/// Extensions for the <see cref="RelationType"/> enum. | ||
/// </summary> | ||
public static class RelationTypeExtensions | ||
{ | ||
/// <summary> | ||
/// Reverse the relation. | ||
/// </summary> | ||
/// <param name="type">The relation to reverse.</param> | ||
/// <returns>The reversed relation.</returns> | ||
public static RelationType Reverse(this RelationType type) | ||
{ | ||
return type switch | ||
{ | ||
RelationType.Prequel => RelationType.Sequel, | ||
RelationType.Sequel => RelationType.Prequel, | ||
RelationType.MainStory => RelationType.SideStory, | ||
RelationType.SideStory => RelationType.MainStory, | ||
RelationType.FullStory => RelationType.Summary, | ||
RelationType.Summary => RelationType.FullStory, | ||
_ => type | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.