Created Woodpecker CI/CD deployment

- Created Dockerfile for packing up API and Web projects as Docker image
This commit is contained in:
2023-03-27 21:48:25 -05:00
parent baf38aa3cd
commit a5d5ed048f
145 changed files with 30973 additions and 18248 deletions

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using YABA.Common.Attributes;
using YABA.Common.Lookups;
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();
var name = Enum.GetName(enumType, value);
return enumType.GetField(name).GetCustomAttributes(false).OfType<TAttribute>().SingleOrDefault();
}
public static string GetDisplayName(this Enum enumValue)
{
return enumValue.GetAttribute<DisplayAttribute>().Name;
}
public static string GetClaimName(this ClaimsLookup claimLookup)
{
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);
}
}