diff --git a/API/API.csproj b/API/API.csproj index 8947c33..e9936a3 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -10,6 +10,7 @@ + diff --git a/API/Authentication/Interfaces/IGenericAuthentication.cs b/API/Authentication/Interfaces/IGenericAuthentication.cs index 74698d9..a63fa08 100644 --- a/API/Authentication/Interfaces/IGenericAuthentication.cs +++ b/API/Authentication/Interfaces/IGenericAuthentication.cs @@ -2,7 +2,7 @@ using DAL.Models; namespace API.Authentication.Interfaces { - public interface IGenericAuthentication + public interface IGenericAuthentication { bool canGetAll(User user); bool canGet(TModel model, User user); diff --git a/API/Authentication/Interfaces/IYesAuthentication.cs b/API/Authentication/Interfaces/IYesAuthentication.cs new file mode 100644 index 0000000..091a378 --- /dev/null +++ b/API/Authentication/Interfaces/IYesAuthentication.cs @@ -0,0 +1,6 @@ +namespace API.Authentication.Interfaces +{ + public interface IYesAuthentication : IGenericAuthentication + { + } +} diff --git a/API/Authentication/YesAuthentication.cs b/API/Authentication/YesAuthentication.cs new file mode 100644 index 0000000..ad85393 --- /dev/null +++ b/API/Authentication/YesAuthentication.cs @@ -0,0 +1,41 @@ +using API.Authentication.Interfaces; +using DAL.Models; + +namespace API.Authentication +{ + public class YesAuthentication : IYesAuthentication + { + private readonly ILogger _logger; + public YesAuthentication(ILogger logger) + { + _logger = logger; + _logger.Log(LogLevel.Warning, "Yes Authentication being used."); + } + + public bool canGetAll(User user) + { + _logger.Log(LogLevel.Warning, "Yes Authentication being used."); + return true; + } + public bool canGet(object model, User user) + { + _logger.Log(LogLevel.Warning, "Yes Authentication being used."); + return true; + } + public bool canAdd(object item, User user) + { + _logger.Log(LogLevel.Warning, "Yes Authentication being used."); + return true; + } + public bool canUpdate(object model, User user) + { + _logger.Log(LogLevel.Warning, "Yes Authentication being used."); + return true; + } + public bool canDelete(object model, User user) + { + _logger.Log(LogLevel.Warning, "Yes Authentication being used."); + return true; + } + } +} diff --git a/API/Program.cs b/API/Program.cs index 9a1b04d..ee1db36 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -1,6 +1,7 @@ using API.Services; using DAL.Contexts; using Microsoft.EntityFrameworkCore; +using Serilog; using System.Reflection; using InvalidOperationException = System.InvalidOperationException; @@ -22,9 +23,17 @@ namespace API options.IncludeXmlComments(xmlPath, true); }); + builder.Host.UseSerilog((context, configuration) => configuration.ReadFrom.Configuration(context.Configuration)); + builder.Services.AddDbContext(options => { options.UseMySQL(builder.Configuration["connectionString"] ?? throw new InvalidOperationException("Connection String is null")); }); builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); WebApplication app = builder.Build(); diff --git a/API/Services/EventService.cs b/API/Services/EventService.cs new file mode 100644 index 0000000..f131562 --- /dev/null +++ b/API/Services/EventService.cs @@ -0,0 +1,15 @@ +using API.Authentication.Interfaces; +using API.DTO.Base; +using DAL.Contexts; +using DAL.Models; +using DAL.Models.Audits; + +namespace API.Services +{ + public class EventService : ServiceBase + { + public EventService(ILogger logger, SASGContext context, IYesAuthentication auth) : base(logger, context, auth) + { + } + } +} diff --git a/API/Services/GrantService.cs b/API/Services/GrantService.cs new file mode 100644 index 0000000..0c11e79 --- /dev/null +++ b/API/Services/GrantService.cs @@ -0,0 +1,15 @@ +using API.Authentication.Interfaces; +using API.DTO.Base; +using DAL.Contexts; +using DAL.Models; +using DAL.Models.Audits; + +namespace API.Services +{ + public class GrantService : ServiceBase + { + public GrantService(ILogger logger, SASGContext context, IYesAuthentication auth) : base(logger, context, auth) + { + } + } +} diff --git a/API/Services/ImageService.cs b/API/Services/ImageService.cs new file mode 100644 index 0000000..737af2f --- /dev/null +++ b/API/Services/ImageService.cs @@ -0,0 +1,15 @@ +using API.Authentication.Interfaces; +using API.DTO.Base; +using DAL.Contexts; +using DAL.Models; +using DAL.Models.Audits; + +namespace API.Services +{ + public class ImageService : ServiceBase + { + public ImageService(ILogger logger, SASGContext context, IYesAuthentication auth) : base(logger, context, auth) + { + } + } +} diff --git a/API/Services/PermissionService.cs b/API/Services/PermissionService.cs new file mode 100644 index 0000000..b1dc81b --- /dev/null +++ b/API/Services/PermissionService.cs @@ -0,0 +1,16 @@ +using API.Authentication.Interfaces; +using API.DTO.Base; +using DAL.Contexts; +using DAL.Models; +using DAL.Models.Audits; + +namespace API.Services +{ + public class PermissionService : ServiceBase + { + + public PermissionService(ILogger logger, SASGContext context, IYesAuthentication auth) : base(logger, context, auth) + { + } + } +} diff --git a/API/Services/SavedEventService.cs b/API/Services/SavedEventService.cs new file mode 100644 index 0000000..229fa37 --- /dev/null +++ b/API/Services/SavedEventService.cs @@ -0,0 +1,16 @@ +using API.Authentication.Interfaces; +using API.DTO.Base; +using DAL.Contexts; +using DAL.Models; +using DAL.Models.Audits; + +namespace API.Services +{ + public class SavedEventService : ServiceBase + { + + public SavedEventService(ILogger logger, SASGContext context, IYesAuthentication auth) : base(logger, context, auth) + { + } + } +} diff --git a/API/Services/UserService.cs b/API/Services/UserService.cs new file mode 100644 index 0000000..2eb03f2 --- /dev/null +++ b/API/Services/UserService.cs @@ -0,0 +1,16 @@ +using API.Authentication.Interfaces; +using API.DTO.Base; +using DAL.Contexts; +using DAL.Models; +using DAL.Models.Audits; + +namespace API.Services +{ + public class UserService : ServiceBase + { + + public UserService(ILogger logger, SASGContext context, IYesAuthentication auth) : base(logger, context, auth) + { + } + } +}