Must Contains Filter (#2249)

* Removed docker-compose.yml as it's not used and may confuse users.

* Added ability to delete single collections from card actions. Updated transloco library which fixes older iOS browsers not being able to load Kavita.

* Added a Must Contains comparison which will make so all values must exist.

* Fixed up multiselect dropdowns not reseting value when changing filter field
This commit is contained in:
Joe Milazzo 2023-09-01 14:19:51 -07:00 committed by GitHub
parent b5540e58e0
commit 072fadf1de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 210 additions and 87 deletions

View file

@ -32,7 +32,7 @@ public class CollectionController : BaseApiController
}
/// <summary>
/// Return a list of all collection tags on the server
/// Return a list of all collection tags on the server for the logged in user.
/// </summary>
/// <returns></returns>
[HttpGet]
@ -130,7 +130,6 @@ public class CollectionController : BaseApiController
{
var tag = await _unitOfWork.CollectionTagRepository.GetTagAsync(updateSeriesForTagDto.Tag.Id, CollectionTagIncludes.SeriesMetadata);
if (tag == null) return BadRequest(await _localizationService.Translate(User.GetUserId(), "collection-doesnt-exist"));
tag.SeriesMetadatas ??= new List<SeriesMetadata>();
if (await _collectionService.RemoveTagFromSeries(tag, updateSeriesForTagDto.SeriesIdsToRemove))
return Ok(await _localizationService.Translate(User.GetUserId(), "collection-updated"));
@ -142,4 +141,29 @@ public class CollectionController : BaseApiController
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
}
/// <summary>
/// Removes the collection tag from all Series it was attached to
/// </summary>
/// <param name="tagId"></param>
/// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpDelete]
public async Task<ActionResult> DeleteTag(int tagId)
{
try
{
var tag = await _unitOfWork.CollectionTagRepository.GetTagAsync(tagId, CollectionTagIncludes.SeriesMetadata);
if (tag == null) return BadRequest(await _localizationService.Translate(User.GetUserId(), "collection-doesnt-exist"));
if (await _collectionService.DeleteTag(tag))
return Ok(await _localizationService.Translate(User.GetUserId(), "collection-deleted"));
}
catch (Exception)
{
await _unitOfWork.RollbackAsync();
}
return BadRequest(await _localizationService.Translate(User.GetUserId(), "generic-error"));
}
}