Compare commits
	
		
			3 Commits
		
	
	
		
			test-branc
			...
			465222166f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 465222166f | |||
| d967449889 | |||
| 02a845c711 | 
							
								
								
									
										40
									
								
								.gitea/workflows/ci.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								.gitea/workflows/ci.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|     - main | ||||
|     - ci | ||||
|   pull_request: | ||||
|     branches: | ||||
|     - main | ||||
|     - ci | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     timeout-minutes: 15 | ||||
|     steps: | ||||
|     - name: Checkout Module | ||||
|       uses: https://github.com/actions/checkout@v4 | ||||
|       with: | ||||
|         path: Module.EventRegistration | ||||
|     - name: Checkout Oqtane | ||||
|       uses: https://github.com/actions/checkout@v4 | ||||
|       with: | ||||
|         repository: Diplomarbeit-Absolventenverein/oqtane.framework | ||||
|         path: oqtane.framework | ||||
|         ref: v6.1.1 | ||||
|     - name: Setup Dotnet SDK | ||||
|       uses: https://github.com/actions/setup-dotnet@v4 | ||||
|       with: | ||||
|         dotnet-version: '9.x' | ||||
|     # - name: Setup NuGet | ||||
|       # uses: https://github.com/nuget/setup-nuget@v2 | ||||
|       # with: | ||||
|         # nuget-api-key: ${{ secrets.NuGetAPIKey }} | ||||
|         # nuget-version: '5.x' | ||||
|     - name: Build Oqtane | ||||
|       run: dotnet build ./oqtane.framework/Oqtane.sln --configuration Debug | ||||
|     - name: Build Module | ||||
|       run: dotnet build ./Module.EventRegistration/SZUAbsolventenverein.Module.EventRegistration.sln --configuration Release | ||||
|     - name: Test | ||||
|       run: dotnet test ./Module.EventRegistration/SZUAbsolventenverein.Module.EventRegistration.sln --configuration Release --no-build | ||||
							
								
								
									
										35
									
								
								.gitea/workflows/release.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								.gitea/workflows/release.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | ||||
