diff --git a/src/Turnierplan.App/Client/src/app/portal/pages/view-organization/view-organization.component.ts b/src/Turnierplan.App/Client/src/app/portal/pages/view-organization/view-organization.component.ts index fad6d963..388e01bd 100644 --- a/src/Turnierplan.App/Client/src/app/portal/pages/view-organization/view-organization.component.ts +++ b/src/Turnierplan.App/Client/src/app/portal/pages/view-organization/view-organization.component.ts @@ -52,6 +52,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { filter } from 'rxjs/operators'; import { ResourcePlannerHeaderDto } from '../../../api/models/resource-planner-header-dto'; import { getResourcePlanners } from '../../../api/fn/resource-planners/get-resource-planners'; +import { environment } from '../../../../environments/environment'; @Component({ templateUrl: './view-organization.component.html', @@ -131,11 +132,15 @@ export class ViewOrganizationComponent implements OnInit, OnDestroy { title: 'Portal.ViewOrganization.Pages.TournamentPlanners', icon: 'bi-ticket-perforated' }, - { - id: ViewOrganizationComponent.resourcePlannersPageId, - title: 'Portal.ViewOrganization.Pages.ResourcePlanners', - icon: 'bi-file-earmark-spreadsheet' - }, + ...(environment.featureFlags.resourcePlanners + ? [ + { + id: ViewOrganizationComponent.resourcePlannersPageId, + title: 'Portal.ViewOrganization.Pages.ResourcePlanners', + icon: 'bi-file-earmark-spreadsheet' + } + ] + : []), { id: ViewOrganizationComponent.imagesPageId, title: 'Portal.ViewOrganization.Pages.Images', diff --git a/src/Turnierplan.App/Client/src/app/portal/portal.routes.ts b/src/Turnierplan.App/Client/src/app/portal/portal.routes.ts index 66b66fe0..a65efcc2 100644 --- a/src/Turnierplan.App/Client/src/app/portal/portal.routes.ts +++ b/src/Turnierplan.App/Client/src/app/portal/portal.routes.ts @@ -21,6 +21,7 @@ import { ViewVenueComponent } from './pages/view-venue/view-venue.component'; import { UploadImageComponent } from './pages/upload-image/upload-image.component'; import { CreateResourcePlannerComponent } from './pages/create-resource-planner/create-resource-planner.component'; import { ViewResourcePlannerComponent } from './pages/view-resource-planner/view-resource-planner.component'; +import { environment } from '../../environments/environment'; export const portalRoutes: Routes = [ { @@ -63,10 +64,15 @@ export const portalRoutes: Routes = [ return `organization/${data.params['id']}/create/tournament-planner`; } }, - { - path: 'organization/:id/create/resource-planner', - component: CreateResourcePlannerComponent - }, + ...(environment.featureFlags.resourcePlanners + ? [ + { + path: 'organization/:id/create/resource-planner', + component: CreateResourcePlannerComponent + } + ] + : []), + { path: 'organization/:id/create/tournament-planner', component: CreateTournamentPlannerComponent @@ -85,10 +91,15 @@ export const portalRoutes: Routes = [ return `tournament-planner/${data.params['id']}`; } }, - { - path: 'resource-planner/:id', - component: ViewResourcePlannerComponent - }, + ...(environment.featureFlags.resourcePlanners + ? [ + { + path: 'resource-planner/:id', + component: ViewResourcePlannerComponent + } + ] + : []), + { path: 'tournament-planner/:id', component: ViewTournamentPlannerComponent, diff --git a/src/Turnierplan.App/Client/src/environments/environment.e2e.ts b/src/Turnierplan.App/Client/src/environments/environment.e2e.ts index bafdebcf..13cae281 100644 --- a/src/Turnierplan.App/Client/src/environments/environment.e2e.ts +++ b/src/Turnierplan.App/Client/src/environments/environment.e2e.ts @@ -4,5 +4,8 @@ version: '1.0.0', originOverwrite: undefined, includeE2EData: true, - doUpdatesCheck: false + doUpdatesCheck: false, + featureFlags: { + resourcePlanners: false + } }; diff --git a/src/Turnierplan.App/Client/src/environments/environment.prod.ts b/src/Turnierplan.App/Client/src/environments/environment.prod.ts index b8f80227..13a7c852 100644 --- a/src/Turnierplan.App/Client/src/environments/environment.prod.ts +++ b/src/Turnierplan.App/Client/src/environments/environment.prod.ts @@ -4,5 +4,8 @@ version: '2026.3.0', originOverwrite: undefined, includeE2EData: false, - doUpdatesCheck: true + doUpdatesCheck: true, + featureFlags: { + resourcePlanners: false + } }; diff --git a/src/Turnierplan.App/Client/src/environments/environment.ts b/src/Turnierplan.App/Client/src/environments/environment.ts index 5842c706..191377b3 100644 --- a/src/Turnierplan.App/Client/src/environments/environment.ts +++ b/src/Turnierplan.App/Client/src/environments/environment.ts @@ -4,5 +4,8 @@ export const environment = { version: '0.0.0', originOverwrite: 'http://localhost:45000', includeE2EData: true, - doUpdatesCheck: false + doUpdatesCheck: false, + featureFlags: { + resourcePlanners: true + } }; diff --git a/src/Turnierplan.App/Endpoints/ResourcePlanners/CreateResourcePlannerEndpoint.cs b/src/Turnierplan.App/Endpoints/ResourcePlanners/CreateResourcePlannerEndpoint.cs index 30023e97..6f9bf44a 100644 --- a/src/Turnierplan.App/Endpoints/ResourcePlanners/CreateResourcePlannerEndpoint.cs +++ b/src/Turnierplan.App/Endpoints/ResourcePlanners/CreateResourcePlannerEndpoint.cs @@ -1,3 +1,4 @@ +using System.Net; using FluentValidation; using Microsoft.AspNetCore.Mvc; using Turnierplan.App.Extensions; @@ -18,6 +19,7 @@ internal sealed class CreateResourcePlannerEndpoint : EndpointBase Handle; +#if TP_RESOURCE_PLANNER private static async Task Handle( [FromBody] CreateResourcePlannerEndpointRequest request, IOrganizationRepository organizationRepository, @@ -52,6 +54,12 @@ private static async Task Handle( return Results.Ok(mapper.Map(resourcePlanner)); } +#else + private static IResult Handle([FromBody] CreateResourcePlannerEndpointRequest request) + { + return Results.StatusCode((int)HttpStatusCode.NotImplemented); + } +#endif public sealed record CreateResourcePlannerEndpointRequest { @@ -60,6 +68,7 @@ public sealed record CreateResourcePlannerEndpointRequest public required string Name { get; init; } } +#if TP_RESOURCE_PLANNER internal sealed class Validator : AbstractValidator { public static readonly Validator Instance = new(); @@ -70,4 +79,5 @@ private Validator() .NotEmpty(); } } +#endif } diff --git a/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannerEndpoint.cs b/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannerEndpoint.cs index 67a9282d..ed4c4530 100644 --- a/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannerEndpoint.cs +++ b/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannerEndpoint.cs @@ -1,3 +1,4 @@ +using System.Net; using Microsoft.AspNetCore.Mvc; using Turnierplan.App.Mapping; using Turnierplan.App.Models; @@ -15,6 +16,7 @@ internal sealed class GetResourcePlannerEndpoint : EndpointBase Handle; +#if TP_RESOURCE_PLANNER private static async Task Handle( [FromRoute] PublicId id, IResourcePlannerRepository repository, @@ -37,4 +39,10 @@ private static async Task Handle( return Results.Ok(mapper.Map(resourcePlanner)); } +#else + private static IResult Handle([FromRoute] PublicId id) + { + return Results.StatusCode((int)HttpStatusCode.NotImplemented); + } +#endif } diff --git a/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannersEndpoint.cs b/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannersEndpoint.cs index bdf1b538..b958ab1c 100644 --- a/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannersEndpoint.cs +++ b/src/Turnierplan.App/Endpoints/ResourcePlanners/GetResourcePlannersEndpoint.cs @@ -1,3 +1,4 @@ +using System.Net; using Microsoft.AspNetCore.Mvc; using Turnierplan.App.Mapping; using Turnierplan.App.Models; @@ -15,6 +16,7 @@ internal sealed class GetResourcePlannersEndpoint : EndpointBase Handle; +#if TP_RESOURCE_PLANNER private static async Task Handle( [FromQuery] PublicId organizationId, IOrganizationRepository organizationRepository, @@ -35,4 +37,10 @@ private static async Task Handle( return Results.Ok(mapper.MapCollection(organization.ResourcePlanners)); } +#else + private static IResult Handle([FromQuery] PublicId organizationId) + { + return Results.StatusCode((int)HttpStatusCode.NotImplemented); + } +#endif } diff --git a/src/Turnierplan.App/Endpoints/RoleAssignments/CreateRoleAssignmentEndpoint.cs b/src/Turnierplan.App/Endpoints/RoleAssignments/CreateRoleAssignmentEndpoint.cs index f4bf42b7..f9c89c4a 100644 --- a/src/Turnierplan.App/Endpoints/RoleAssignments/CreateRoleAssignmentEndpoint.cs +++ b/src/Turnierplan.App/Endpoints/RoleAssignments/CreateRoleAssignmentEndpoint.cs @@ -12,7 +12,9 @@ using Turnierplan.Core.Image; using Turnierplan.Core.Organization; using Turnierplan.Core.PublicId; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.RoleAssignment; using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; @@ -52,7 +54,9 @@ private static async Task Handle( "Folder" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), "Image" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), "Organization" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), +#if TP_RESOURCE_PLANNER "ResourcePlanner" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), +#endif "Tournament" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), "TournamentPlanner" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), "Venue" => CreateRoleAssignmentAsync(request, serviceProvider, accessValidator, mapper, targetId, cancellationToken), diff --git a/src/Turnierplan.App/Endpoints/RoleAssignments/DeleteRoleAssignmentEndpoint.cs b/src/Turnierplan.App/Endpoints/RoleAssignments/DeleteRoleAssignmentEndpoint.cs index 1b9f8c36..4f0173c0 100644 --- a/src/Turnierplan.App/Endpoints/RoleAssignments/DeleteRoleAssignmentEndpoint.cs +++ b/src/Turnierplan.App/Endpoints/RoleAssignments/DeleteRoleAssignmentEndpoint.cs @@ -7,7 +7,9 @@ using Turnierplan.Core.Image; using Turnierplan.Core.Organization; using Turnierplan.Core.PublicId; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.RoleAssignment; using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; @@ -47,7 +49,9 @@ private static async Task Handle( "Folder" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), "Image" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), "Organization" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), +#if TP_RESOURCE_PLANNER "ResourcePlanner" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), +#endif "Tournament" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), "TournamentPlanner" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), "Venue" => DeleteRoleAssignmentAsync(serviceProvider, accessValidator, targetId, roleAssignmentGuid, cancellationToken), diff --git a/src/Turnierplan.App/Endpoints/RoleAssignments/GetRoleAssignmentsEndpoint.cs b/src/Turnierplan.App/Endpoints/RoleAssignments/GetRoleAssignmentsEndpoint.cs index 27ad3fe0..31243c99 100644 --- a/src/Turnierplan.App/Endpoints/RoleAssignments/GetRoleAssignmentsEndpoint.cs +++ b/src/Turnierplan.App/Endpoints/RoleAssignments/GetRoleAssignmentsEndpoint.cs @@ -9,7 +9,9 @@ using Turnierplan.Core.Image; using Turnierplan.Core.Organization; using Turnierplan.Core.PublicId; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; using Turnierplan.Core.Venue; @@ -42,7 +44,9 @@ private static async Task Handle( "Folder" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), "Image" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), "Organization" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), +#if TP_RESOURCE_PLANNER "ResourcePlanner" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), +#endif "Tournament" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), "TournamentPlanner" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), "Venue" => GetRoleAssignmentsAsync(serviceProvider, accessValidator, mapper, targetId), diff --git a/src/Turnierplan.App/Helpers/RbacScopeHelper.cs b/src/Turnierplan.App/Helpers/RbacScopeHelper.cs index 8771ae30..9b0c251b 100644 --- a/src/Turnierplan.App/Helpers/RbacScopeHelper.cs +++ b/src/Turnierplan.App/Helpers/RbacScopeHelper.cs @@ -30,6 +30,10 @@ public static bool TryParseScopeId(string scopeId, [NotNullWhen(true)] out strin return true; } +#if TP_RESOURCE_PLANNER [GeneratedRegex("^(?ApiKey|Folder|Image|Organization|ResourcePlanner|Tournament|TournamentPlanner|Venue):(?[A-Za-z0-9_-]{11})$")] +#else + [GeneratedRegex("^(?ApiKey|Folder|Image|Organization|Tournament|TournamentPlanner|Venue):(?[A-Za-z0-9_-]{11})$")] +#endif public static partial Regex ScopeIdRegex(); } diff --git a/src/Turnierplan.App/Mapping/Rules/ResourcePlannerHeaderMappingRule.cs b/src/Turnierplan.App/Mapping/Rules/ResourcePlannerHeaderMappingRule.cs index ecb57e52..8f766c13 100644 --- a/src/Turnierplan.App/Mapping/Rules/ResourcePlannerHeaderMappingRule.cs +++ b/src/Turnierplan.App/Mapping/Rules/ResourcePlannerHeaderMappingRule.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Turnierplan.App.Models; using Turnierplan.Core.ResourcePlanner; @@ -15,3 +17,5 @@ protected override ResourcePlannerHeaderDto Map(IMapper mapper, MappingContext c }; } } + +#endif diff --git a/src/Turnierplan.App/Mapping/Rules/ResourcePlannerMappingRule.cs b/src/Turnierplan.App/Mapping/Rules/ResourcePlannerMappingRule.cs index cc9e1ffb..40600592 100644 --- a/src/Turnierplan.App/Mapping/Rules/ResourcePlannerMappingRule.cs +++ b/src/Turnierplan.App/Mapping/Rules/ResourcePlannerMappingRule.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Turnierplan.App.Helpers; using Turnierplan.App.Models; using Turnierplan.Core.ResourcePlanner; @@ -65,3 +67,5 @@ protected override ResourcePlannerDto Map(IMapper mapper, MappingContext context }; } } + +#endif diff --git a/src/Turnierplan.App/Security/AccessValidator.cs b/src/Turnierplan.App/Security/AccessValidator.cs index 387cf347..bd0c6ec0 100644 --- a/src/Turnierplan.App/Security/AccessValidator.cs +++ b/src/Turnierplan.App/Security/AccessValidator.cs @@ -4,7 +4,9 @@ using Turnierplan.Core.Folder; using Turnierplan.Core.Image; using Turnierplan.Core.PublicId; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.RoleAssignment; using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; @@ -104,7 +106,9 @@ internal static bool IsActionAllowed(IEntityWithRoleAssignments target, Ac ApiKey apiKey => IsActionAllowed(apiKey.Organization, action, principal), Image image => IsActionAllowed(image.Organization, action, principal), Folder folder => IsActionAllowed(folder.Organization, action, principal), +#if TP_RESOURCE_PLANNER ResourcePlanner resourcePlanner => IsActionAllowed(resourcePlanner.Organization, action, principal), +#endif TournamentPlanner tournamentPlanner => IsActionAllowed(tournamentPlanner.Organization, action, principal), Tournament tournament => (tournament.Folder is not null && IsActionAllowed(tournament.Folder, action, principal)) || IsActionAllowed(tournament.Organization, action, principal), Venue venue => IsActionAllowed(venue.Organization, action, principal), @@ -128,9 +132,11 @@ internal static void AddAvailableRoles(IEntityWithRoleAssignments target, case Folder folder: AddAvailableRoles(folder.Organization, rolesList, principal); break; +#if TP_RESOURCE_PLANNER case ResourcePlanner resourcePlanner: AddAvailableRoles(resourcePlanner.Organization, rolesList, principal); break; +#endif case TournamentPlanner tournamentPlanner: AddAvailableRoles(tournamentPlanner.Organization, rolesList, principal); break; diff --git a/src/Turnierplan.Core/Organization/Organization.cs b/src/Turnierplan.Core/Organization/Organization.cs index d9c2f707..c8622a10 100644 --- a/src/Turnierplan.Core/Organization/Organization.cs +++ b/src/Turnierplan.Core/Organization/Organization.cs @@ -9,7 +9,9 @@ public sealed class Organization : Entity, IEntityWithRoleAssignments _apiKeys = []; internal readonly List _folders = []; internal readonly List _images = []; +#if TP_RESOURCE_PLANNER internal readonly List _resourcePlanners = []; +#endif internal readonly List _tournamentPlanners = []; internal readonly List _tournaments = []; internal readonly List _venues = []; @@ -46,7 +48,9 @@ internal Organization(long id, PublicId.PublicId publicId, DateTime createdAt, s public IReadOnlyList Images => _images.AsReadOnly(); +#if TP_RESOURCE_PLANNER public IReadOnlyList ResourcePlanners => _resourcePlanners.AsReadOnly(); +#endif public IReadOnlyList TournamentPlanners => _tournamentPlanners.AsReadOnly(); diff --git a/src/Turnierplan.Core/ResourcePlanner/Resource.cs b/src/Turnierplan.Core/ResourcePlanner/Resource.cs index a2d32f6d..e0451cc2 100644 --- a/src/Turnierplan.Core/ResourcePlanner/Resource.cs +++ b/src/Turnierplan.Core/ResourcePlanner/Resource.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Turnierplan.Core.Entity; using Turnierplan.Core.Exceptions; @@ -53,3 +55,5 @@ public string? Notes } } } + +#endif diff --git a/src/Turnierplan.Core/ResourcePlanner/ResourceAssignment.cs b/src/Turnierplan.Core/ResourcePlanner/ResourceAssignment.cs index 4b31bb13..f592478b 100644 --- a/src/Turnierplan.Core/ResourcePlanner/ResourceAssignment.cs +++ b/src/Turnierplan.Core/ResourcePlanner/ResourceAssignment.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + namespace Turnierplan.Core.ResourcePlanner; public sealed class ResourceAssignment @@ -20,3 +22,5 @@ internal ResourceAssignment(ResourceGroup resourceGroup, Resource resource) public ResourceAssignmentState State { get; set; } } + +#endif diff --git a/src/Turnierplan.Core/ResourcePlanner/ResourceGroup.cs b/src/Turnierplan.Core/ResourcePlanner/ResourceGroup.cs index 4a5faf19..debba64e 100644 --- a/src/Turnierplan.Core/ResourcePlanner/ResourceGroup.cs +++ b/src/Turnierplan.Core/ResourcePlanner/ResourceGroup.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Turnierplan.Core.Entity; using Turnierplan.Core.Exceptions; @@ -156,3 +158,5 @@ public void UnassignResource(ResourceAssignment assignment) _resourceAssignments.Remove(assignment); } } + +#endif diff --git a/src/Turnierplan.Core/ResourcePlanner/ResourcePlanner.cs b/src/Turnierplan.Core/ResourcePlanner/ResourcePlanner.cs index 7001a54e..398507b5 100644 --- a/src/Turnierplan.Core/ResourcePlanner/ResourcePlanner.cs +++ b/src/Turnierplan.Core/ResourcePlanner/ResourcePlanner.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Turnierplan.Core.Entity; using Turnierplan.Core.RoleAssignment; @@ -83,3 +85,5 @@ public void RemoveResourcePlannerView(ResourcePlannerView resourcePlannerView) _resourcePlannerViews.Remove(resourcePlannerView); } } + +#endif diff --git a/src/Turnierplan.Core/ResourcePlanner/ResourcePlannerView.cs b/src/Turnierplan.Core/ResourcePlanner/ResourcePlannerView.cs index f262e50a..434262dc 100644 --- a/src/Turnierplan.Core/ResourcePlanner/ResourcePlannerView.cs +++ b/src/Turnierplan.Core/ResourcePlanner/ResourcePlannerView.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Turnierplan.Core.Entity; using Turnierplan.Core.Exceptions; @@ -63,3 +65,5 @@ public void RemoveResourceGroup(ResourceGroup resourceGroup) _resourceGroups.Remove(resourceGroup); } } + +#endif diff --git a/src/Turnierplan.Dal/EntityConfigurations/OrganizationEntityTypeConfiguration.cs b/src/Turnierplan.Dal/EntityConfigurations/OrganizationEntityTypeConfiguration.cs index 2f82af0a..9d6babd7 100644 --- a/src/Turnierplan.Dal/EntityConfigurations/OrganizationEntityTypeConfiguration.cs +++ b/src/Turnierplan.Dal/EntityConfigurations/OrganizationEntityTypeConfiguration.cs @@ -52,11 +52,13 @@ public void Configure(EntityTypeBuilder builder) .OnDelete(DeleteBehavior.Restrict) .IsRequired(); +#if TP_RESOURCE_PLANNER builder.HasMany(x => x.ResourcePlanners) .WithOne(x => x.Organization) .HasForeignKey("OrganizationId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); +#endif builder.HasMany(x => x.TournamentPlanners) .WithOne(x => x.Organization) @@ -80,7 +82,9 @@ public void Configure(EntityTypeBuilder builder) builder.Metadata.FindNavigation(nameof(Organization.ApiKeys))!.SetPropertyAccessMode(PropertyAccessMode.Field); builder.Metadata.FindNavigation(nameof(Organization.Folders))!.SetPropertyAccessMode(PropertyAccessMode.Field); builder.Metadata.FindNavigation(nameof(Organization.Images))!.SetPropertyAccessMode(PropertyAccessMode.Field); +#if TP_RESOURCE_PLANNER builder.Metadata.FindNavigation(nameof(Organization.ResourcePlanners))!.SetPropertyAccessMode(PropertyAccessMode.Field); +#endif builder.Metadata.FindNavigation(nameof(Organization.TournamentPlanners))!.SetPropertyAccessMode(PropertyAccessMode.Field); builder.Metadata.FindNavigation(nameof(Organization.Tournaments))!.SetPropertyAccessMode(PropertyAccessMode.Field); builder.Metadata.FindNavigation(nameof(Organization.Venues))!.SetPropertyAccessMode(PropertyAccessMode.Field); diff --git a/src/Turnierplan.Dal/EntityConfigurations/ResourceAssignmentEntityTypeConfiguration.cs b/src/Turnierplan.Dal/EntityConfigurations/ResourceAssignmentEntityTypeConfiguration.cs index 1110265a..34aba260 100644 --- a/src/Turnierplan.Dal/EntityConfigurations/ResourceAssignmentEntityTypeConfiguration.cs +++ b/src/Turnierplan.Dal/EntityConfigurations/ResourceAssignmentEntityTypeConfiguration.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Turnierplan.Core.ResourcePlanner; @@ -16,3 +18,5 @@ public void Configure(EntityTypeBuilder builder) .IsRequired(); } } + +#endif diff --git a/src/Turnierplan.Dal/EntityConfigurations/ResourceEntityTypeConfiguration.cs b/src/Turnierplan.Dal/EntityConfigurations/ResourceEntityTypeConfiguration.cs index bf036ffe..13925501 100644 --- a/src/Turnierplan.Dal/EntityConfigurations/ResourceEntityTypeConfiguration.cs +++ b/src/Turnierplan.Dal/EntityConfigurations/ResourceEntityTypeConfiguration.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Turnierplan.Core.ResourcePlanner; @@ -30,3 +32,5 @@ public void Configure(EntityTypeBuilder builder) .IsRequired(); } } + +#endif diff --git a/src/Turnierplan.Dal/EntityConfigurations/ResourceGroupEntityTypeConfiguration.cs b/src/Turnierplan.Dal/EntityConfigurations/ResourceGroupEntityTypeConfiguration.cs index 08a47662..d89f7f09 100644 --- a/src/Turnierplan.Dal/EntityConfigurations/ResourceGroupEntityTypeConfiguration.cs +++ b/src/Turnierplan.Dal/EntityConfigurations/ResourceGroupEntityTypeConfiguration.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Turnierplan.Core.ResourcePlanner; @@ -35,3 +37,5 @@ public void Configure(EntityTypeBuilder builder) builder.Metadata.FindNavigation(nameof(ResourceGroup.ResourceAssignments))!.SetPropertyAccessMode(PropertyAccessMode.Field); } } + +#endif diff --git a/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerEntityTypeConfiguration.cs b/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerEntityTypeConfiguration.cs index 9cecc856..865e12e4 100644 --- a/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerEntityTypeConfiguration.cs +++ b/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerEntityTypeConfiguration.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Turnierplan.Core.ResourcePlanner; @@ -51,3 +53,5 @@ public void Configure(EntityTypeBuilder builder) builder.Metadata.FindNavigation(nameof(ResourcePlanner.ResourcePlannerViews))!.SetPropertyAccessMode(PropertyAccessMode.Field); } } + +#endif diff --git a/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerViewEntityTypeConfiguration.cs b/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerViewEntityTypeConfiguration.cs index b82ed9e7..fa639146 100644 --- a/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerViewEntityTypeConfiguration.cs +++ b/src/Turnierplan.Dal/EntityConfigurations/ResourcePlannerViewEntityTypeConfiguration.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Turnierplan.Core.ResourcePlanner; @@ -29,3 +31,5 @@ public void Configure(EntityTypeBuilder builder) .WithMany(); } } + +#endif diff --git a/src/Turnierplan.Dal/Extensions/ServiceCollectionExtensions.cs b/src/Turnierplan.Dal/Extensions/ServiceCollectionExtensions.cs index 5f41a85a..05bc7e73 100644 --- a/src/Turnierplan.Dal/Extensions/ServiceCollectionExtensions.cs +++ b/src/Turnierplan.Dal/Extensions/ServiceCollectionExtensions.cs @@ -9,7 +9,9 @@ using Turnierplan.Core.Folder; using Turnierplan.Core.Image; using Turnierplan.Core.Organization; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; using Turnierplan.Core.Venue; @@ -56,7 +58,9 @@ public static void AddTurnierplanDataAccessLayer(this IServiceCollection service services.AddScoped(); services.AddScoped(); services.AddScoped(); +#if TP_RESOURCE_PLANNER services.AddScoped(); +#endif services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -68,7 +72,9 @@ public static void AddTurnierplanDataAccessLayer(this IServiceCollection service services.AddScoped>(sp => sp.GetRequiredService()); services.AddScoped>(sp => sp.GetRequiredService()); services.AddScoped>(sp => sp.GetRequiredService()); +#if TP_RESOURCE_PLANNER services.AddScoped>(sp => sp.GetRequiredService()); +#endif services.AddScoped>(sp => sp.GetRequiredService()); services.AddScoped>(sp => sp.GetRequiredService()); services.AddScoped>(sp => sp.GetRequiredService()); @@ -77,7 +83,9 @@ public static void AddTurnierplanDataAccessLayer(this IServiceCollection service services.AddScoped, FolderRoleAssignmentRepository>(); services.AddScoped, ImageRoleAssignmentRepository>(); services.AddScoped, OrganizationRoleAssignmentRepository>(); +#if TP_RESOURCE_PLANNER services.AddScoped, ResourcePlannerRoleAssignmentRepository>(); +#endif services.AddScoped, TournamentRoleAssignmentRepository>(); services.AddScoped, TournamentPlannerRoleAssignmentRepository>(); services.AddScoped, VenueRoleAssignmentRepository>(); @@ -86,7 +94,9 @@ public static void AddTurnierplanDataAccessLayer(this IServiceCollection service services.AddScoped(sp => sp.GetRequiredService>()); services.AddScoped(sp => sp.GetRequiredService>()); services.AddScoped(sp => sp.GetRequiredService>()); +#if TP_RESOURCE_PLANNER services.AddScoped(sp => sp.GetRequiredService>()); +#endif services.AddScoped(sp => sp.GetRequiredService>()); services.AddScoped(sp => sp.GetRequiredService>()); services.AddScoped(sp => sp.GetRequiredService>()); diff --git a/src/Turnierplan.Dal/Migrations/20260717182006_Add_ResourcePlanner.Designer.cs b/src/Turnierplan.Dal/Migrations/20260717182006_Add_ResourcePlanner.Designer.cs deleted file mode 100644 index bbf5e99f..00000000 --- a/src/Turnierplan.Dal/Migrations/20260717182006_Add_ResourcePlanner.Designer.cs +++ /dev/null @@ -1,2167 +0,0 @@ -// -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Turnierplan.Dal; - -#nullable disable - -namespace Turnierplan.Dal.Migrations -{ - [DbContext(typeof(TurnierplanContext))] - [Migration("20260717182006_Add_ResourcePlanner")] - partial class Add_ResourcePlanner - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ApplicationTeamLabel", b => - { - b.Property("ApplicationTeamId") - .HasColumnType("bigint"); - - b.Property("LabelsId") - .HasColumnType("bigint"); - - b.HasKey("ApplicationTeamId", "LabelsId"); - - b.HasIndex("LabelsId"); - - b.ToTable("ApplicationTeamLabel", "turnierplan"); - }); - - modelBuilder.Entity("ResourceGroupResourcePlannerView", b => - { - b.Property("ResourceGroupsId") - .HasColumnType("bigint"); - - b.Property("ResourcePlannerViewId") - .HasColumnType("bigint"); - - b.HasKey("ResourceGroupsId", "ResourcePlannerViewId"); - - b.HasIndex("ResourcePlannerViewId"); - - b.ToTable("ResourceGroupResourcePlannerView", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PrincipalId") - .HasColumnType("uuid"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("SecretHash") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PrincipalId") - .IsUnique(); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("ApiKeys", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKeyRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApiKeyId") - .HasColumnType("bigint"); - - b.Property("Path") - .IsRequired() - .HasColumnType("text"); - - b.Property("Timestamp") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ApiKeyId"); - - b.HasIndex("Timestamp"); - - b.ToTable("ApiKeyRequests", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Document.Document", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Configuration") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GenerationCount") - .HasColumnType("integer"); - - b.Property("LastGeneration") - .HasColumnType("timestamp with time zone"); - - b.Property("LastModifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.Property("Type") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.HasIndex("TournamentId"); - - b.ToTable("Documents", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Folder.Folder", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("Folders", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Image.Image", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FileExtension") - .IsRequired() - .HasColumnType("text"); - - b.Property("FileSize") - .HasColumnType("bigint"); - - b.Property("Height") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("ResourceIdentifier") - .HasColumnType("uuid"); - - b.Property("Width") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.HasIndex("ResourceIdentifier") - .IsUnique(); - - b.ToTable("Images", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Organization.Organization", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("Organizations", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.Resource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Notes") - .HasColumnType("text"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.Property("Type") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("Resources", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceAssignment", b => - { - b.Property("ResourceGroupId") - .HasColumnType("bigint"); - - b.Property("ResourceId") - .HasColumnType("bigint"); - - b.Property("State") - .HasColumnType("integer"); - - b.HasKey("ResourceGroupId", "ResourceId"); - - b.HasIndex("ResourceId"); - - b.ToTable("ResourceAssignments", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("End") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.Property("Start") - .HasColumnType("timestamp with time zone"); - - b.Property("Type") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("ResourceGroups", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlanner", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("ResourcePlanners", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlannerView", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DisplayAllGroups") - .HasColumnType("boolean"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("ResourcePlannerViews", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ApiKeyId") - .HasColumnType("bigint"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ApiKeyId"); - - b.ToTable("IAM_ApiKey", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FolderId") - .HasColumnType("bigint"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("FolderId"); - - b.ToTable("IAM_Folder", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ImageId") - .HasColumnType("bigint"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ImageId"); - - b.ToTable("IAM_Image", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.ToTable("IAM_Organization", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("IAM_ResourcePlanner", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("TournamentId"); - - b.ToTable("IAM_Tournament", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PlanningRealmId") - .HasColumnType("bigint"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("PlanningRealmId"); - - b.ToTable("IAM_PlanningRealm", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("Role") - .HasColumnType("integer"); - - b.Property("VenueId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("VenueId"); - - b.ToTable("IAM_Venue", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Group", b => - { - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.Property("Id") - .HasColumnType("integer"); - - b.Property("AlphabeticalId") - .HasColumnType("character(1)"); - - b.Property("DisplayName") - .HasColumnType("text"); - - b.HasKey("TournamentId", "Id"); - - b.ToTable("Groups", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.GroupParticipant", b => - { - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.Property("GroupId") - .HasColumnType("integer"); - - b.Property("TeamId") - .HasColumnType("integer"); - - b.Property("Order") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.HasKey("TournamentId", "GroupId", "TeamId"); - - b.HasIndex("TournamentId", "TeamId"); - - b.ToTable("GroupParticipants", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Match", b => - { - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.Property("Id") - .HasColumnType("integer"); - - b.Property("Court") - .HasColumnType("smallint"); - - b.Property("FinalsRound") - .HasColumnType("integer"); - - b.Property("GroupId") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("IsCurrentlyPlaying") - .HasColumnType("boolean"); - - b.Property("Kickoff") - .HasColumnType("timestamp with time zone"); - - b.Property("OutcomeType") - .HasColumnType("integer"); - - b.Property("PlayoffPosition") - .HasColumnType("integer"); - - b.Property("ScoreA") - .HasColumnType("integer"); - - b.Property("ScoreB") - .HasColumnType("integer"); - - b.Property("TeamSelectorA") - .IsRequired() - .HasColumnType("text"); - - b.Property("TeamSelectorB") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("TournamentId", "Id"); - - b.HasIndex("TournamentId", "GroupId"); - - b.ToTable("Matches", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.RankingOverwrite", b => - { - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.Property("Id") - .HasColumnType("integer"); - - b.Property("AssignTeamId") - .HasColumnType("integer"); - - b.Property("AssignTeamTournamentId") - .HasColumnType("bigint"); - - b.Property("HideRanking") - .HasColumnType("boolean"); - - b.Property("PlacementRank") - .HasColumnType("integer"); - - b.HasKey("TournamentId", "Id"); - - b.HasIndex("AssignTeamTournamentId", "AssignTeamId"); - - b.ToTable("RankingOverwrites", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Team", b => - { - b.Property("TournamentId") - .HasColumnType("bigint"); - - b.Property("Id") - .HasColumnType("integer"); - - b.Property("EntryFeePaidAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OutOfCompetition") - .HasColumnType("boolean"); - - b.HasKey("TournamentId", "Id"); - - b.ToTable("Teams", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Tournament", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("BannerImageId") - .HasColumnType("bigint"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FolderId") - .HasColumnType("bigint"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PrimaryLogoId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("PublicPageViews") - .HasColumnType("integer"); - - b.Property("SecondaryLogoId") - .HasColumnType("bigint"); - - b.Property("VenueId") - .HasColumnType("bigint"); - - b.Property("Visibility") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BannerImageId"); - - b.HasIndex("FolderId"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PrimaryLogoId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.HasIndex("SecondaryLogoId"); - - b.HasIndex("VenueId"); - - b.ToTable("Tournaments", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.Application", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Comment") - .HasColumnType("text"); - - b.Property("Contact") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContactEmail") - .HasColumnType("text"); - - b.Property("ContactTelephone") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FormSession") - .HasColumnType("uuid"); - - b.Property("Notes") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlanningRealmId") - .HasColumnType("bigint"); - - b.Property("SourceLinkId") - .HasColumnType("bigint"); - - b.Property("Tag") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("FormSession") - .IsUnique(); - - b.HasIndex("PlanningRealmId"); - - b.HasIndex("SourceLinkId"); - - b.ToTable("Applications", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.ApplicationChangeLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApplicationId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .HasColumnType("timestamp with time zone"); - - b.Property("Type") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationId"); - - b.ToTable("ApplicationChangeLogs", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.ApplicationTeam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApplicationId") - .HasColumnType("bigint"); - - b.Property("ClassId") - .HasColumnType("bigint"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationId"); - - b.HasIndex("ClassId"); - - b.ToTable("ApplicationTeams", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.InvitationLink", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ColorCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("ContactEmail") - .HasColumnType("text"); - - b.Property("ContactPerson") - .HasColumnType("text"); - - b.Property("ContactTelephone") - .HasColumnType("text"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlanningRealmId") - .HasColumnType("bigint"); - - b.Property("PrimaryLogoId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("SecondaryLogoId") - .HasColumnType("bigint"); - - b.Property("Title") - .HasColumnType("text"); - - b.Property("ValidUntil") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("PlanningRealmId"); - - b.HasIndex("PrimaryLogoId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.HasIndex("SecondaryLogoId"); - - b.ToTable("InvitationLinks", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.InvitationLinkEntry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AllowNewRegistrations") - .HasColumnType("boolean"); - - b.Property("ClassId") - .HasColumnType("bigint"); - - b.Property("InvitationLinkId") - .HasColumnType("bigint"); - - b.Property("MaxTeamsPerRegistration") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ClassId"); - - b.HasIndex("InvitationLinkId"); - - b.ToTable("InvitationLinkEntries", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.Label", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ColorCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlanningRealmId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("PlanningRealmId"); - - b.ToTable("Labels", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TeamLink", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApplicationTeamId") - .HasColumnType("bigint"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("TeamId") - .HasColumnType("integer"); - - b.Property("TeamTournamentId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationTeamId") - .IsUnique(); - - b.HasIndex("TeamTournamentId", "TeamId") - .IsUnique(); - - b.ToTable("TeamLinks", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TournamentClass", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlanningRealmId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("PlanningRealmId"); - - b.ToTable("TournamentClasses", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TournamentPlanner", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("PlanningRealms", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.User.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AllowCreateOrganization") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EMail") - .HasColumnType("text"); - - b.Property("FullName") - .HasColumnType("text"); - - b.Property("IsAdministrator") - .HasColumnType("boolean"); - - b.Property("LastLogin") - .HasColumnType("timestamp with time zone"); - - b.Property("LastPasswordChange") - .HasColumnType("timestamp with time zone"); - - b.Property("NormalizedEMail") - .HasColumnType("text"); - - b.Property("NormalizedUserName") - .IsRequired() - .HasColumnType("text"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("PrincipalId") - .HasColumnType("uuid"); - - b.Property("SecurityStamp") - .HasColumnType("uuid"); - - b.Property("UserName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEMail") - .IsUnique(); - - b.HasIndex("NormalizedUserName") - .IsUnique(); - - b.HasIndex("PrincipalId") - .IsUnique(); - - b.ToTable("Users", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.Venue.Venue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.PrimitiveCollection>("AddressDetails") - .IsRequired() - .HasColumnType("text[]"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.PrimitiveCollection>("ExternalLinks") - .IsRequired() - .HasColumnType("text[]"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("Venues", "turnierplan"); - }); - - modelBuilder.Entity("ApplicationTeamLabel", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.ApplicationTeam", null) - .WithMany() - .HasForeignKey("ApplicationTeamId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.TournamentPlanner.Label", null) - .WithMany() - .HasForeignKey("LabelsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("ResourceGroupResourcePlannerView", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourceGroup", null) - .WithMany() - .HasForeignKey("ResourceGroupsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlannerView", null) - .WithMany() - .HasForeignKey("ResourcePlannerViewId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKey", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("ApiKeys") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKeyRequest", b => - { - b.HasOne("Turnierplan.Core.ApiKey.ApiKey", "ApiKey") - .WithMany("Requests") - .HasForeignKey("ApiKeyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ApiKey"); - }); - - modelBuilder.Entity("Turnierplan.Core.Document.Document", b => - { - b.HasOne("Turnierplan.Core.Tournament.Tournament", "Tournament") - .WithMany("Documents") - .HasForeignKey("TournamentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tournament"); - }); - - modelBuilder.Entity("Turnierplan.Core.Folder.Folder", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("Folders") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.Image.Image", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("Images") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.Resource", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "ResourcePlanner") - .WithMany() - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResourcePlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceAssignment", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourceGroup", "ResourceGroup") - .WithMany("ResourceAssignments") - .HasForeignKey("ResourceGroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.ResourcePlanner.Resource", "Resource") - .WithMany() - .HasForeignKey("ResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Resource"); - - b.Navigation("ResourceGroup"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceGroup", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "ResourcePlanner") - .WithMany("ResourceGroups") - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResourcePlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlanner", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("ResourcePlanners") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlannerView", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "ResourcePlanner") - .WithMany("ResourcePlannerViews") - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResourcePlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.ApiKey.ApiKey", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("ApiKeyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.Folder.Folder", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("FolderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.Image.Image", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("ImageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.Tournament.Tournament", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("TournamentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentPlanner", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("PlanningRealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.Venue.Venue", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("VenueId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Group", b => - { - b.HasOne("Turnierplan.Core.Tournament.Tournament", null) - .WithMany("Groups") - .HasForeignKey("TournamentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.GroupParticipant", b => - { - b.HasOne("Turnierplan.Core.Tournament.Group", "Group") - .WithMany("Participants") - .HasForeignKey("TournamentId", "GroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.Tournament.Team", "Team") - .WithMany() - .HasForeignKey("TournamentId", "TeamId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Group"); - - b.Navigation("Team"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Match", b => - { - b.HasOne("Turnierplan.Core.Tournament.Tournament", null) - .WithMany("Matches") - .HasForeignKey("TournamentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.Tournament.Group", "Group") - .WithMany() - .HasForeignKey("TournamentId", "GroupId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Group"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.RankingOverwrite", b => - { - b.HasOne("Turnierplan.Core.Tournament.Tournament", null) - .WithMany("RankingOverwrites") - .HasForeignKey("TournamentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.Tournament.Team", "AssignTeam") - .WithMany() - .HasForeignKey("AssignTeamTournamentId", "AssignTeamId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("AssignTeam"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Team", b => - { - b.HasOne("Turnierplan.Core.Tournament.Tournament", "Tournament") - .WithMany("Teams") - .HasForeignKey("TournamentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tournament"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Tournament", b => - { - b.HasOne("Turnierplan.Core.Image.Image", "BannerImage") - .WithMany() - .HasForeignKey("BannerImageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Turnierplan.Core.Folder.Folder", "Folder") - .WithMany("Tournaments") - .HasForeignKey("FolderId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("Tournaments") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Turnierplan.Core.Image.Image", "PrimaryLogo") - .WithMany() - .HasForeignKey("PrimaryLogoId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Turnierplan.Core.Image.Image", "SecondaryLogo") - .WithMany() - .HasForeignKey("SecondaryLogoId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Turnierplan.Core.Venue.Venue", "Venue") - .WithMany("Tournaments") - .HasForeignKey("VenueId") - .OnDelete(DeleteBehavior.SetNull); - - b.OwnsOne("Turnierplan.Core.Tournament.ComputationConfiguration", "ComputationConfiguration", b1 => - { - b1.Property("TournamentId"); - - b1.PrimitiveCollection("ComparisonModes") - .IsRequired() - .HasJsonPropertyName("cmp"); - - b1.Property("HigherScoreLoses") - .HasJsonPropertyName("r"); - - b1.Property("MatchDrawnPoints") - .HasJsonPropertyName("d"); - - b1.Property("MatchLostPoints") - .HasJsonPropertyName("l"); - - b1.Property("MatchWonPoints") - .HasJsonPropertyName("w"); - - b1.HasKey("TournamentId"); - - b1.ToTable("Tournaments", "turnierplan"); - - b1.ToJson("ComputationConfiguration"); - - b1.WithOwner() - .HasForeignKey("TournamentId"); - }); - - b.OwnsOne("Turnierplan.Core.Tournament.MatchPlanConfiguration", "MatchPlanConfiguration", b1 => - { - b1.Property("TournamentId"); - - b1.HasKey("TournamentId"); - - b1.ToTable("Tournaments", "turnierplan"); - - b1.ToJson("MatchPlanConfiguration"); - - b1.WithOwner() - .HasForeignKey("TournamentId"); - - b1.OwnsOne("Turnierplan.Core.Tournament.FinalsRoundConfig", "FinalsRoundConfig", b2 => - { - b2.Property("MatchPlanConfigurationTournamentId"); - - b2.Property("EnableThirdPlacePlayoff") - .HasJsonPropertyName("3rd"); - - b2.Property("FirstFinalsRoundOrder") - .HasJsonPropertyName("fo"); - - b2.PrimitiveCollection("TeamSelectors") - .HasJsonPropertyName("ts"); - - b2.HasKey("MatchPlanConfigurationTournamentId"); - - b2.ToTable("Tournaments", "turnierplan"); - - b2.HasJsonPropertyName("fr"); - - b2.WithOwner() - .HasForeignKey("MatchPlanConfigurationTournamentId"); - - b2.OwnsMany("Turnierplan.Core.Tournament.AdditionalPlayoffConfig", "AdditionalPlayoffs", b3 => - { - b3.Property("FinalsRoundConfigMatchPlanConfigurationTournamentId"); - - b3.Property("__synthesizedOrdinal") - .ValueGeneratedOnAdd(); - - b3.Property("PlayoffPosition") - .HasJsonPropertyName("p"); - - b3.Property("TeamSelectorA") - .IsRequired() - .HasJsonPropertyName("a"); - - b3.Property("TeamSelectorB") - .IsRequired() - .HasJsonPropertyName("b"); - - b3.HasKey("FinalsRoundConfigMatchPlanConfigurationTournamentId", "__synthesizedOrdinal"); - - b3.ToTable("Tournaments", "turnierplan"); - - b3.HasJsonPropertyName("ap"); - - b3.WithOwner() - .HasForeignKey("FinalsRoundConfigMatchPlanConfigurationTournamentId"); - }); - - b2.Navigation("AdditionalPlayoffs"); - }); - - b1.OwnsOne("Turnierplan.Core.Tournament.GroupRoundConfig", "GroupRoundConfig", b2 => - { - b2.Property("MatchPlanConfigurationTournamentId"); - - b2.Property("GroupMatchOrder") - .HasJsonPropertyName("o"); - - b2.Property("GroupPhaseRounds") - .HasJsonPropertyName("r"); - - b2.HasKey("MatchPlanConfigurationTournamentId"); - - b2.ToTable("Tournaments", "turnierplan"); - - b2.HasJsonPropertyName("gr"); - - b2.WithOwner() - .HasForeignKey("MatchPlanConfigurationTournamentId"); - }); - - b1.OwnsOne("Turnierplan.Core.Tournament.ScheduleConfig", "ScheduleConfig", b2 => - { - b2.Property("MatchPlanConfigurationTournamentId"); - - b2.Property("FinalsPhaseNumberOfCourts") - .HasJsonPropertyName("fc"); - - b2.Property("FinalsPhasePauseTime") - .HasJsonPropertyName("fp"); - - b2.Property("FinalsPhasePlayTime") - .HasJsonPropertyName("fd"); - - b2.Property("FirstMatchKickoff") - .HasJsonPropertyName("f"); - - b2.Property("GroupPhaseNumberOfCourts") - .HasJsonPropertyName("gc"); - - b2.Property("GroupPhasePauseTime") - .HasJsonPropertyName("gp"); - - b2.Property("GroupPhasePlayTime") - .HasJsonPropertyName("gd"); - - b2.Property("PauseBetweenGroupAndFinalsPhase") - .HasJsonPropertyName("p"); - - b2.HasKey("MatchPlanConfigurationTournamentId"); - - b2.ToTable("Tournaments", "turnierplan"); - - b2.HasJsonPropertyName("sc"); - - b2.WithOwner() - .HasForeignKey("MatchPlanConfigurationTournamentId"); - }); - - b1.Navigation("FinalsRoundConfig"); - - b1.Navigation("GroupRoundConfig"); - - b1.Navigation("ScheduleConfig"); - }); - - b.OwnsOne("Turnierplan.Core.Tournament.PresentationConfiguration", "PresentationConfiguration", b1 => - { - b1.Property("TournamentId"); - - b1.Property("ShowPrimaryLogo") - .HasJsonPropertyName("ol"); - - b1.Property("ShowResults") - .HasJsonPropertyName("o"); - - b1.Property("ShowSecondaryLogo") - .HasJsonPropertyName("sl"); - - b1.HasKey("TournamentId"); - - b1.ToTable("Tournaments", "turnierplan"); - - b1.ToJson("PresentationConfiguration"); - - b1.WithOwner() - .HasForeignKey("TournamentId"); - - b1.OwnsOne("Turnierplan.Core.Tournament.PresentationConfiguration+HeaderLine", "Header1", b2 => - { - b2.Property("PresentationConfigurationTournamentId"); - - b2.Property("Content") - .HasJsonPropertyName("c"); - - b2.Property("CustomContent") - .HasJsonPropertyName("cc"); - - b2.HasKey("PresentationConfigurationTournamentId"); - - b2.ToTable("Tournaments", "turnierplan"); - - b2.HasJsonPropertyName("h1"); - - b2.WithOwner() - .HasForeignKey("PresentationConfigurationTournamentId"); - }); - - b1.OwnsOne("Turnierplan.Core.Tournament.PresentationConfiguration+HeaderLine", "Header2", b2 => - { - b2.Property("PresentationConfigurationTournamentId"); - - b2.Property("Content") - .HasJsonPropertyName("c"); - - b2.Property("CustomContent") - .HasJsonPropertyName("cc"); - - b2.HasKey("PresentationConfigurationTournamentId"); - - b2.ToTable("Tournaments", "turnierplan"); - - b2.HasJsonPropertyName("h2"); - - b2.WithOwner() - .HasForeignKey("PresentationConfigurationTournamentId"); - }); - - b1.Navigation("Header1") - .IsRequired(); - - b1.Navigation("Header2") - .IsRequired(); - }); - - b.Navigation("BannerImage"); - - b.Navigation("ComputationConfiguration") - .IsRequired(); - - b.Navigation("Folder"); - - b.Navigation("MatchPlanConfiguration"); - - b.Navigation("Organization"); - - b.Navigation("PresentationConfiguration") - .IsRequired(); - - b.Navigation("PrimaryLogo"); - - b.Navigation("SecondaryLogo"); - - b.Navigation("Venue"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.Application", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentPlanner", "TournamentPlanner") - .WithMany("Applications") - .HasForeignKey("PlanningRealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.TournamentPlanner.InvitationLink", "SourceLink") - .WithMany() - .HasForeignKey("SourceLinkId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("SourceLink"); - - b.Navigation("TournamentPlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.ApplicationChangeLog", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.Application", "Application") - .WithMany("ChangeLog") - .HasForeignKey("ApplicationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsMany("Turnierplan.Core.TournamentPlanner.ApplicationChangeLog+Property", "Properties", b1 => - { - b1.Property("ApplicationChangeLogId"); - - b1.Property("__synthesizedOrdinal") - .ValueGeneratedOnAdd(); - - b1.Property("Type") - .HasJsonPropertyName("t"); - - b1.Property("Value") - .IsRequired() - .HasJsonPropertyName("v"); - - b1.HasKey("ApplicationChangeLogId", "__synthesizedOrdinal"); - - b1.ToTable("ApplicationChangeLogs", "turnierplan"); - - b1.ToJson("Properties"); - - b1.WithOwner() - .HasForeignKey("ApplicationChangeLogId"); - }); - - b.Navigation("Application"); - - b.Navigation("Properties"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.ApplicationTeam", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.Application", "Application") - .WithMany("Teams") - .HasForeignKey("ApplicationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentClass", "Class") - .WithMany() - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Application"); - - b.Navigation("Class"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.InvitationLink", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentPlanner", "TournamentPlanner") - .WithMany("InvitationLinks") - .HasForeignKey("PlanningRealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.Image.Image", "PrimaryLogo") - .WithMany() - .HasForeignKey("PrimaryLogoId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Turnierplan.Core.Image.Image", "SecondaryLogo") - .WithMany() - .HasForeignKey("SecondaryLogoId") - .OnDelete(DeleteBehavior.SetNull); - - b.OwnsMany("Turnierplan.Core.TournamentPlanner.InvitationLink+ExternalLink", "ExternalLinks", b1 => - { - b1.Property("InvitationLinkId"); - - b1.Property("__synthesizedOrdinal") - .ValueGeneratedOnAdd(); - - b1.Property("Name") - .IsRequired() - .HasJsonPropertyName("n"); - - b1.Property("Url") - .IsRequired() - .HasJsonPropertyName("u"); - - b1.HasKey("InvitationLinkId", "__synthesizedOrdinal"); - - b1.ToTable("InvitationLinks", "turnierplan"); - - b1.ToJson("ExternalLinks"); - - b1.WithOwner() - .HasForeignKey("InvitationLinkId"); - }); - - b.Navigation("ExternalLinks"); - - b.Navigation("PrimaryLogo"); - - b.Navigation("SecondaryLogo"); - - b.Navigation("TournamentPlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.InvitationLinkEntry", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentClass", "Class") - .WithMany() - .HasForeignKey("ClassId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.TournamentPlanner.InvitationLink", null) - .WithMany("Entries") - .HasForeignKey("InvitationLinkId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Class"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.Label", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentPlanner", null) - .WithMany("Labels") - .HasForeignKey("PlanningRealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TeamLink", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.ApplicationTeam", "ApplicationTeam") - .WithOne("TeamLink") - .HasForeignKey("Turnierplan.Core.TournamentPlanner.TeamLink", "ApplicationTeamId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.Tournament.Team", "Team") - .WithOne("TeamLink") - .HasForeignKey("Turnierplan.Core.TournamentPlanner.TeamLink", "TeamTournamentId", "TeamId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ApplicationTeam"); - - b.Navigation("Team"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TournamentClass", b => - { - b.HasOne("Turnierplan.Core.TournamentPlanner.TournamentPlanner", null) - .WithMany("TournamentClasses") - .HasForeignKey("PlanningRealmId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TournamentPlanner", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("TournamentPlanners") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.Venue.Venue", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("Venues") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKey", b => - { - b.Navigation("Requests"); - - b.Navigation("RoleAssignments"); - }); - - modelBuilder.Entity("Turnierplan.Core.Folder.Folder", b => - { - b.Navigation("RoleAssignments"); - - b.Navigation("Tournaments"); - }); - - modelBuilder.Entity("Turnierplan.Core.Image.Image", b => - { - b.Navigation("RoleAssignments"); - }); - - modelBuilder.Entity("Turnierplan.Core.Organization.Organization", b => - { - b.Navigation("ApiKeys"); - - b.Navigation("Folders"); - - b.Navigation("Images"); - - b.Navigation("ResourcePlanners"); - - b.Navigation("RoleAssignments"); - - b.Navigation("TournamentPlanners"); - - b.Navigation("Tournaments"); - - b.Navigation("Venues"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceGroup", b => - { - b.Navigation("ResourceAssignments"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlanner", b => - { - b.Navigation("ResourceGroups"); - - b.Navigation("ResourcePlannerViews"); - - b.Navigation("RoleAssignments"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Group", b => - { - b.Navigation("Participants"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Team", b => - { - b.Navigation("TeamLink"); - }); - - modelBuilder.Entity("Turnierplan.Core.Tournament.Tournament", b => - { - b.Navigation("Documents"); - - b.Navigation("Groups"); - - b.Navigation("Matches"); - - b.Navigation("RankingOverwrites"); - - b.Navigation("RoleAssignments"); - - b.Navigation("Teams"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.Application", b => - { - b.Navigation("ChangeLog"); - - b.Navigation("Teams"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.ApplicationTeam", b => - { - b.Navigation("TeamLink"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.InvitationLink", b => - { - b.Navigation("Entries"); - }); - - modelBuilder.Entity("Turnierplan.Core.TournamentPlanner.TournamentPlanner", b => - { - b.Navigation("Applications"); - - b.Navigation("InvitationLinks"); - - b.Navigation("Labels"); - - b.Navigation("RoleAssignments"); - - b.Navigation("TournamentClasses"); - }); - - modelBuilder.Entity("Turnierplan.Core.Venue.Venue", b => - { - b.Navigation("RoleAssignments"); - - b.Navigation("Tournaments"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Turnierplan.Dal/Migrations/20260717182006_Add_ResourcePlanner.cs b/src/Turnierplan.Dal/Migrations/20260717182006_Add_ResourcePlanner.cs deleted file mode 100644 index 82ad7fc3..00000000 --- a/src/Turnierplan.Dal/Migrations/20260717182006_Add_ResourcePlanner.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Turnierplan.Dal.Migrations -{ - /// - public partial class Add_ResourcePlanner : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ResourcePlanners", - schema: "turnierplan", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PublicId = table.Column(type: "bigint", nullable: false), - OrganizationId = table.Column(type: "bigint", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - Name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ResourcePlanners", x => x.Id); - table.ForeignKey( - name: "FK_ResourcePlanners_Organizations_OrganizationId", - column: x => x.OrganizationId, - principalSchema: "turnierplan", - principalTable: "Organizations", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "IAM_ResourcePlanner", - schema: "turnierplan", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ResourcePlannerId = table.Column(type: "bigint", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - Role = table.Column(type: "integer", nullable: false), - Principal = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IAM_ResourcePlanner", x => x.Id); - table.ForeignKey( - name: "FK_IAM_ResourcePlanner_ResourcePlanners_ResourcePlannerId", - column: x => x.ResourcePlannerId, - principalSchema: "turnierplan", - principalTable: "ResourcePlanners", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ResourceGroups", - schema: "turnierplan", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ResourcePlannerId = table.Column(type: "bigint", nullable: false), - Name = table.Column(type: "text", nullable: true), - Description = table.Column(type: "text", nullable: true), - Type = table.Column(type: "integer", nullable: false), - Start = table.Column(type: "timestamp with time zone", nullable: true), - End = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ResourceGroups", x => x.Id); - table.ForeignKey( - name: "FK_ResourceGroups_ResourcePlanners_ResourcePlannerId", - column: x => x.ResourcePlannerId, - principalSchema: "turnierplan", - principalTable: "ResourcePlanners", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ResourcePlannerViews", - schema: "turnierplan", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PublicId = table.Column(type: "bigint", nullable: false), - ResourcePlannerId = table.Column(type: "bigint", nullable: false), - IsActive = table.Column(type: "boolean", nullable: false), - DisplayAllGroups = table.Column(type: "boolean", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ResourcePlannerViews", x => x.Id); - table.ForeignKey( - name: "FK_ResourcePlannerViews_ResourcePlanners_ResourcePlannerId", - column: x => x.ResourcePlannerId, - principalSchema: "turnierplan", - principalTable: "ResourcePlanners", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Resources", - schema: "turnierplan", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ResourcePlannerId = table.Column(type: "bigint", nullable: false), - Type = table.Column(type: "integer", nullable: false), - Name = table.Column(type: "text", nullable: false), - Notes = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Resources", x => x.Id); - table.ForeignKey( - name: "FK_Resources_ResourcePlanners_ResourcePlannerId", - column: x => x.ResourcePlannerId, - principalSchema: "turnierplan", - principalTable: "ResourcePlanners", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ResourceGroupResourcePlannerView", - schema: "turnierplan", - columns: table => new - { - ResourceGroupsId = table.Column(type: "bigint", nullable: false), - ResourcePlannerViewId = table.Column(type: "bigint", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ResourceGroupResourcePlannerView", x => new { x.ResourceGroupsId, x.ResourcePlannerViewId }); - table.ForeignKey( - name: "FK_ResourceGroupResourcePlannerView_ResourceGroups_ResourceGro~", - column: x => x.ResourceGroupsId, - principalSchema: "turnierplan", - principalTable: "ResourceGroups", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ResourceGroupResourcePlannerView_ResourcePlannerViews_Resou~", - column: x => x.ResourcePlannerViewId, - principalSchema: "turnierplan", - principalTable: "ResourcePlannerViews", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ResourceAssignments", - schema: "turnierplan", - columns: table => new - { - ResourceGroupId = table.Column(type: "bigint", nullable: false), - ResourceId = table.Column(type: "bigint", nullable: false), - State = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ResourceAssignments", x => new { x.ResourceGroupId, x.ResourceId }); - table.ForeignKey( - name: "FK_ResourceAssignments_ResourceGroups_ResourceGroupId", - column: x => x.ResourceGroupId, - principalSchema: "turnierplan", - principalTable: "ResourceGroups", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ResourceAssignments_Resources_ResourceId", - column: x => x.ResourceId, - principalSchema: "turnierplan", - principalTable: "Resources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_IAM_ResourcePlanner_ResourcePlannerId", - schema: "turnierplan", - table: "IAM_ResourcePlanner", - column: "ResourcePlannerId"); - - migrationBuilder.CreateIndex( - name: "IX_ResourceAssignments_ResourceId", - schema: "turnierplan", - table: "ResourceAssignments", - column: "ResourceId"); - - migrationBuilder.CreateIndex( - name: "IX_ResourceGroupResourcePlannerView_ResourcePlannerViewId", - schema: "turnierplan", - table: "ResourceGroupResourcePlannerView", - column: "ResourcePlannerViewId"); - - migrationBuilder.CreateIndex( - name: "IX_ResourceGroups_ResourcePlannerId", - schema: "turnierplan", - table: "ResourceGroups", - column: "ResourcePlannerId"); - - migrationBuilder.CreateIndex( - name: "IX_ResourcePlanners_OrganizationId", - schema: "turnierplan", - table: "ResourcePlanners", - column: "OrganizationId"); - - migrationBuilder.CreateIndex( - name: "IX_ResourcePlanners_PublicId", - schema: "turnierplan", - table: "ResourcePlanners", - column: "PublicId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ResourcePlannerViews_ResourcePlannerId", - schema: "turnierplan", - table: "ResourcePlannerViews", - column: "ResourcePlannerId"); - - migrationBuilder.CreateIndex( - name: "IX_Resources_ResourcePlannerId", - schema: "turnierplan", - table: "Resources", - column: "ResourcePlannerId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "IAM_ResourcePlanner", - schema: "turnierplan"); - - migrationBuilder.DropTable( - name: "ResourceAssignments", - schema: "turnierplan"); - - migrationBuilder.DropTable( - name: "ResourceGroupResourcePlannerView", - schema: "turnierplan"); - - migrationBuilder.DropTable( - name: "Resources", - schema: "turnierplan"); - - migrationBuilder.DropTable( - name: "ResourceGroups", - schema: "turnierplan"); - - migrationBuilder.DropTable( - name: "ResourcePlannerViews", - schema: "turnierplan"); - - migrationBuilder.DropTable( - name: "ResourcePlanners", - schema: "turnierplan"); - } - } -} diff --git a/src/Turnierplan.Dal/Migrations/TurnierplanContextModelSnapshot.cs b/src/Turnierplan.Dal/Migrations/TurnierplanContextModelSnapshot.cs index 1b592ec7..2eb7ba1d 100644 --- a/src/Turnierplan.Dal/Migrations/TurnierplanContextModelSnapshot.cs +++ b/src/Turnierplan.Dal/Migrations/TurnierplanContextModelSnapshot.cs @@ -38,21 +38,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ApplicationTeamLabel", "turnierplan"); }); - modelBuilder.Entity("ResourceGroupResourcePlannerView", b => - { - b.Property("ResourceGroupsId") - .HasColumnType("bigint"); - - b.Property("ResourcePlannerViewId") - .HasColumnType("bigint"); - - b.HasKey("ResourceGroupsId", "ResourcePlannerViewId"); - - b.HasIndex("ResourcePlannerViewId"); - - b.ToTable("ResourceGroupResourcePlannerView", "turnierplan"); - }); - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKey", b => { b.Property("Id") @@ -285,143 +270,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Organizations", "turnierplan"); }); - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.Resource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Notes") - .HasColumnType("text"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.Property("Type") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("Resources", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceAssignment", b => - { - b.Property("ResourceGroupId") - .HasColumnType("bigint"); - - b.Property("ResourceId") - .HasColumnType("bigint"); - - b.Property("State") - .HasColumnType("integer"); - - b.HasKey("ResourceGroupId", "ResourceId"); - - b.HasIndex("ResourceId"); - - b.ToTable("ResourceAssignments", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceGroup", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("End") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.Property("Start") - .HasColumnType("timestamp with time zone"); - - b.Property("Type") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("ResourceGroups", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlanner", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("OrganizationId") - .HasColumnType("bigint"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("OrganizationId"); - - b.HasIndex("PublicId") - .IsUnique(); - - b.ToTable("ResourcePlanners", "turnierplan"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlannerView", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DisplayAllGroups") - .HasColumnType("boolean"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("PublicId") - .HasColumnType("bigint"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("ResourcePlannerViews", "turnierplan"); - }); - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => { b.Property("Id") @@ -526,32 +374,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("IAM_Organization", "turnierplan"); }); - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Principal") - .IsRequired() - .HasColumnType("text"); - - b.Property("ResourcePlannerId") - .HasColumnType("bigint"); - - b.Property("Role") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ResourcePlannerId"); - - b.ToTable("IAM_ResourcePlanner", "turnierplan"); - }); - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => { b.Property("Id") @@ -1267,21 +1089,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); - modelBuilder.Entity("ResourceGroupResourcePlannerView", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourceGroup", null) - .WithMany() - .HasForeignKey("ResourceGroupsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlannerView", null) - .WithMany() - .HasForeignKey("ResourcePlannerViewId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - modelBuilder.Entity("Turnierplan.Core.ApiKey.ApiKey", b => { b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") @@ -1337,69 +1144,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Organization"); }); - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.Resource", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "ResourcePlanner") - .WithMany() - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResourcePlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceAssignment", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourceGroup", "ResourceGroup") - .WithMany("ResourceAssignments") - .HasForeignKey("ResourceGroupId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Turnierplan.Core.ResourcePlanner.Resource", "Resource") - .WithMany() - .HasForeignKey("ResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Resource"); - - b.Navigation("ResourceGroup"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceGroup", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "ResourcePlanner") - .WithMany("ResourceGroups") - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResourcePlanner"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlanner", b => - { - b.HasOne("Turnierplan.Core.Organization.Organization", "Organization") - .WithMany("ResourcePlanners") - .HasForeignKey("OrganizationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Organization"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlannerView", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "ResourcePlanner") - .WithMany("ResourcePlannerViews") - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ResourcePlanner"); - }); - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => { b.HasOne("Turnierplan.Core.ApiKey.ApiKey", "Scope") @@ -1444,17 +1188,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Scope"); }); - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => - { - b.HasOne("Turnierplan.Core.ResourcePlanner.ResourcePlanner", "Scope") - .WithMany("RoleAssignments") - .HasForeignKey("ResourcePlannerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Scope"); - }); - modelBuilder.Entity("Turnierplan.Core.RoleAssignment.RoleAssignment", b => { b.HasOne("Turnierplan.Core.Tournament.Tournament", "Scope") @@ -2072,8 +1805,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Images"); - b.Navigation("ResourcePlanners"); - b.Navigation("RoleAssignments"); b.Navigation("TournamentPlanners"); @@ -2083,20 +1814,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Venues"); }); - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourceGroup", b => - { - b.Navigation("ResourceAssignments"); - }); - - modelBuilder.Entity("Turnierplan.Core.ResourcePlanner.ResourcePlanner", b => - { - b.Navigation("ResourceGroups"); - - b.Navigation("ResourcePlannerViews"); - - b.Navigation("RoleAssignments"); - }); - modelBuilder.Entity("Turnierplan.Core.Tournament.Group", b => { b.Navigation("Participants"); diff --git a/src/Turnierplan.Dal/Repositories/OrganizationRepository.cs b/src/Turnierplan.Dal/Repositories/OrganizationRepository.cs index 06b3e10d..ac1232f5 100644 --- a/src/Turnierplan.Dal/Repositories/OrganizationRepository.cs +++ b/src/Turnierplan.Dal/Repositories/OrganizationRepository.cs @@ -26,7 +26,9 @@ public enum Includes Images = 8, ApiKeys = 16, TournamentPlanners = 32, +#if TP_RESOURCE_PLANNER ResourcePlanners = 64 +#endif } } @@ -75,10 +77,12 @@ internal sealed class OrganizationRepository(TurnierplanContext context) : Repos query = query.Include(x => x.TournamentPlanners); } +#if TP_RESOURCE_PLANNER if (includes.HasFlag(IOrganizationRepository.Includes.ResourcePlanners)) { query = query.Include(x => x.ResourcePlanners); } +#endif query = query .Include(x => x.RoleAssignments) diff --git a/src/Turnierplan.Dal/Repositories/ResourcePlannerRepository.cs b/src/Turnierplan.Dal/Repositories/ResourcePlannerRepository.cs index 88aae873..41dee7af 100644 --- a/src/Turnierplan.Dal/Repositories/ResourcePlannerRepository.cs +++ b/src/Turnierplan.Dal/Repositories/ResourcePlannerRepository.cs @@ -1,3 +1,5 @@ +#if TP_RESOURCE_PLANNER + using Microsoft.EntityFrameworkCore; using Turnierplan.Core.PublicId; using Turnierplan.Core.ResourcePlanner; @@ -52,3 +54,5 @@ internal sealed class ResourcePlannerRepository(TurnierplanContext context) : Re return await query.FirstOrDefaultAsync(); } } + +#endif diff --git a/src/Turnierplan.Dal/Repositories/RoleAssignmentRepository.cs b/src/Turnierplan.Dal/Repositories/RoleAssignmentRepository.cs index f41e131b..c3ab0106 100644 --- a/src/Turnierplan.Dal/Repositories/RoleAssignmentRepository.cs +++ b/src/Turnierplan.Dal/Repositories/RoleAssignmentRepository.cs @@ -4,7 +4,9 @@ using Turnierplan.Core.Folder; using Turnierplan.Core.Image; using Turnierplan.Core.Organization; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.RoleAssignment; using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; @@ -38,7 +40,9 @@ internal sealed class ImageRoleAssignmentRepository(TurnierplanContext context) internal sealed class OrganizationRoleAssignmentRepository(TurnierplanContext context) : RoleAssignmentRepositoryBase(context); +#if TP_RESOURCE_PLANNER internal sealed class ResourcePlannerRoleAssignmentRepository(TurnierplanContext context) : RoleAssignmentRepositoryBase(context); +#endif internal sealed class TournamentPlannerRoleAssignmentRepository(TurnierplanContext context) : RoleAssignmentRepositoryBase(context); diff --git a/src/Turnierplan.Dal/TurnierplanContext.cs b/src/Turnierplan.Dal/TurnierplanContext.cs index 1a1d4471..639c3c70 100644 --- a/src/Turnierplan.Dal/TurnierplanContext.cs +++ b/src/Turnierplan.Dal/TurnierplanContext.cs @@ -6,7 +6,9 @@ using Turnierplan.Core.Folder; using Turnierplan.Core.Image; using Turnierplan.Core.Organization; +#if TP_RESOURCE_PLANNER using Turnierplan.Core.ResourcePlanner; +#endif using Turnierplan.Core.RoleAssignment; using Turnierplan.Core.Tournament; using Turnierplan.Core.TournamentPlanner; @@ -67,6 +69,8 @@ public TurnierplanContext(DbContextOptions options, ILogger< public DbSet Organizations { get; set; } = null!; +#if TP_RESOURCE_PLANNER + public DbSet ResourceAssignments { get; set; } = null!; public DbSet Resources { get; set; } = null!; @@ -79,6 +83,8 @@ public TurnierplanContext(DbContextOptions options, ILogger< public DbSet ResourcePlannerViews { get; set; } = null!; +#endif + public DbSet> OrganizationRoleAssignments { get; set; } = null!; public DbSet TournamentPlanners { get; set; } = null!; @@ -182,11 +188,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.ApplyConfiguration(new MatchEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new OrganizationEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new RankingOverwriteEntityTypeConfiguration()); +#if TP_RESOURCE_PLANNER modelBuilder.ApplyConfiguration(new ResourceAssignmentEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new ResourceEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new ResourceGroupEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new ResourcePlannerEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new ResourcePlannerViewEntityTypeConfiguration()); +#endif modelBuilder.ApplyConfiguration(new TeamEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new TeamLinkEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new TournamentEntityTypeConfiguration()); @@ -199,7 +207,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration()); +#if TP_RESOURCE_PLANNER modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration()); +#endif modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration("IAM_PlanningRealm")); // see to-do comment in TournamentPlannerEntityTypeConfiguration modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new RoleAssignmentEntityTypeConfiguration());