Skip to content

Commit

Permalink
Remove event registration (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch authored Dec 19, 2023
1 parent 5696b6b commit 1f762ac
Show file tree
Hide file tree
Showing 22 changed files with 694 additions and 1,049 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# Launch and prepare MySQL server
sudo systemctl start mysql.service
dotnet run -c Release --no-build --project server/src/Korga.Server -- database create --populate
dotnet run -c Release --no-build --project server/src/Korga.Server -- database create
- name: Test
run: dotnet test -c Release --no-build --verbosity normal

Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ There is no Web UI available yet to manage distribution lists so you must stick

This command creates a distribution list _[email protected]_ which forwards emails to every member of group #137.

### Event registration

![Three screenshots of Korga's event registration](docs/assets/event_registration_overview.png)

An event registration with multiple programs for each event. The list of participants is public as well as the possibility to delete registrations.

Currently, there is neither an API endpoint nor a graphical user interface available to edit events and programs. Instead you have to write SQL queries.

## Installation

The only officially supported distribution are Docker containers. An official image is available at [daniellerch/korga](https://hub.docker.com/r/daniellerch/korga).
Expand Down
Binary file removed docs/assets/event_registration_overview.png
Binary file not shown.
21 changes: 0 additions & 21 deletions server/src/Korga.Core/DatabaseContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Korga.ChurchTools.Entities;
using Korga.EmailDelivery.Entities;
using Korga.EmailRelay.Entities;
using Korga.EventRegistration.Entities;
using Microsoft.EntityFrameworkCore;

namespace Korga;
Expand All @@ -15,10 +14,6 @@ namespace Korga;
/// </remarks>
public sealed class DatabaseContext : DbContext
{
public DbSet<Event> Events => Set<Event>();
public DbSet<EventProgram> EventPrograms => Set<EventProgram>();
public DbSet<EventParticipant> EventParticipants => Set<EventParticipant>();

public DbSet<Person> People => Set<Person>();
public DbSet<Group> Groups => Set<Group>();
public DbSet<GroupMember> GroupMembers => Set<GroupMember>();
Expand All @@ -43,29 +38,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

CreateEvents(modelBuilder);

CreateChurchTools(modelBuilder);

CreateEmailRelay(modelBuilder);

CreateEmailDelivery(modelBuilder);
}

private void CreateEvents(ModelBuilder modelBuilder)
{
var @event = modelBuilder.Entity<Event>();
@event.HasKey(e => e.Id);

var program = modelBuilder.Entity<EventProgram>();
program.HasKey(p => p.Id);
program.HasOne(p => p.Event).WithMany().HasForeignKey(p => p.EventId);

var participant = modelBuilder.Entity<EventParticipant>();
participant.HasKey(p => p.Id);
participant.HasOne(p => p.Program).WithMany(p => p.Participants).HasForeignKey(p => p.ProgramId);
}

private void CreateChurchTools(ModelBuilder modelBuilder)
{
var person = modelBuilder.Entity<Person>();
Expand Down
12 changes: 0 additions & 12 deletions server/src/Korga.Core/EventRegistration/Entities/Event.cs

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions server/src/Korga.Core/EventRegistration/Entities/EventProgram.cs

This file was deleted.

35 changes: 2 additions & 33 deletions server/src/Korga.Server/Commands/DatabaseCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Korga.EventRegistration.Entities;
using McMaster.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;

Expand All @@ -9,7 +8,7 @@
namespace Korga.Server.Commands;

[Command("database")]
[Subcommand(typeof(Migrate), typeof(Create), typeof(Delete), typeof(Populate))]
[Subcommand(typeof(Migrate), typeof(Create), typeof(Delete))]
public class DatabaseCommand
{
private const string populateDescription = "Fills an existing database with example data for testing.";
Expand All @@ -35,16 +34,11 @@ public class Create
[Option(Description = "Forces a recreation of the database")]
public bool Force { get; set; }

[Option(Description = populateDescription)]
public bool Populate { get; set; }

private async Task OnExecute(CommandLineApplication app, DatabaseContext database)
{
if (Force) await DeleteDatabase(app, database);

await database.Database.EnsureCreatedAsync();

if (Populate) await PopulateDatabase(database);
}
}

Expand All @@ -54,12 +48,6 @@ public class Delete
private Task OnExecute(CommandLineApplication app, DatabaseContext database) => DeleteDatabase(app, database);
}

[Command("populate", Description = populateDescription)]
public class Populate
{
private Task OnExecute(DatabaseContext database) => PopulateDatabase(database);
}

private static async Task DeleteDatabase(CommandLineApplication app, DatabaseContext database)
{
if (Prompt.GetYesNo("Do you really want to delete the Korga database?", false))
Expand All @@ -68,23 +56,4 @@ private static async Task DeleteDatabase(CommandLineApplication app, DatabaseCon
if (!deleted) app.Error.WriteLine("Notice: No database found to delete.");
}
}

private static async Task PopulateDatabase(DatabaseContext database)
{
// Create two services as events
var service10 = new Event("Gottesdienst am 06.03. um 10 Uhr");
var service12 = new Event("Gottesdienst am 06.03. um 12 Uhr");
database.Events.AddRange(service10, service12);
await database.SaveChangesAsync();

// Create children's ministry as programs
var program10_0 = new EventProgram("Gottesdienst") { EventId = service10.Id, Limit = 65 };
var program10_1 = new EventProgram("Kükennest (0-3 Jahre)") { EventId = service10.Id, Limit = 5 };
var program10_2 = new EventProgram("Kindergartenkinder") { EventId = service10.Id, Limit = 12 };
var program10_3 = new EventProgram("Grundschulkinder") { EventId = service10.Id, Limit = 12 };
var program10_4 = new EventProgram("Weiterführende Schule") { EventId = service10.Id, Limit = 12 };
var program12_0 = new EventProgram("Gottesdienst") { EventId = service12.Id, Limit = 65 };
database.EventPrograms.AddRange(program10_0, program10_1, program10_2, program10_3, program10_4, program12_0);
await database.SaveChangesAsync();
}
}
114 changes: 0 additions & 114 deletions server/src/Korga.Server/Controllers/EventController.cs

This file was deleted.

Loading

0 comments on commit 1f762ac

Please sign in to comment.