From f8995ca99039a572aedaf0f51e8cfba004c430cd Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 23 Nov 2024 15:29:46 +0100 Subject: [PATCH 1/6] Renamed model repo to provider + provider registration check --- .../Generators/IAdminPageGenerator.cs | 6 +++--- .../Generators/Implementation/AdminPageGenerator.cs | 2 +- .../{ModelRepository.cs => ModelProvider.cs} | 4 ++-- src/HopFrame.Web.Admin/Models/AdminPage.cs | 6 ++++-- .../Components/Administration/AdminPageModal.razor | 12 ++++++------ src/HopFrame.Web/HopAdminContext.cs | 6 +++--- .../Pages/Administration/AdminPageList.razor | 8 ++++---- .../{Repositories => Provider}/GroupProvider.cs | 4 ++-- .../{Repositories => Provider}/UserProvider.cs | 4 ++-- test/FrontendTest/AdminContext.cs | 4 ++-- test/FrontendTest/Providers/AddressProvider.cs | 2 +- test/FrontendTest/Providers/EmployeeProvider.cs | 2 +- 12 files changed, 31 insertions(+), 29 deletions(-) rename src/HopFrame.Web.Admin/{ModelRepository.cs => ModelProvider.cs} (89%) rename src/HopFrame.Web/{Repositories => Provider}/GroupProvider.cs (91%) rename src/HopFrame.Web/{Repositories => Provider}/UserProvider.cs (91%) diff --git a/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs b/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs index 30a6ef5..65998bd 100644 --- a/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs +++ b/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs @@ -78,11 +78,11 @@ public interface IAdminPageGenerator { IAdminPageGenerator DefaultSort(Expression> propertyExpression, ListSortDirection direction); /// - /// Specifies the repository for the page + /// Specifies the repository provider for the page /// - /// The specified repository + /// The specified provider /// - IAdminPageGenerator ConfigureRepository() where TRepository : ModelRepository; + IAdminPageGenerator ConfigureProvider() where TRepository : ModelProvider; /// diff --git a/src/HopFrame.Web.Admin/Generators/Implementation/AdminPageGenerator.cs b/src/HopFrame.Web.Admin/Generators/Implementation/AdminPageGenerator.cs index d2fb6ec..eb61f7d 100644 --- a/src/HopFrame.Web.Admin/Generators/Implementation/AdminPageGenerator.cs +++ b/src/HopFrame.Web.Admin/Generators/Implementation/AdminPageGenerator.cs @@ -91,7 +91,7 @@ internal sealed class AdminPageGenerator : IAdminPageGenerator, return this; } - public IAdminPageGenerator ConfigureRepository() where TRepository : ModelRepository { + public IAdminPageGenerator ConfigureProvider() where TRepository : ModelProvider { Page.RepositoryProvider = typeof(TRepository); return this; } diff --git a/src/HopFrame.Web.Admin/ModelRepository.cs b/src/HopFrame.Web.Admin/ModelProvider.cs similarity index 89% rename from src/HopFrame.Web.Admin/ModelRepository.cs rename to src/HopFrame.Web.Admin/ModelProvider.cs index 45de247..7725bf5 100644 --- a/src/HopFrame.Web.Admin/ModelRepository.cs +++ b/src/HopFrame.Web.Admin/ModelProvider.cs @@ -1,6 +1,6 @@ namespace HopFrame.Web.Admin; -public abstract class ModelRepository : IModelRepository { +public abstract class ModelProvider : IModelProvider { public abstract Task> ReadAll(); public abstract Task Create(TModel model); public abstract Task Update(TModel model); @@ -25,7 +25,7 @@ public abstract class ModelRepository : IModelRepository { } } -public interface IModelRepository { +public interface IModelProvider { Task> ReadAllO(); Task CreateO(object model); Task UpdateO(object model); diff --git a/src/HopFrame.Web.Admin/Models/AdminPage.cs b/src/HopFrame.Web.Admin/Models/AdminPage.cs index 1eb43db..e449e8c 100644 --- a/src/HopFrame.Web.Admin/Models/AdminPage.cs +++ b/src/HopFrame.Web.Admin/Models/AdminPage.cs @@ -24,10 +24,12 @@ public class AdminPage { public bool ShowDeleteButton { get; set; } = true; public bool ShowUpdateButton { get; set; } = true; - public IModelRepository LoadModelRepository(IServiceProvider provider) { + public IModelProvider LoadModelProvider(IServiceProvider provider) { if (RepositoryProvider is null) return null; + var repoProvider = provider.GetService(RepositoryProvider); + if (repoProvider != null) return repoProvider as IModelProvider; var dependencies = AdminContextGenerator.ResolveDependencies(RepositoryProvider, provider); - return Activator.CreateInstance(RepositoryProvider, dependencies) as IModelRepository; + return Activator.CreateInstance(RepositoryProvider, dependencies) as IModelProvider; } } diff --git a/src/HopFrame.Web/Components/Administration/AdminPageModal.razor b/src/HopFrame.Web/Components/Administration/AdminPageModal.razor index 8e04608..4876323 100644 --- a/src/HopFrame.Web/Components/Administration/AdminPageModal.razor +++ b/src/HopFrame.Web/Components/Administration/AdminPageModal.razor @@ -128,7 +128,7 @@ private Dictionary _validationIdentifiers; private IDictionary _values; private Dictionary _selectorValues; - private IModelRepository _repository; + private IModelProvider _provider; private AdminPage _currentPage; private object _entry; @@ -143,7 +143,7 @@ _currentPage = page; _entry = entryToEdit; _isEdit = entryToEdit is not null; - _repository = _currentPage.LoadModelRepository(Provider); + _provider = _currentPage.LoadModelProvider(Provider); _entry ??= Activator.CreateInstance(_currentPage.ModelType); _context = new EditContext(_entry); @@ -246,7 +246,7 @@ foreach (var value in _values) { if (value.Key.Unique) { if (value.Value == value.Key.GetValue(_entry)) continue; - var data = _repository!.ReadAllO().GetAwaiter().GetResult(); + var data = _provider!.ReadAllO().GetAwaiter().GetResult(); foreach (var entry in data) { var other = value.Key.GetValue(entry); if (!other.Equals(value.Value)) continue; @@ -293,7 +293,7 @@ throw new ArgumentException($"'{property.Name}' cannot be a selector because a admin page for '{type.Name}' does not exist!"); } - var repo = page.LoadModelRepository(Provider); + var repo = page.LoadModelProvider(Provider); var objects = (await repo!.ReadAllO()).ToArray(); _selectorValues[property] = objects; @@ -346,7 +346,7 @@ } if (!_isEdit) { - await _repository.CreateO(_entry); + await _provider.CreateO(_entry); Alerts.FireAsync(new SweetAlertOptions { Title = "New entry added!", @@ -356,7 +356,7 @@ }); } else { - await _repository.UpdateO(_entry); + await _provider.UpdateO(_entry); Alerts.FireAsync(new SweetAlertOptions { Title = "Entry updated!", diff --git a/src/HopFrame.Web/HopAdminContext.cs b/src/HopFrame.Web/HopAdminContext.cs index 6d89e76..0beffd2 100644 --- a/src/HopFrame.Web/HopAdminContext.cs +++ b/src/HopFrame.Web/HopAdminContext.cs @@ -5,7 +5,7 @@ using HopFrame.Web.Admin; using HopFrame.Web.Admin.Attributes; using HopFrame.Web.Admin.Generators; using HopFrame.Web.Admin.Models; -using HopFrame.Web.Repositories; +using HopFrame.Web.Provider; namespace HopFrame.Web; @@ -20,7 +20,7 @@ internal class HopAdminContext : AdminPagesContext { public override void OnModelCreating(IAdminContextGenerator generator) { generator.Page() .Description("On this page you can manage all user accounts.") - .ConfigureRepository() + .ConfigureProvider() .ViewPermission(AdminPermissions.ViewUsers) .CreatePermission(AdminPermissions.AddUser) .UpdatePermission(AdminPermissions.EditUser) @@ -63,7 +63,7 @@ internal class HopAdminContext : AdminPagesContext { generator.Page() .Description("On this page you can view, create, edit and delete permission groups.") - .ConfigureRepository() + .ConfigureProvider() .ViewPermission(AdminPermissions.ViewGroups) .CreatePermission(AdminPermissions.AddGroup) .UpdatePermission(AdminPermissions.EditGroup) diff --git a/src/HopFrame.Web/Pages/Administration/AdminPageList.razor b/src/HopFrame.Web/Pages/Administration/AdminPageList.razor index 2f2519c..163f66f 100644 --- a/src/HopFrame.Web/Pages/Administration/AdminPageList.razor +++ b/src/HopFrame.Web/Pages/Administration/AdminPageList.razor @@ -113,7 +113,7 @@ public string Url { get; set; } private AdminPage _pageData; - private IModelRepository _modelRepository; + private IModelProvider _modelProvider; private IEnumerable _modelBuffer; private AdminPageModal _modal; @@ -138,7 +138,7 @@ if (_pageData.RepositoryProvider is null) throw new ArgumentException($"AdminPage '{_pageData.Title}' does not specify a model repository!'"); - _modelRepository = _pageData.LoadModelRepository(Provider); + _modelProvider = _pageData.LoadModelProvider(Provider); _hasEditPermission = _pageData.Permissions.Update is null || await Permissions.HasPermission(Auth.User, _pageData.Permissions.Update); _hasDeletePermission = _pageData.Permissions.Delete is null || await Permissions.HasPermission(Auth.User, _pageData.Permissions.Delete); @@ -154,7 +154,7 @@ } private async Task Reload() { - _modelBuffer = await _modelRepository.ReadAllO(); + _modelBuffer = await _modelProvider.ReadAllO(); _displayedModels = _modelBuffer.ToList(); _currentSortDirection = _pageData.DefaultSortDirection; @@ -238,7 +238,7 @@ }); if (result.IsConfirmed) { - await _modelRepository.DeleteO(entry); + await _modelProvider.DeleteO(entry); await Reload(); await Alerts.FireAsync(new SweetAlertOptions { diff --git a/src/HopFrame.Web/Repositories/GroupProvider.cs b/src/HopFrame.Web/Provider/GroupProvider.cs similarity index 91% rename from src/HopFrame.Web/Repositories/GroupProvider.cs rename to src/HopFrame.Web/Provider/GroupProvider.cs index 953a9d7..d93e970 100644 --- a/src/HopFrame.Web/Repositories/GroupProvider.cs +++ b/src/HopFrame.Web/Provider/GroupProvider.cs @@ -2,9 +2,9 @@ using HopFrame.Database.Models; using HopFrame.Database.Repositories; using HopFrame.Web.Admin; -namespace HopFrame.Web.Repositories; +namespace HopFrame.Web.Provider; -internal sealed class GroupProvider(IGroupRepository repo) : ModelRepository { +internal sealed class GroupProvider(IGroupRepository repo) : ModelProvider { public override async Task> ReadAll() { return await repo.GetPermissionGroups(); } diff --git a/src/HopFrame.Web/Repositories/UserProvider.cs b/src/HopFrame.Web/Provider/UserProvider.cs similarity index 91% rename from src/HopFrame.Web/Repositories/UserProvider.cs rename to src/HopFrame.Web/Provider/UserProvider.cs index 49ca30f..08a1754 100644 --- a/src/HopFrame.Web/Repositories/UserProvider.cs +++ b/src/HopFrame.Web/Provider/UserProvider.cs @@ -2,9 +2,9 @@ using HopFrame.Database.Models; using HopFrame.Database.Repositories; using HopFrame.Web.Admin; -namespace HopFrame.Web.Repositories; +namespace HopFrame.Web.Provider; -internal sealed class UserProvider(IUserRepository repo) : ModelRepository { +internal sealed class UserProvider(IUserRepository repo) : ModelProvider { public override async Task> ReadAll() { return await repo.GetUsers(); } diff --git a/test/FrontendTest/AdminContext.cs b/test/FrontendTest/AdminContext.cs index 3c9af86..2eaff8d 100644 --- a/test/FrontendTest/AdminContext.cs +++ b/test/FrontendTest/AdminContext.cs @@ -28,11 +28,11 @@ public class AdminContext : AdminPagesContext { .Parser((model, e) => model.AddressId = e.EmployeeId); generator.Page() - .ConfigureRepository() + .ConfigureProvider() .ListingProperty(e => e.Name); generator.Page
() - .ConfigureRepository() + .ConfigureProvider() .ListingProperty(a => a.City); } } \ No newline at end of file diff --git a/test/FrontendTest/Providers/AddressProvider.cs b/test/FrontendTest/Providers/AddressProvider.cs index 94b203e..de5f13f 100644 --- a/test/FrontendTest/Providers/AddressProvider.cs +++ b/test/FrontendTest/Providers/AddressProvider.cs @@ -4,7 +4,7 @@ using RestApiTest.Models; namespace FrontendTest.Providers; -public class AddressProvider(DatabaseContext context) : ModelRepository
{ +public class AddressProvider(DatabaseContext context) : ModelProvider
{ public override async Task> ReadAll() { return await context.Addresses.ToArrayAsync(); diff --git a/test/FrontendTest/Providers/EmployeeProvider.cs b/test/FrontendTest/Providers/EmployeeProvider.cs index 0eb2aff..89f7b84 100644 --- a/test/FrontendTest/Providers/EmployeeProvider.cs +++ b/test/FrontendTest/Providers/EmployeeProvider.cs @@ -4,7 +4,7 @@ using RestApiTest.Models; namespace FrontendTest.Providers; -public class EmployeeProvider(DatabaseContext context) : ModelRepository { +public class EmployeeProvider(DatabaseContext context) : ModelProvider { public override async Task> ReadAll() { return await context.Employees From bd7751b44bb28a2ce8a6e084ccd6c32f1f8d1d1f Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 23 Nov 2024 15:40:58 +0100 Subject: [PATCH 2/6] Updated versions + edited project readme's --- README.md | 12 +-- src/HopFrame.Api/HopFrame.Api.csproj | 2 +- src/HopFrame.Api/README.md | 98 +------------------ .../HopFrame.Database.csproj | 2 +- src/HopFrame.Database/README.md | 4 +- .../HopFrame.Security.csproj | 2 +- src/HopFrame.Security/README.md | 72 +------------- .../HopFrame.Web.Admin.csproj | 6 ++ src/HopFrame.Web.Admin/README.md | 4 + src/HopFrame.Web/HopFrame.Web.csproj | 2 +- src/HopFrame.Web/README.md | 58 +---------- 11 files changed, 23 insertions(+), 239 deletions(-) create mode 100644 src/HopFrame.Web.Admin/README.md diff --git a/README.md b/README.md index 26ad808..4d53003 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,15 @@ A simple backend management api for ASP.NET Core Web APIs - [x] Database management - [x] User authentication - [x] Permission management -- [x] Frontend dashboards - -## 2.0 Todo list -- [x] 1.0 bug fixes -- [x] Code cleanup -- [x] Relations in database -- [x] Generated Admin pages -- [x] Pretty Login page for administration -- [ ] Clean documentation +- [x] Generated frontend administration boards # Usage There are two different versions of HopFrame, either the Web API version or the full Blazor web version. ## Ho to use the Web API version +> **Hint:** For more information about the HopFrame installation and usage go to the [docs](./docs). + 1. Add the HopFrame.Api library to your project: ``` diff --git a/src/HopFrame.Api/HopFrame.Api.csproj b/src/HopFrame.Api/HopFrame.Api.csproj index 614e37a..744a466 100644 --- a/src/HopFrame.Api/HopFrame.Api.csproj +++ b/src/HopFrame.Api/HopFrame.Api.csproj @@ -7,7 +7,7 @@ disable HopFrame.Api - 1.1.0 + 2.0.0 README.md MIT true diff --git a/src/HopFrame.Api/README.md b/src/HopFrame.Api/README.md index 67b946b..94966e4 100644 --- a/src/HopFrame.Api/README.md +++ b/src/HopFrame.Api/README.md @@ -1,100 +1,4 @@ # HopFrame API module This module contains some useful endpoints for user login / register management. -## Ho to use the Web API version - -1. Add the HopFrame.Api library to your project: - - ``` - dotnet add package HopFrame.Api - ``` - -2. Create a DbContext that inherits the ``HopDbContext`` and add a data source - - ```csharp - public class DatabaseContext : HopDbContextBase { - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - base.OnConfiguring(optionsBuilder); - - optionsBuilder.UseSqlite("..."); - } - } - ``` - -3. Add the DbContext and HopFrame to your services - - ```csharp - builder.Services.AddDbContext(); - builder.Services.AddHopFrame(); - ``` - -# Endpoints -By default, the module provides a controller for handling authentication based requests by the user. -You can explore the contoller by the build in swagger site from ASP .NET. - -## Disable the Endpoints - -```csharp -builder.Services.AddDbContext(); -//builder.Services.AddHopFrame(); -services.AddHopFrameNoEndpoints(); -``` - -# Services added in this module -You can use these services by specifying them as a dependency. All of them are scoped dependencies. - -## LogicResult -Logic result is an extension of the ActionResult for an ApiController. It provides simple Http status results with either a message or data by specifying the generic type. - -```csharp -public class LogicResult : ILogicResult { - public static LogicResult Ok(); - - public static LogicResult BadRequest(); - - public static LogicResult BadRequest(string message); - - public static LogicResult Forbidden(); - - public static LogicResult Forbidden(string message); - - public static LogicResult NotFound(); - - public static LogicResult NotFound(string message); - - public static LogicResult Conflict(); - - public static LogicResult Conflict(string message); - - public static LogicResult Forward(LogicResult result); - - public static LogicResult Forward(ILogicResult result); - - public static implicit operator ActionResult(LogicResult v); -} - -public class LogicResult : ILogicResult { - public static LogicResult Ok(); - - public static LogicResult Ok(T result); - - ... -} -``` - -## IAuthLogic -This service handles all logic needed to provide the authentication endpoints by using the LogicResults. - -```csharp -public interface IAuthLogic { - Task>> Login(UserLogin login); - - Task>> Register(UserRegister register); - - Task>> Authenticate(); - - Task Logout(); - - Task Delete(UserPasswordValidation validation); -} -``` \ No newline at end of file +For more information about the HopFrame visit the [docs](https://git.leon-hoppe.de/leon.hoppe/HopFrame). \ No newline at end of file diff --git a/src/HopFrame.Database/HopFrame.Database.csproj b/src/HopFrame.Database/HopFrame.Database.csproj index f2bcba7..de55cd5 100644 --- a/src/HopFrame.Database/HopFrame.Database.csproj +++ b/src/HopFrame.Database/HopFrame.Database.csproj @@ -7,7 +7,7 @@ disable HopFrame.Database - 1.1.0 + 2.0.0 README.md MIT true diff --git a/src/HopFrame.Database/README.md b/src/HopFrame.Database/README.md index 0aacfa2..25d0bda 100644 --- a/src/HopFrame.Database/README.md +++ b/src/HopFrame.Database/README.md @@ -1,2 +1,4 @@ # HopFrame Database module -This module contains all the logic for the database communication +This module contains all the logic for the database communication. + +For more information about the HopFrame visit the [docs](https://git.leon-hoppe.de/leon.hoppe/HopFrame). diff --git a/src/HopFrame.Security/HopFrame.Security.csproj b/src/HopFrame.Security/HopFrame.Security.csproj index b8a814b..74c1d50 100644 --- a/src/HopFrame.Security/HopFrame.Security.csproj +++ b/src/HopFrame.Security/HopFrame.Security.csproj @@ -8,7 +8,7 @@ HopFrame.Security HopFrame.Security - 1.1.0 + 2.0.0 README.md MIT true diff --git a/src/HopFrame.Security/README.md b/src/HopFrame.Security/README.md index cc4b5d0..9dfdbb4 100644 --- a/src/HopFrame.Security/README.md +++ b/src/HopFrame.Security/README.md @@ -1,74 +1,4 @@ # HopFrame Security module this module contains all handlers for the login and register validation. It also checks the user permissions. -# Services added in this module -You can use these services by specifying them as a dependency. All of them are scoped dependencies. - -## ITokenContext -This service provides the information given by the current request - -```csharp -public interface ITokenContext { - bool IsAuthenticated { get; } - - User User { get; } - - Guid AccessToken { get; } -} -``` - -## IUserService -This service simplifies the data access of the user table in the database. - -```csharp -public interface IUserService { - Task> GetUsers(); - - Task GetUser(Guid userId); - - Task GetUserByEmail(string email); - - Task GetUserByUsername(string username); - - Task AddUser(UserRegister user); - - Task UpdateUser(User user); - - Task DeleteUser(User user); - - Task CheckUserPassword(User user, string password); - - Task ChangePassword(User user, string password); -} -``` - -## IPermissionService -This service handles all permission and group interactions with the data source. - -```csharp -public interface IPermissionService { - Task HasPermission(string permission, Guid user); - - Task> GetPermissionGroups(); - - Task GetPermissionGroup(string name); - - Task EditPermissionGroup(PermissionGroup group); - - Task> GetUserPermissionGroups(User user); - - Task RemoveGroupFromUser(User user, PermissionGroup group); - - Task CreatePermissionGroup(string name, bool isDefault = false, string description = null); - - Task DeletePermissionGroup(PermissionGroup group); - - Task GetPermission(string name, IPermissionOwner owner); - - Task AddPermission(IPermissionOwner owner, string permission); - - Task RemovePermission(Permission permission); - - Task GetFullPermissions(string user); -} -``` +For more information about the HopFrame visit the [docs](https://git.leon-hoppe.de/leon.hoppe/HopFrame). diff --git a/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj b/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj index 096a35f..ab89ff0 100644 --- a/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj +++ b/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj @@ -4,6 +4,12 @@ net8.0 enable disable + + HopFrame.Web.Admin + 2.0.0 + README.md + MIT + true diff --git a/src/HopFrame.Web.Admin/README.md b/src/HopFrame.Web.Admin/README.md new file mode 100644 index 0000000..3687e26 --- /dev/null +++ b/src/HopFrame.Web.Admin/README.md @@ -0,0 +1,4 @@ +# HopFrame admin pages module +This module contains all necessary information to create and compile the generated admin pages. + +For more information about the HopFrame visit the [docs](https://git.leon-hoppe.de/leon.hoppe/HopFrame). diff --git a/src/HopFrame.Web/HopFrame.Web.csproj b/src/HopFrame.Web/HopFrame.Web.csproj index bec6f04..a512b95 100644 --- a/src/HopFrame.Web/HopFrame.Web.csproj +++ b/src/HopFrame.Web/HopFrame.Web.csproj @@ -7,7 +7,7 @@ true HopFrame.Web - 1.1.0 + 2.0.0 README.md MIT true diff --git a/src/HopFrame.Web/README.md b/src/HopFrame.Web/README.md index 28b55c5..6bd7f3c 100644 --- a/src/HopFrame.Web/README.md +++ b/src/HopFrame.Web/README.md @@ -1,60 +1,4 @@ # HopFrame Web module This module contains useful helpers for Blazor Apps and an Admin Dashboard. -## How to use the Blazor API - -1. Add the HopFrame.Web library to your project - - ``` - dotnet add package HopFrame.Web - ``` - -2. Create a DbContext that inherits the ``HopDbContext`` and add a data source - - ```csharp - public class DatabaseContext : HopDbContextBase { - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - base.OnConfiguring(optionsBuilder); - - optionsBuilder.UseSqlite("..."); - } - } - ``` - -3. Add the DbContext and HopFrame to your services - - ```csharp - builder.Services.AddDbContext(); - builder.Services.AddHopFrame(); - ``` - -4. Add the authentication middleware to your app - - ```csharp - app.UseMiddleware(); - ``` - -5. Add the HopFrame pages to your Razor components - - ```csharp - app.MapRazorComponents() - .AddHopFrameAdminPages() - .AddInteractiveServerRenderMode(); - ``` - -# Services added in this module -You can use these services by specifying them as a dependency. All of them are scoped dependencies. - -## IAuthService -This service handles all the authentication like login or register. It properly creates all tokens so the user can be identified - -```csharp -public interface IAuthService { - Task Register(UserRegister register); - Task Login(UserLogin login); - Task Logout(); - - Task RefreshLogin(); - Task IsLoggedIn(); -} -``` +For more information about the HopFrame visit the [docs](https://git.leon-hoppe.de/leon.hoppe/HopFrame). From 776b055cfb3e3b204e4dc82ae09146f21c2214f5 Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 23 Nov 2024 16:05:57 +0100 Subject: [PATCH 3/6] Added readme to HopFrame.Web.Admin.csproj + added ci scripts --- gitlab-ci.yml | 34 +++++++++++++++++++ .../HopFrame.Web.Admin.csproj | 4 +++ 2 files changed, 38 insertions(+) create mode 100644 gitlab-ci.yml diff --git a/gitlab-ci.yml b/gitlab-ci.yml new file mode 100644 index 0000000..3f0cd38 --- /dev/null +++ b/gitlab-ci.yml @@ -0,0 +1,34 @@ +image: mcr.microsoft.com/dotnet/core/sdk:3.1 + +stages: + - build + - test + - publish + +before_script: + - echo "Setting up environment" + - 'dotnet --version' + +build: + stage: build + script: + - dotnet restore + - dotnet build --configuration Release --no-restore + artifacts: + paths: + - "**/bin/Release" + +test: + stage: test + script: + - dotnet test --no-restore --verbosity normal + +publish: + stage: publish + script: + - dotnet pack -c Release -o . + - for nupkg in *.nupkg; do dotnet nuget push $nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json; done + only: + - main + variables: + NUGET_API_KEY: $NUGET_API_KEY diff --git a/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj b/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj index ab89ff0..e1a0004 100644 --- a/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj +++ b/src/HopFrame.Web.Admin/HopFrame.Web.Admin.csproj @@ -16,4 +16,8 @@ + + + + From 92b7e9a8aef7c059aa920ac49f6fc417db94207d Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 23 Nov 2024 16:07:22 +0100 Subject: [PATCH 4/6] Renamed ci file --- gitlab-ci.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 gitlab-ci.yml diff --git a/gitlab-ci.yml b/gitlab-ci.yml deleted file mode 100644 index 3f0cd38..0000000 --- a/gitlab-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -image: mcr.microsoft.com/dotnet/core/sdk:3.1 - -stages: - - build - - test - - publish - -before_script: - - echo "Setting up environment" - - 'dotnet --version' - -build: - stage: build - script: - - dotnet restore - - dotnet build --configuration Release --no-restore - artifacts: - paths: - - "**/bin/Release" - -test: - stage: test - script: - - dotnet test --no-restore --verbosity normal - -publish: - stage: publish - script: - - dotnet pack -c Release -o . - - for nupkg in *.nupkg; do dotnet nuget push $nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json; done - only: - - main - variables: - NUGET_API_KEY: $NUGET_API_KEY From 92a329ef410da4ecb8e59fec2f2f209257fa1ce0 Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 23 Nov 2024 16:10:27 +0100 Subject: [PATCH 5/6] Accidentally deleted ci file --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3f0cd38 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,34 @@ +image: mcr.microsoft.com/dotnet/core/sdk:3.1 + +stages: + - build + - test + - publish + +before_script: + - echo "Setting up environment" + - 'dotnet --version' + +build: + stage: build + script: + - dotnet restore + - dotnet build --configuration Release --no-restore + artifacts: + paths: + - "**/bin/Release" + +test: + stage: test + script: + - dotnet test --no-restore --verbosity normal + +publish: + stage: publish + script: + - dotnet pack -c Release -o . + - for nupkg in *.nupkg; do dotnet nuget push $nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json; done + only: + - main + variables: + NUGET_API_KEY: $NUGET_API_KEY From b206ab65ce483f7a36c60339106b9ccd7cbff294 Mon Sep 17 00:00:00 2001 From: Leon Hoppe Date: Sat, 23 Nov 2024 16:12:15 +0100 Subject: [PATCH 6/6] Changed dotnet sdk version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3f0cd38..6287fe9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: mcr.microsoft.com/dotnet/core/sdk:3.1 +image: mcr.microsoft.com/dotnet/sdk:8.0 stages: - build