mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-10-30 18:22:41 -04:00 
			
		
		
		
	Adding 404 to every related query
This commit is contained in:
		
							parent
							
								
									6950b6750a
								
							
						
					
					
						commit
						faa908de7b
					
				| @ -45,12 +45,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Show>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetCollection(id) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -77,12 +75,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Show>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetCollection(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -109,12 +105,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Library>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetCollection(id) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -141,12 +135,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Library>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetCollection(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
| @ -87,12 +87,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Track>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetEpisode(episodeID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -123,12 +121,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Track>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetEpisode(showID, seasonNumber, episodeNumber) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -158,12 +154,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Track>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
| @ -49,10 +49,6 @@ namespace Kyoo.Api | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -83,10 +79,6 @@ namespace Kyoo.Api | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
| @ -56,12 +56,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Show>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetLibrary(id) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -88,12 +86,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Show>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetLibrary(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -120,12 +116,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Collection>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetLibrary(id) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -152,12 +146,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Collection>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetLibrary(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -184,12 +176,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<LibraryItem>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetLibrary(id) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -216,12 +206,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<LibraryItem>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetLibrary(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
| @ -45,12 +45,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Episode>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetSeason(seasonID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -79,12 +77,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Episode>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetSeason(showSlug, seasonNumber) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -112,12 +108,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Episode>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetSeason(showID, seasonNumber) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
| @ -45,12 +45,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Season>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(showID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -77,12 +75,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Season>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -109,12 +105,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Episode>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(showID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -141,12 +135,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Episode>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -172,12 +164,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<PeopleRole>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(showID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -203,12 +193,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<PeopleRole>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -235,12 +223,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Genre>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(showID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -267,12 +253,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Genre>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -327,12 +311,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Library>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(showID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -359,12 +341,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Library>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -391,12 +371,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Collection>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(showID) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -423,12 +401,10 @@ namespace Kyoo.Api | ||||
| 					new Sort<Collection>(sortBy), | ||||
| 					new Pagination(limit, afterID)); | ||||
| 
 | ||||
| 				if (!resources.Any() && await _libraryManager.GetShow(slug) == null) | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
| @ -49,10 +49,6 @@ namespace Kyoo.Api | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
| @ -83,10 +79,6 @@ namespace Kyoo.Api | ||||
| 					return NotFound(); | ||||
| 				return Page(resources, limit); | ||||
| 			} | ||||
| 			catch (ItemNotFound) | ||||
| 			{ | ||||
| 				return NotFound(); | ||||
| 			} | ||||
| 			catch (ArgumentException ex) | ||||
| 			{ | ||||
| 				return BadRequest(new {Error = ex.Message}); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user