Added endpoint and functionality for getting, retrieving and deleting bookmarks, and for adding and removing tags for a bookmark

This commit is contained in:
Carl Tibule
2023-01-28 00:48:48 -06:00
parent 08823de474
commit b9cd6b3c6a
34 changed files with 1148 additions and 42 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using YABA.Common.Attributes;
@ -8,6 +9,13 @@ namespace YABA.Common.Extensions
{
public static class EnumExtensions
{
private static readonly IEnumerable<CrudResultLookup> SuccessfulCrudStatuses = new List<CrudResultLookup>() {
CrudResultLookup.CreateSucceeded,
CrudResultLookup.UpdateSucceeded,
CrudResultLookup.DeleteSucceeded,
CrudResultLookup.RetrieveSuccessful
};
public static TAttribute GetAttribute<TAttribute>(this Enum value) where TAttribute : Attribute
{
var enumType = value.GetType();
@ -25,5 +33,8 @@ namespace YABA.Common.Extensions
return claimLookup.GetAttribute<ClaimNameAttribute>().Name;
}
public static bool IsCrudResultSuccessful(this CrudResultLookup importStatusLookup) => SuccessfulCrudStatuses.Contains(importStatusLookup);
public static bool IsCrudResultFailure(this CrudResultLookup importStatusLookup) => !SuccessfulCrudStatuses.Contains(importStatusLookup);
}
}