| on: | ||||
|   push: | ||||
|     tags: | ||||
|     - "v[0-9]+.[0-9]+.[0-9]+" | ||||
|   release: | ||||
|     types: | ||||
|       - published | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     timeout-minutes: 15 | ||||
|     steps: | ||||
|     - name: Checkout | ||||
|       uses: https://github.com/actions/checkout@v4 | ||||
|     - name: Verify commit exists in origin/main | ||||
|       run: | | ||||
|         git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | ||||
|         git branch --remote --contains | grep origin/main | ||||
|     - name: Set VERSION variable from tag | ||||
|       run: echo "VERSION=${GITEA_REF/refs\/tags\/v/}" >> $GITEA_ENV | ||||
|     - name: Setup Dotnet SDK | ||||
|       uses: https://github.com/actions/setup-dotnet@v4 | ||||
|     - name: Build | ||||
|       run: dotnet build --configuration Release /p:Version=${VERSION} | ||||
|     - name: Test | ||||
|       run: dotnet test --configuration Release /p:Version=${VERSION} --no-build | ||||
|     - name: Pack | ||||
|       run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output . | ||||
|     - uses: https://github.com/actions/upload-artifact@v4 | ||||
|       with: | ||||
|         name: nuget | ||||
|         if-no-files-found: error | ||||
|         retention-days: 7 | ||||
|         path: ./*.nupkg | ||||
| @ -11,10 +11,6 @@ | ||||
| <h3>Anmeldung zum Event</h3> | ||||
|  | ||||
| <p>Willst du am Event (@_name) teilnehmen?</p> | ||||
| <span>@_eventDate - @_location</span> | ||||
| <div> | ||||
|     <p>@_description</p> | ||||
| </div> | ||||
|  | ||||
| @if (PageState.User != null) { | ||||
|  | ||||
| @ -39,7 +35,7 @@ | ||||
|     } | ||||
| } else | ||||
| { | ||||
|     <p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p> <Login /><Register /> | ||||
|     <p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p> <Login /> | ||||
| } | ||||
|  | ||||
| @code { | ||||
| @ -59,10 +55,6 @@ | ||||
|  | ||||
|     private int _id; | ||||
|     private string _name; | ||||
|     private string _description; | ||||
|     private DateTime _eventDate; | ||||
|     private string _location; | ||||
|  | ||||
|     private string _createdby; | ||||
|     private DateTime _createdon; | ||||
|     private string _modifiedby; | ||||
| @ -111,13 +103,10 @@ | ||||
|             if (currentEvent != null) | ||||
|             { | ||||
|                 _name = currentEvent.Name; | ||||
|                 _description = currentEvent.Description; | ||||
|                 _eventDate = currentEvent.EventDate.ToLocalTime(); | ||||
|                 _location = currentEvent.Location; | ||||
|                 _createdby = currentEvent.CreatedBy; | ||||
|                 _createdon = currentEvent.CreatedOn.ToLocalTime(); | ||||
|                 _createdon = currentEvent.CreatedOn; | ||||
|                 _modifiedby = currentEvent.ModifiedBy; | ||||
|                 _modifiedon = currentEvent.ModifiedOn.ToLocalTime(); | ||||
|                 _modifiedon = currentEvent.ModifiedOn; | ||||
|             } | ||||
|  | ||||
|             if(rsvp != null) | ||||
| @ -132,4 +121,41 @@ | ||||
|             AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private async Task Save() | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             validated = true; | ||||
|             var interop = new Oqtane.UI.Interop(JSRuntime); | ||||
|             if (await interop.FormValid(form)) | ||||
|             { | ||||
|                 if (PageState.Action == "Add") | ||||
|                 { | ||||
|                     Event EventRegistration = new Event(); | ||||
|                     EventRegistration.ModuleId = ModuleState.ModuleId; | ||||
|                     EventRegistration.Name = _name; | ||||
|                     EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); | ||||
|                     await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); | ||||
|                     EventRegistration.Name = _name; | ||||
|                     await EventRegistrationService.UpdateEventAsync(EventRegistration); | ||||
|                     await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); | ||||
|                 } | ||||
|                 NavigationManager.NavigateTo(NavigateUrl()); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 AddModuleMessage(Localizer["Message.SaveValidation"], MessageType.Warning); | ||||
|             } | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Saving EventRegistration {Error}", ex.Message); | ||||
|             AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -16,31 +16,13 @@ | ||||
|                 <input id="name" class="form-control" @bind="@_name" required /> | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="row mb-1 align-items-center"> | ||||
|             <Label Class="col-sm-3" For="description" HelpText="Enter a description" ResourceKey="Description">Description: </Label> | ||||
|             <div class="col-sm-9"> | ||||
|                 <input id="description" class="form-control" @bind="@_description" required /> | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="row mb-1 align-items-center"> | ||||
|             <Label Class="col-sm-3" For="eventdate" HelpText="Enter a Date" ResourceKey="EventDate">EventDate: </Label> | ||||
|             <div class="col-sm-9"> | ||||
|                 <input id="eventdate" class="form-control" @bind="@_eventDate" required /> | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="row mb-1 align-items-center"> | ||||
|             <Label Class="col-sm-3" For="location" HelpText="Enter a Location" ResourceKey="Location">Location: </Label> | ||||
|             <div class="col-sm-9"> | ||||
|                 <input id="location" class="form-control" @bind="@_location" required /> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button> | ||||
|     <NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink> | ||||
|     <br /><br /> | ||||
|     @if (PageState.Action == "Edit") | ||||
|     { | ||||
|         <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo> | ||||
|     <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo> | ||||
|     } | ||||
| </form> | ||||
|  | ||||
| @ -61,10 +43,6 @@ | ||||
|  | ||||
|     private int _id; | ||||
|     private string _name; | ||||
|     private string _description; | ||||
|     private DateTime _eventDate; | ||||
|     private string _location; | ||||
|  | ||||
|     private string _createdby; | ||||
|     private DateTime _createdon; | ||||
|     private string _modifiedby; | ||||
| @ -81,10 +59,6 @@ | ||||
|                 if (EventRegistration != null) | ||||
|                 { | ||||
|                     _name = EventRegistration.Name; | ||||
|                     _description = EventRegistration.Description; | ||||
|                     _eventDate = EventRegistration.EventDate.ToLocalTime(); | ||||
|                     _location = EventRegistration.Location; | ||||
|  | ||||
|                     _createdby = EventRegistration.CreatedBy; | ||||
|                     _createdon = EventRegistration.CreatedOn; | ||||
|                     _modifiedby = EventRegistration.ModifiedBy; | ||||
| @ -112,9 +86,6 @@ | ||||
|                     Event EventRegistration = new Event(); | ||||
|                     EventRegistration.ModuleId = ModuleState.ModuleId; | ||||
|                     EventRegistration.Name = _name; | ||||
|                     EventRegistration.Description = _description; | ||||
|                     EventRegistration.EventDate = _eventDate.ToUniversalTime(); | ||||
|                     EventRegistration.Location = _location; | ||||
|                     EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); | ||||
|                     await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); | ||||
|                 } | ||||
| @ -122,9 +93,6 @@ | ||||
|                 { | ||||
|                     Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); | ||||
|                     EventRegistration.Name = _name; | ||||
|                     EventRegistration.Description = _description; | ||||
|                     EventRegistration.EventDate = _eventDate.ToUniversalTime(); | ||||
|                     EventRegistration.Location = _location; | ||||
|                     await EventRegistrationService.UpdateEventAsync(EventRegistration); | ||||
|                     await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); | ||||
|                 } | ||||
|  | ||||
| @ -9,9 +9,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration | ||||
|         { | ||||
|             Name = "EventRegistration", | ||||
|             Description = "A module to manage registration for events", | ||||
|             Version = "1.0.5", | ||||
|             Version = "1.0.0", | ||||
|             ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane", | ||||
|             ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5", | ||||
|             ReleaseVersions = "1.0.0", | ||||
|             Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane", | ||||
|             PackageName = "SZUAbsolventenverein.Module.EventRegistration"  | ||||
|         }; | ||||
|  | ||||
| @ -1,5 +1,8 @@ | ||||
| TargetFramework=$1 | ||||
| ProjectName=$2 | ||||
|  | ||||
| "..\..\oqtane.framework\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% | ||||
| chmod +x ../../oqtane.framework/Oqtane.Package/nuget.exe | ||||
| # "../../oqtane.framework/Oqtane.Package/nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% | ||||
| detnet nuget pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName% | ||||
|  | ||||
| cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\" | ||||
| @ -40,19 +40,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager | ||||
|         { | ||||
|             // TODO: Export event Responses as well. | ||||
|             string content = ""; | ||||
|             List<object> exportData = new List<object>(); | ||||
|             foreach (var events in _EventRepository.GetEvents(module.ModuleId)) | ||||
|             List<Models.Event> EventRegistrations = _EventRepository.GetEvents(module.ModuleId).ToList(); | ||||
|             if (EventRegistrations != null) | ||||
|             { | ||||
|                 var responses = _ResponseRepository.GetResponses(events.EventId, module.ModuleId); | ||||
|                 exportData.Add(new | ||||
|                 { | ||||
|                     Event = events, | ||||
|                     Responses = responses.ToList() | ||||
|                 }); | ||||
|             }; | ||||
|             if (exportData != null) | ||||
|             { | ||||
|                 content = JsonSerializer.Serialize(exportData); | ||||
|                 content = JsonSerializer.Serialize(EventRegistrations); | ||||
|             } | ||||
|             return content; | ||||
|         } | ||||
|  | ||||
| @ -1,27 +0,0 @@ | ||||
| using Microsoft.EntityFrameworkCore.Infrastructure; | ||||
| using Microsoft.EntityFrameworkCore.Migrations; | ||||
| using Oqtane.Databases.Interfaces; | ||||
| using Oqtane.Migrations; | ||||
| using System; | ||||
| using SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilders; | ||||
| using SZUAbsolventenverein.Module.EventRegistration.Repository; | ||||
|  | ||||
| namespace SZUAbsolventenverein.Module.EventRegistration.Migrations | ||||
| { | ||||
|     [DbContext(typeof(EventRegistrationContext))] | ||||
|     [Migration("SZUAbsolventenverein.Module.EventRegistration.01.00.00.05")] | ||||
|     public class AddDescriptionDateTimeLocation : MultiDatabaseMigration | ||||
|     { | ||||
|         public AddDescriptionDateTimeLocation(IDatabase database) : base(database) | ||||
|         { | ||||
|         } | ||||
|  | ||||
|         protected override void Up(MigrationBuilder migrationBuilder) | ||||
|         { | ||||
|             var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); | ||||
|             entityBuilder.AddMaxStringColumn("Description", false, true, ""); // Contents for RichTextEditor | ||||
|             entityBuilder.AddDateTimeColumn("EventDate", false, new DateTime()); // DateTime for the event | ||||
|             entityBuilder.AddStringColumn("Location", 100, false, true, ""); // Location of the event | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -17,19 +17,15 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services | ||||
|     { | ||||
|         private readonly IEventRepository _EventRepository; | ||||
|         private readonly IResponseRepository _ResponseRepository; | ||||
|         private readonly INotificationRepository _NotificationRepository; | ||||
|         private readonly IUserRepository _UserRepository; | ||||
|         private readonly IUserPermissions _userPermissions; | ||||
|         private readonly ILogManager _logger; | ||||
|         private readonly IHttpContextAccessor _accessor; | ||||
|         private readonly Alias _alias; | ||||
|  | ||||
|         public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, INotificationRepository NotificationRepository, IUserRepository UserRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) | ||||
|         public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) | ||||
|         { | ||||
|             _EventRepository = EventRepository; | ||||
|             _ResponseRepository = ResponseRepository; | ||||
|             _NotificationRepository = NotificationRepository; | ||||
|             _UserRepository = UserRepository; | ||||
|             _userPermissions = userPermissions; | ||||
|             _logger = logger; | ||||
|             _accessor = accessor; | ||||
| @ -56,12 +52,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services | ||||
|             if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, Response.ModuleId, PermissionNames.View)) | ||||
|             { | ||||
|                 Response = _ResponseRepository.AddResponse(Response); | ||||
|  | ||||
|                 Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId); | ||||
|                 string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' Registriert worden." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; | ||||
|                 string body = "Hier kann man die Infos des Events hineinpacken (HTML ist erlaubt)"; | ||||
|                 SendEventResponseNotification(subject, body); | ||||
|  | ||||
|                 _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); | ||||
|             } | ||||
|             else | ||||
| @ -78,12 +68,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services | ||||
|             if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, Response.ModuleId, PermissionNames.View)) | ||||
|             { | ||||
|                 Response = _ResponseRepository.UpdateResponse(Response); | ||||
|  | ||||
|                 Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId); | ||||
|                 string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' Registriert worden." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; | ||||
|                 string body = "Hier kann man die Infos des Events hineinpacken (HTML ist erlaubt)"; | ||||
|                 SendEventResponseNotification(subject, body); | ||||
|                  | ||||
|                 _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); | ||||
|             } | ||||
|             else | ||||
| @ -227,11 +211,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services | ||||
|  | ||||
|         }*/ | ||||
|  | ||||
|         private void SendEventResponseNotification(string subject, string body) | ||||
|         { | ||||
|             User user = _UserRepository.GetUser(_accessor.HttpContext.User.UserId()); | ||||
|             Notification notification = new Notification(_alias.SiteId, user, subject, body); | ||||
|             _NotificationRepository.AddNotification(notification); | ||||
|         } | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -13,10 +13,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Models | ||||
|         public int ModuleId { get; set; } | ||||
|         public string Name { get; set; } | ||||
|  | ||||
|         public string Description { get; set; } | ||||
|         public DateTime EventDate { get; set; } | ||||
|         public string Location { get; set; } | ||||
|  | ||||
|         public string CreatedBy { get; set; } | ||||
|         public DateTime CreatedOn { get; set; } | ||||
|         public string ModifiedBy { get; set; } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	