diff --git a/src/Client/Drogecode.Knrm.Oefenrooster.Client.csproj b/src/Client/Drogecode.Knrm.Oefenrooster.Client.csproj
index cf93cde8..c647f8f1 100644
--- a/src/Client/Drogecode.Knrm.Oefenrooster.Client.csproj
+++ b/src/Client/Drogecode.Knrm.Oefenrooster.Client.csproj
@@ -17,21 +17,21 @@
-
+
-
-
-
-
-
+
+
+
+
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/Client/Pages/Configuration/Global.razor b/src/Client/Pages/Configuration/Global.razor
index 8a47b134..af3f1590 100644
--- a/src/Client/Pages/Configuration/Global.razor
+++ b/src/Client/Pages/Configuration/Global.razor
@@ -41,6 +41,21 @@ else if (_specialDatesUpdated == false)
@if (_users != null && _functions != null)
{
+
+
+
+ vijf meest recente logins maximaal 7 dagen geleden
+ @foreach (var user in _users.Where(x => x.LastLogin >= DateTime.Today.AddDays(-7)).OrderByDescending(x => x.LastLogin).Take(5))
+ {
+
+
+
+ }
+
+
@foreach (var function in _functions.OrderBy(x => x.Order))
diff --git a/src/Client/Pages/User/Components/DefaultDialog.razor b/src/Client/Pages/User/Components/DefaultDialog.razor
index 64fba6f2..b63ce16c 100644
--- a/src/Client/Pages/User/Components/DefaultDialog.razor
+++ b/src/Client/Pages/User/Components/DefaultDialog.razor
@@ -9,8 +9,8 @@
@LApp["NotAvailable"]
@LApp["Maybe"]
-
-
+
+
}
diff --git a/src/Client/Pages/User/Components/DefaultDialog.razor.cs b/src/Client/Pages/User/Components/DefaultDialog.razor.cs
index c0af94a0..5a9b4317 100644
--- a/src/Client/Pages/User/Components/DefaultDialog.razor.cs
+++ b/src/Client/Pages/User/Components/DefaultDialog.razor.cs
@@ -11,7 +11,7 @@ namespace Drogecode.Knrm.Oefenrooster.Client.Pages.User.Components;
public sealed partial class DefaultDialog : IDisposable
{
- [Inject] private IStringLocalizer L { get; set; } = default!;
+ //[Inject] private IStringLocalizer L { get; set; } = default!;
[Inject] private IStringLocalizer LApp { get; set; } = default!;
[Inject] private DefaultScheduleRepository _defaultScheduleRepository { get; set; } = default!;
[CascadingParameter] MudDialogInstance MudDialog { get; set; } = default!;
@@ -24,7 +24,7 @@ public sealed partial class DefaultDialog : IDisposable
private DefaultUserSchedule? _originalDefaultUserSchedule = null;
private bool _success;
private string[] _errors = Array.Empty();
- void Cancel() => MudDialog.Cancel();
+ private void Cancel() => MudDialog.Cancel();
protected override async Task OnParametersSetAsync()
{
if (IsNew == true)
diff --git a/src/Client/Pages/User/Components/GroupDialog.razor b/src/Client/Pages/User/Components/GroupDialog.razor
new file mode 100644
index 00000000..5c8d70d1
--- /dev/null
+++ b/src/Client/Pages/User/Components/GroupDialog.razor
@@ -0,0 +1,18 @@
+@using Drogecode.Knrm.Oefenrooster.Shared.Enums;
+
+
+ @if (DefaultGroup is not null)
+ {
+ @L["Warning changing period is not possible yet"]
+
+
+
+
+
+ }
+
+
+ @LApp["Cancel"]
+ @LApp["Submit"]
+
+
\ No newline at end of file
diff --git a/src/Client/Pages/User/Components/GroupDialog.razor.cs b/src/Client/Pages/User/Components/GroupDialog.razor.cs
new file mode 100644
index 00000000..4c71c013
--- /dev/null
+++ b/src/Client/Pages/User/Components/GroupDialog.razor.cs
@@ -0,0 +1,58 @@
+using Drogecode.Knrm.Oefenrooster.Client.Models;
+using Drogecode.Knrm.Oefenrooster.Client.Repositories;
+using Drogecode.Knrm.Oefenrooster.Shared.Models.DefaultSchedule;
+using Microsoft.Extensions.Localization;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Drogecode.Knrm.Oefenrooster.Client.Pages.User.Components;
+
+public sealed partial class GroupDialog : IDisposable
+{
+ [Inject] private IStringLocalizer L { get; set; } = default!;
+ [Inject] private IStringLocalizer LApp { get; set; } = default!;
+ [Inject] private DefaultScheduleRepository _defaultScheduleRepository { get; set; } = default!;
+
+ [CascadingParameter] MudDialogInstance MudDialog { get; set; } = default!;
+ [Parameter] public DefaultGroup? DefaultGroup { get; set; }
+ [Parameter] public RefreshModel? Refresh { get; set; }
+ [Parameter] public bool? IsNew { get; set; }
+
+ [AllowNull] private MudForm _form;
+ private CancellationTokenSource _cls = new();
+ private bool _success;
+ private string[] _errors = Array.Empty();
+ void Cancel() => MudDialog.Cancel();
+ protected override async Task OnParametersSetAsync()
+ {
+ if (IsNew == true || DefaultGroup is null)
+ {
+ DefaultGroup = new DefaultGroup();
+ }
+ if (DefaultGroup.ValidFrom == DateTime.MaxValue)
+ DefaultGroup.ValidFrom = null;
+ if (DefaultGroup.ValidFrom == DateTime.MaxValue)
+ DefaultGroup.ValidFrom = null;
+ }
+ private async Task Submit()
+ {
+ await _form.Validate();
+ if (DefaultGroup is null)
+ throw new ArgumentNullException("DefaultGroup");
+ var body = new DefaultGroup
+ {
+ Name = DefaultGroup.Name,
+ ValidFrom = DefaultGroup.ValidFrom!.Value.ToUniversalTime(),
+ ValidUntil = DefaultGroup.ValidUntil!.Value.ToUniversalTime(),
+ IsDefault = false
+ };
+ var result = await _defaultScheduleRepository.PutGroup(body, _cls.Token);
+ if (Refresh is not null)
+ await Refresh.CallRequestRefreshAsync();
+ MudDialog.Close(DialogResult.Ok(true));
+ }
+
+ public void Dispose()
+ {
+ _cls.Cancel();
+ }
+}
diff --git a/src/Client/Pages/User/Defaults.razor b/src/Client/Pages/User/Defaults.razor
index 6137126d..fae70e55 100644
--- a/src/Client/Pages/User/Defaults.razor
+++ b/src/Client/Pages/User/Defaults.razor
@@ -7,13 +7,14 @@
@if (_defaultGroups is not null)
{
+ @L["Add new group"]
if (_defaultGroups.Count > 1)
{
- @foreach (var group in _defaultGroups)
+ @foreach (var group in _defaultGroups.OrderByDescending(x => x.IsDefault).ThenBy(x => x.ValidFrom))
{
- string groupName = GetGroupName(group);
-
+ string groupTitle = GetGroupTitle(group);
+
}
@@ -25,7 +26,7 @@
}
else
{
- @L["No groups found :("]
+ @L["No groups found"]
}
}
else
diff --git a/src/Client/Pages/User/Defaults.razor.cs b/src/Client/Pages/User/Defaults.razor.cs
index da25a3f8..5f302112 100644
--- a/src/Client/Pages/User/Defaults.razor.cs
+++ b/src/Client/Pages/User/Defaults.razor.cs
@@ -16,6 +16,7 @@ public sealed partial class Defaults : IDisposable
{
[Inject] private IStringLocalizer L { get; set; } = default!;
[Inject] private IStringLocalizer LApp { get; set; } = default!;
+ [Inject] private IDialogService _dialogProvider { get; set; } = default!;
[Inject] private DefaultScheduleRepository _defaultScheduleRepository { get; set; } = default!;
private RefreshModel _refreshModel = new();
private CancellationTokenSource _cls = new();
@@ -27,14 +28,29 @@ protected override async Task OnParametersSetAsync()
_refreshModel.RefreshRequestedAsync += RefreshMeAsync;
}
- private string GetGroupName(DefaultGroup group)
+ private string GetGroupTitle(DefaultGroup group)
{
+ var groupName = group.Name;
if (group.IsDefault && string.IsNullOrEmpty(group.Name))
{
- return L["Default group name"];
+ groupName = L["Default group name"];
}
- return group.Name;
+ if (group.IsDefault)
+ return groupName;
+ return $"{groupName} {group.ValidFrom!.Value.ToLocalTime().ToShortDateString()} {LApp["till"]} {group.ValidUntil!.Value.ToLocalTime().ToShortDateString()}";
}
+
+ private void OpenGroupDialog(DefaultGroup? group, bool isNew)
+ {
+ var parameters = new DialogParameters {
+ { x=>x.DefaultGroup, group},
+ { x=> x.IsNew, isNew},
+ { x=> x.Refresh, _refreshModel },
+ };
+ DialogOptions options = new DialogOptions() { MaxWidth = MaxWidth.Medium, FullWidth = true };
+ _dialogProvider.Show(L["Add group"], parameters, options);
+ }
+
private async Task RefreshMeAsync()
{
_defaultGroups = (await _defaultScheduleRepository.GetAllGroups(_cls.Token))?.OrderBy(x => x.ValidFrom).ToList();
diff --git a/src/Client/Repositories/DefaultScheduleRepository.cs b/src/Client/Repositories/DefaultScheduleRepository.cs
index 923ff857..f04bcee2 100644
--- a/src/Client/Repositories/DefaultScheduleRepository.cs
+++ b/src/Client/Repositories/DefaultScheduleRepository.cs
@@ -36,4 +36,10 @@ public DefaultScheduleRepository(IDefaultScheduleClient defaultScheduleClient, I
var result = await _defaultScheduleClient.PatchDefaultScheduleForUserAsync(body, clt);
return result.Patched;
}
+
+ public async Task PutGroup(DefaultGroup body, CancellationToken clt)
+ {
+ var result = await _defaultScheduleClient.PutGroupAsync(body, clt);
+ return result;
+ }
}
diff --git a/src/Client/Resources/App.en-US.resx b/src/Client/Resources/App.en-US.resx
index b42bc556..12d9e8dc 100644
--- a/src/Client/Resources/App.en-US.resx
+++ b/src/Client/Resources/App.en-US.resx
@@ -174,6 +174,12 @@
Tuesday
+
+ Valid from
+
+
+ Valid until
+
Wednesday
diff --git a/src/Client/Resources/App.nl-NL.resx b/src/Client/Resources/App.nl-NL.resx
index 3ed632bd..26407fe9 100644
--- a/src/Client/Resources/App.nl-NL.resx
+++ b/src/Client/Resources/App.nl-NL.resx
@@ -174,6 +174,12 @@
Dinsdag
+
+ Geldig vanaf
+
+
+ Geldig tot en met
+
Woensdag
diff --git a/src/Client/Resources/Pages/User/Components/GroupDialog.en-US.resx b/src/Client/Resources/Pages/User/Components/GroupDialog.en-US.resx
new file mode 100644
index 00000000..f8706d26
--- /dev/null
+++ b/src/Client/Resources/Pages/User/Components/GroupDialog.en-US.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Name
+
+
+ Warning changing period is not possible (yet)!!
+
+
\ No newline at end of file
diff --git a/src/Client/Resources/Pages/User/Components/GroupDialog.nl-NL.resx b/src/Client/Resources/Pages/User/Components/GroupDialog.nl-NL.resx
new file mode 100644
index 00000000..33ab5a6e
--- /dev/null
+++ b/src/Client/Resources/Pages/User/Components/GroupDialog.nl-NL.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Naam
+
+
+ Waarschuwing het wijzigen van de periode is (nog) niet mogelijk!!
+
+
\ No newline at end of file
diff --git a/src/Client/Resources/Pages/User/Defaults.en-US.resx b/src/Client/Resources/Pages/User/Defaults.en-US.resx
index a8449fb6..8152f9c3 100644
--- a/src/Client/Resources/Pages/User/Defaults.en-US.resx
+++ b/src/Client/Resources/Pages/User/Defaults.en-US.resx
@@ -117,15 +117,27 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Add group
+
+
+ Add new group
+
Configure your default availabilty here.
Current setting
+
+ Default
+
Default schedule
+
+ No groups found :(
+
End time
diff --git a/src/Client/Resources/Pages/User/Defaults.nl-NL.resx b/src/Client/Resources/Pages/User/Defaults.nl-NL.resx
index f0110d46..d005e1a9 100644
--- a/src/Client/Resources/Pages/User/Defaults.nl-NL.resx
+++ b/src/Client/Resources/Pages/User/Defaults.nl-NL.resx
@@ -117,15 +117,27 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Voeg groep toe
+
+
+ Voeg nieuwe groep toe
+
Stel hier je standaard beschikbaarheid in.
Huidige instelling
+
+ Standaard
+
Standaard rooster
+
+ Geen groepen gevonden :(
+
T/m
diff --git a/src/ClientGenerator/Drogecode.Knrm.Oefenrooster.ClientGenerator.csproj b/src/ClientGenerator/Drogecode.Knrm.Oefenrooster.ClientGenerator.csproj
index 6f3d29e6..8865ad12 100644
--- a/src/ClientGenerator/Drogecode.Knrm.Oefenrooster.ClientGenerator.csproj
+++ b/src/ClientGenerator/Drogecode.Knrm.Oefenrooster.ClientGenerator.csproj
@@ -78,7 +78,7 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/ClientGenerator/OpenAPIs/DefaultSchedule.json b/src/ClientGenerator/OpenAPIs/DefaultSchedule.json
index 9ab95847..d7df1a95 100644
--- a/src/ClientGenerator/OpenAPIs/DefaultSchedule.json
+++ b/src/ClientGenerator/OpenAPIs/DefaultSchedule.json
@@ -76,7 +76,56 @@
}
}
},
- "/api/DefaultSchedule": {
+ "/api/DefaultSchedule/group": {
+ "put": {
+ "tags": [
+ "DefaultSchedule"
+ ],
+ "operationId": "PutGroup",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DefaultGroup"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DefaultGroup"
+ }
+ },
+ "application/*+json": {
+ "schema": {
+ "$ref": "#/components/schemas/DefaultGroup"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/PutGroupResponse"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PutGroupResponse"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PutGroupResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/DefaultSchedule/schedule": {
"put": {
"tags": [
"DefaultSchedule"
@@ -416,7 +465,29 @@
},
"additionalProperties": false
},
- "PutDefaultScheduleError": {
+ "PutDefaultScheduleResponse": {
+ "type": "object",
+ "properties": {
+ "success": {
+ "type": "boolean"
+ },
+ "offline": {
+ "type": "boolean"
+ },
+ "elapsedMilliseconds": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "defaultSchedule": {
+ "$ref": "#/components/schemas/DefaultSchedule"
+ },
+ "error": {
+ "$ref": "#/components/schemas/PutError"
+ }
+ },
+ "additionalProperties": false
+ },
+ "PutError": {
"enum": [
0,
1
@@ -424,7 +495,7 @@
"type": "integer",
"format": "int32"
},
- "PutDefaultScheduleResponse": {
+ "PutGroupResponse": {
"type": "object",
"properties": {
"success": {
@@ -437,11 +508,11 @@
"type": "integer",
"format": "int64"
},
- "defaultSchedule": {
- "$ref": "#/components/schemas/DefaultSchedule"
+ "group": {
+ "$ref": "#/components/schemas/DefaultGroup"
},
"error": {
- "$ref": "#/components/schemas/PutDefaultScheduleError"
+ "$ref": "#/components/schemas/PutError"
}
},
"additionalProperties": false
diff --git a/src/Server/Controllers/ScheduleController.cs b/src/Server/Controllers/ScheduleController.cs
index 882e7782..281216a1 100644
--- a/src/Server/Controllers/ScheduleController.cs
+++ b/src/Server/Controllers/ScheduleController.cs
@@ -250,7 +250,7 @@ public async Task> GetSchedul
{
var userId = new Guid(User?.FindFirstValue("http://schemas.microsoft.com/identity/claims/objectidentifier") ?? throw new Exception("No objectidentifier found"));
var customerId = new Guid(User?.FindFirstValue("http://schemas.microsoft.com/identity/claims/tenantid") ?? throw new Exception("customerId not found"));
- var fromDate = _dateTimeService.Today().AddDays(-1).ToUniversalTime();
+ var fromDate = _dateTimeService.Today().ToUniversalTime();
var result = await _scheduleService.GetScheduledTrainingsForUser(userId, customerId, fromDate, clt);
return result;
}
diff --git a/src/Server/Database/Migrations/20230917103347_modify-monthly-message.Designer.cs b/src/Server/Database/Migrations/20230917103347_modify-monthly-message.Designer.cs
new file mode 100644
index 00000000..cac70377
--- /dev/null
+++ b/src/Server/Database/Migrations/20230917103347_modify-monthly-message.Designer.cs
@@ -0,0 +1,1856 @@
+//
+using System;
+using Drogecode.Knrm.Oefenrooster.Server.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace Drogecode.Knrm.Oefenrooster.Server.Database.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230917103347_modify-monthly-message")]
+ partial class modifymonthlymessage
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.11")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("DeletedBy")
+ .HasColumnType("uuid");
+
+ b.Property("DeletedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("LastLogin")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("UserFunctionId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("UserFunctionId");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbAudit", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("AuditType")
+ .HasColumnType("integer");
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CustomerId")
+ .IsRequired()
+ .HasColumnType("uuid");
+
+ b.Property("Note")
+ .HasColumnType("text");
+
+ b.Property("ObjectKey")
+ .HasColumnType("uuid");
+
+ b.Property("ObjectName")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Audit");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomerSettings", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Setting")
+ .HasColumnType("text");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("CustomerSettings");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ClientIdLogin")
+ .HasColumnType("text");
+
+ b.Property("ClientIdServer")
+ .HasColumnType("text");
+
+ b.Property("ClientSecretLogin")
+ .HasColumnType("text");
+
+ b.Property("ClientSecretServer")
+ .HasColumnType("text");
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Domain")
+ .HasColumnType("text");
+
+ b.Property("Instance")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("TenantId")
+ .HasColumnType("text");
+
+ b.Property("TimeZone")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ ClientIdLogin = "a9c68159-901c-449a-83e0-85243364e3cc",
+ ClientIdServer = "220e1008-1131-4e82-a388-611cd773ddf8",
+ ClientSecretLogin = "",
+ ClientSecretServer = "",
+ Created = new DateTime(2022, 10, 12, 18, 12, 5, 0, DateTimeKind.Utc),
+ Domain = "hui.nu",
+ Instance = "https://login.microsoftonline.com/",
+ Name = "KNRM Huizen",
+ TenantId = "d9754755-b054-4a9c-a77f-da42a4009365",
+ TimeZone = "Europe/Amsterdam"
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbLinkVehicleTraining", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("IsSelected")
+ .HasColumnType("boolean");
+
+ b.Property("RoosterTrainingId")
+ .HasColumnType("uuid");
+
+ b.Property("VehicleId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("LinkVehicleTraining");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbPreComAlert", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Alert")
+ .HasColumnType("text");
+
+ b.Property("CustomerId")
+ .IsRequired()
+ .HasColumnType("uuid");
+
+ b.Property("NotificationId")
+ .HasColumnType("uuid");
+
+ b.Property("Priority")
+ .HasColumnType("integer");
+
+ b.Property("Raw")
+ .HasColumnType("text");
+
+ b.Property("SendTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("PreComAlert");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportAction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Description")
+ .HasColumnType("text");
+
+ b.Property("Number")
+ .HasColumnType("double precision");
+
+ b.Property("Prio")
+ .HasColumnType("text");
+
+ b.Property("ShortDescription")
+ .HasColumnType("text");
+
+ b.Property("Start")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Title")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("ReportActions");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportTraining", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Description")
+ .HasColumnType("text");
+
+ b.Property("Start")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Title")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("ReportTrainings");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("DbReportActionId")
+ .HasColumnType("uuid");
+
+ b.Property("DbReportTrainingId")
+ .HasColumnType("uuid");
+
+ b.Property("DrogeCodeId")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Role")
+ .HasColumnType("integer");
+
+ b.Property("SharePointID")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DbReportActionId");
+
+ b.HasIndex("DbReportTrainingId");
+
+ b.ToTable("ReportUsers");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterAvailable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Assigned")
+ .HasColumnType("boolean");
+
+ b.Property("Available")
+ .HasColumnType("integer");
+
+ b.Property("CalendarEventId")
+ .HasColumnType("text");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Date")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("SetBy")
+ .HasColumnType("integer");
+
+ b.Property("TrainingId")
+ .HasColumnType("uuid");
+
+ b.Property("UserFunctionId")
+ .HasColumnType("uuid");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("VehicleId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("TrainingId");
+
+ b.HasIndex("UserFunctionId");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("VehicleId");
+
+ b.ToTable("RoosterAvailable");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterDefault", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CountToTrainingTarget")
+ .HasColumnType("boolean");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.Property("RoosterTrainingTypeId")
+ .HasColumnType("uuid");
+
+ b.Property("TimeEnd")
+ .HasColumnType("time without time zone");
+
+ b.Property("TimeStart")
+ .HasColumnType("time without time zone");
+
+ b.Property("TimeZone")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ValidFrom")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ValidUntil")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("WeekDay")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("RoosterTrainingTypeId");
+
+ b.ToTable("RoosterDefault");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("4142048e-82dc-4015-aab7-1b519da01238"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 10,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(21, 30, 0),
+ TimeStart = new TimeOnly(19, 30, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 1
+ },
+ new
+ {
+ Id = new Guid("7b4693a8-ae9c-430f-9119-49a6ecbfeb54"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 20,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(21, 30, 0),
+ TimeStart = new TimeOnly(19, 30, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 2
+ },
+ new
+ {
+ Id = new Guid("c1967b6b-1f3b-41d2-bfa4-361a71cd064c"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 30,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(21, 30, 0),
+ TimeStart = new TimeOnly(19, 30, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 3
+ },
+ new
+ {
+ Id = new Guid("b73bd006-0d29-4d4e-b71b-2c382d5f703f"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 40,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(21, 30, 0),
+ TimeStart = new TimeOnly(19, 30, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 4
+ },
+ new
+ {
+ Id = new Guid("2bdaccc0-e9f7-40c1-ae76-d9ed66e4a978"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 50,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(13, 0, 0),
+ TimeStart = new TimeOnly(10, 0, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 6
+ },
+ new
+ {
+ Id = new Guid("348c82b5-ba0d-4d31-b242-2edc1dc669c7"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 60,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(16, 0, 0),
+ TimeStart = new TimeOnly(13, 0, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 6
+ },
+ new
+ {
+ Id = new Guid("015b9e42-e233-457e-bf26-de26c3a718ba"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 70,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(13, 0, 0),
+ TimeStart = new TimeOnly(10, 0, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 0
+ },
+ new
+ {
+ Id = new Guid("80d8ac0c-a2f7-4dc9-af57-a0ed74b7f8df"),
+ CountToTrainingTarget = true,
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Order = 80,
+ RoosterTrainingTypeId = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ TimeEnd = new TimeOnly(16, 0, 0),
+ TimeStart = new TimeOnly(13, 0, 0),
+ TimeZone = "Europe/Amsterdam",
+ ValidFrom = new DateTime(2022, 9, 4, 0, 0, 0, 0, DateTimeKind.Utc),
+ ValidUntil = new DateTime(2023, 12, 31, 23, 59, 59, 0, DateTimeKind.Utc),
+ WeekDay = 0
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterItemDay", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedBy")
+ .HasColumnType("uuid");
+
+ b.Property("CreatedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("DateEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateStart")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("IsFullDay")
+ .HasColumnType("boolean");
+
+ b.Property("Text")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("RoosterItemDay");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterItemMonth", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CreatedBy")
+ .HasColumnType("uuid");
+
+ b.Property("CreatedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Month")
+ .HasColumnType("smallint");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.Property("Severity")
+ .HasColumnType("integer");
+
+ b.Property("Text")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.Property("Year")
+ .HasColumnType("smallint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("RoosterItemMonth");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("857e2ee9-8f2f-407e-9ec8-a0eaa853b957"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)1,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; GEEN",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("d7d80ee0-0e73-426f-84b2-2040057c2f7a"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)1,
+ Order = 1,
+ Severity = 1,
+ Text = "Geen ingeroosterde oefeningen in verband met het winterseizoen",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("5208deef-4529-4a30-a00e-22737cf52183"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)2,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Algemene kennis & Communicatie",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("36e33dc3-8bb8-4096-a127-c3ee04a0e694"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)3,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; SAR & Hulpverlening",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("01a17983-9bbe-4bfc-b152-f73c1869393d"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)4,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Veiligheid",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("f9d140f0-58fa-4c9a-a845-0eb5bad2814f"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)5,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Navigatie",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("4a009dd3-db02-4668-bbb0-9a9298c23d58"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)6,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; EHBO & Procedures",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("e4c00e6b-14d5-4609-bff3-6a6533557a0b"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)7,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Techiek & Varen",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("7696579c-403c-4a98-b30e-b19f1e90ffd0"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)7,
+ Order = 1,
+ Severity = 1,
+ Text = "Geen ingeroosterde oefeningen in verband met het hoogseizoen",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("48045049-e9cb-4d86-8f34-85578f015f76"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)8,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; ntb",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("4100bf4d-368e-47d1-b652-8fec191b4934"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)8,
+ Order = 1,
+ Severity = 1,
+ Text = "Geen ingeroosterde oefeningen in verband met het hoogseizoen",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("532b68c3-328f-45a2-8a7e-fdf7f9eee111"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)9,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Algemene kennis",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("40cbe7bc-4ed4-4897-8cb9-357785cb58c9"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)10,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Communicatie",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("ca0fe95d-3b84-4136-bcee-ce080228c324"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)11,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; SAR en Hulpverlening",
+ Type = 1
+ },
+ new
+ {
+ Id = new Guid("b858e7fc-02ea-4a2a-a49d-f55c3a912c9c"),
+ CreatedBy = new Guid("00000000-0000-0000-0000-000000000000"),
+ CreatedOn = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Month = (short)12,
+ Order = 0,
+ Severity = 0,
+ Text = "KNRM Kompas onderwerp; Navigatie",
+ Type = 1
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTraining", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CountToTrainingTarget")
+ .HasColumnType("boolean");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("DateEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateStart")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DeletedBy")
+ .HasColumnType("uuid");
+
+ b.Property("DeletedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("IsLocked")
+ .HasColumnType("boolean");
+
+ b.Property("IsPinned")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("RoosterDefaultId")
+ .HasColumnType("uuid");
+
+ b.Property("RoosterTrainingTypeId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("RoosterDefaultId");
+
+ b.HasIndex("RoosterTrainingTypeId");
+
+ b.ToTable("RoosterTraining");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTrainingType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ColorDark")
+ .HasColumnType("text");
+
+ b.Property("ColorLight")
+ .HasColumnType("text");
+
+ b.Property("CountToTrainingTarget")
+ .HasColumnType("boolean");
+
+ b.Property("CreatedBy")
+ .HasColumnType("uuid");
+
+ b.Property("CreatedDate")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("IsActive")
+ .HasColumnType("boolean");
+
+ b.Property("IsDefault")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.Property("TextColorDark")
+ .HasColumnType("text");
+
+ b.Property("TextColorLight")
+ .HasColumnType("text");
+
+ b.Property("UpdatedBy")
+ .HasColumnType("uuid");
+
+ b.Property("UpdatedDate")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("RoosterTrainingType");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("7dd5bf75-aef4-4cdd-9515-112e9b51f2f0"),
+ ColorDark = "#ffffff4c",
+ ColorLight = "#bdbdbdff",
+ CountToTrainingTarget = true,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = true,
+ Name = "Kompas oefening",
+ Order = 10
+ },
+ new
+ {
+ Id = new Guid("80108015-87a7-4453-a1af-d81d15fe3582"),
+ ColorDark = "rgb(214,143,0)",
+ ColorLight = "rgb(214,129,0)",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "EHBO",
+ Order = 20
+ },
+ new
+ {
+ Id = new Guid("52260d46-c748-4ffc-b94c-2baecacbfaf4"),
+ ColorDark = "",
+ ColorLight = "rgb(25,169,140)",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "een op een",
+ Order = 30
+ },
+ new
+ {
+ Id = new Guid("137f2d85-8a4f-4407-ba78-d24ea1bcc181"),
+ ColorDark = "rgb(244,47,70)",
+ ColorLight = "rgb(242,28,13)",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Brandweer",
+ Order = 40,
+ TextColorDark = "#C0C0C0",
+ TextColorLight = "#FFFFFF"
+ },
+ new
+ {
+ Id = new Guid("be12f5d9-b6f9-45d5-bd5f-6b74d7706a53"),
+ ColorDark = "rgb(13,222,156)",
+ ColorLight = "rgb(0,235,98)",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "HRB oefening",
+ Order = 50
+ },
+ new
+ {
+ Id = new Guid("6153a297-9486-43de-91e8-22d107da2b21"),
+ ColorDark = "#3BB9FF",
+ ColorLight = "#ADD8E6",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Evenement",
+ Order = 60
+ },
+ new
+ {
+ Id = new Guid("61646e7b-5257-4928-87fe-f1ac8ef1ef41"),
+ ColorDark = "#5f6138",
+ ColorLight = "#919454",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Techniek",
+ Order = 70
+ },
+ new
+ {
+ Id = new Guid("68be785c-1226-4280-a110-bd87f328951f"),
+ ColorLight = "#000000",
+ CountToTrainingTarget = false,
+ CreatedBy = new Guid("04093c7a-11e5-4887-af51-319ecc59efe0"),
+ CreatedDate = new DateTime(2023, 6, 26, 12, 12, 12, 0, DateTimeKind.Utc),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Proeve van Bekwaamheid",
+ Order = 80,
+ TextColorDark = "#C0C0C0",
+ TextColorLight = "#FFFFFF"
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserDefaultAvailable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Assigned")
+ .HasColumnType("boolean");
+
+ b.Property("Available")
+ .HasColumnType("integer");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("DefaultGroupId")
+ .HasColumnType("uuid");
+
+ b.Property("RoosterDefaultId")
+ .HasColumnType("uuid");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("ValidFrom")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ValidUntil")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("DefaultGroupId");
+
+ b.HasIndex("RoosterDefaultId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserDefaultAvailable");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserDefaultGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("IsDefault")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("ValidFrom")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ValidUntil")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserDefaultGroup");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserFunctions", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("IsActive")
+ .HasColumnType("boolean");
+
+ b.Property("IsDefault")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.Property("TrainingOnly")
+ .HasColumnType("boolean");
+
+ b.Property("TrainingTarget")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("UserFunctions");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("d23de705-d950-4833-8b94-aa531022d450"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Kompas leider",
+ Order = 10,
+ TrainingOnly = true,
+ TrainingTarget = 0
+ },
+ new
+ {
+ Id = new Guid("48db5dd5-cb72-4365-9bf5-959691dc54f2"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Schipper",
+ Order = 20,
+ TrainingOnly = false,
+ TrainingTarget = 2
+ },
+ new
+ {
+ Id = new Guid("cf6e6afa-8aa5-4b3d-8198-fb5e86faf53c"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Schipper I.O.",
+ Order = 30,
+ TrainingOnly = false,
+ TrainingTarget = 2
+ },
+ new
+ {
+ Id = new Guid("35ad11b8-d3f2-4960-b1e8-d41aaccd188a"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Opstapper",
+ Order = 60,
+ TrainingOnly = false,
+ TrainingTarget = 2
+ },
+ new
+ {
+ Id = new Guid("feb3641f-9941-4db7-a202-14263d706516"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Aankomend opstapper",
+ Order = 70,
+ TrainingOnly = false,
+ TrainingTarget = 2
+ },
+ new
+ {
+ Id = new Guid("322858f8-fd2c-4e62-b699-92c605adbbf2"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = true,
+ Name = "Opstapper op proef",
+ Order = 80,
+ TrainingOnly = false,
+ TrainingTarget = 0
+ },
+ new
+ {
+ Id = new Guid("5c49fc5c-25eb-48c2-a746-74ac3a030d48"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "HRB Aankomend opstapper",
+ Order = 100,
+ TrainingOnly = false,
+ TrainingTarget = 0
+ },
+ new
+ {
+ Id = new Guid("95427da1-e4d5-442e-962a-b04ab861a2c2"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Waarnemer",
+ Order = 180,
+ TrainingOnly = true,
+ TrainingTarget = 0
+ },
+ new
+ {
+ Id = new Guid("0a0a2c2d-15c7-4205-93a2-621de3c30db1"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Extra",
+ Order = 300,
+ TrainingOnly = false,
+ TrainingTarget = 0
+ },
+ new
+ {
+ Id = new Guid("a23f1f39-275e-4e21-901f-4878b73d3ede"),
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = false,
+ IsDefault = false,
+ Name = "Inactief",
+ Order = 400,
+ TrainingOnly = false,
+ TrainingTarget = 0
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserHolidays", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Available")
+ .HasColumnType("integer");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Description")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("ValidFrom")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ValidUntil")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserHolidays");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserRoles", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Accesses")
+ .HasColumnType("text");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("UserRoles");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("287359b1-2035-435b-97b0-eb260dc497d6"),
+ Accesses = "configure_training-types",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Name = "Admin"
+ },
+ new
+ {
+ Id = new Guid("f6b0c571-9050-40d6-bf58-807981e5ed6e"),
+ Accesses = "scheduler",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Name = "Scheduler"
+ },
+ new
+ {
+ Id = new Guid("d72ed2e9-911e-4ee5-b07e-cbd5917d432b"),
+ Accesses = "users_counter,users_details",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ Name = "Users"
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserSettings", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("Setting")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserSettings");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbVehicles", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CreatedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Createdby")
+ .HasColumnType("uuid");
+
+ b.Property("CustomerId")
+ .HasColumnType("uuid");
+
+ b.Property("DeletedOn")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Deletedby")
+ .HasColumnType("uuid");
+
+ b.Property("IsActive")
+ .HasColumnType("boolean");
+
+ b.Property("IsDefault")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Vehicle");
+
+ b.HasData(
+ new
+ {
+ Id = new Guid("4589535c-9064-4448-bc01-3b5a00e9410d"),
+ Code = "NWI",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = true,
+ Name = "Nikolaas Wijsenbeek",
+ Order = 10
+ },
+ new
+ {
+ Id = new Guid("c759950b-8264-4521-9a6e-ff98ad358cc1"),
+ Code = "HZR",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "De Huizer",
+ Order = 20
+ },
+ new
+ {
+ Id = new Guid("5777102a-3c9e-438e-a11f-fafb5f9649b6"),
+ Code = "HZN018",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Vlet",
+ Order = 30
+ },
+ new
+ {
+ Id = new Guid("f30d1856-2d26-441e-ae6d-935bb26c4852"),
+ Code = "Wal",
+ CustomerId = new Guid("d9754755-b054-4a9c-a77f-da42a4009365"),
+ IsActive = true,
+ IsDefault = false,
+ Name = "Wal",
+ Order = 100
+ });
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("Users")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserFunctions", "UserFunction")
+ .WithMany("Users")
+ .HasForeignKey("UserFunctionId");
+
+ b.Navigation("Customer");
+
+ b.Navigation("UserFunction");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbAudit", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("Audits")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", "User")
+ .WithMany("Audits")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomerSettings", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("CustomerSettings")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbLinkVehicleTraining", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("LinkVehicleTrainings")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbPreComAlert", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("PreComAlerts")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportUser", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportAction", null)
+ .WithMany("Users")
+ .HasForeignKey("DbReportActionId");
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportTraining", null)
+ .WithMany("Users")
+ .HasForeignKey("DbReportTrainingId");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterAvailable", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("RoosterAvailables")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTraining", "Training")
+ .WithMany("RoosterAvailables")
+ .HasForeignKey("TrainingId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserFunctions", "UserFunction")
+ .WithMany("RoosterAvailables")
+ .HasForeignKey("UserFunctionId");
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", "User")
+ .WithMany("RoosterAvailables")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbVehicles", "Vehicle")
+ .WithMany("RoosterAvailables")
+ .HasForeignKey("VehicleId");
+
+ b.Navigation("Customer");
+
+ b.Navigation("Training");
+
+ b.Navigation("User");
+
+ b.Navigation("UserFunction");
+
+ b.Navigation("Vehicle");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterDefault", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("RoosterDefaults")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTrainingType", "RoosterTrainingType")
+ .WithMany("RoosterDefaults")
+ .HasForeignKey("RoosterTrainingTypeId");
+
+ b.Navigation("Customer");
+
+ b.Navigation("RoosterTrainingType");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterItemDay", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("RoosterItemDays")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterItemMonth", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("RoosterItemMonths")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTraining", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("RoosterTrainings")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterDefault", "RoosterDefault")
+ .WithMany("RoosterTrainings")
+ .HasForeignKey("RoosterDefaultId");
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTrainingType", "RoosterTrainingType")
+ .WithMany("RoosterTrainings")
+ .HasForeignKey("RoosterTrainingTypeId");
+
+ b.Navigation("Customer");
+
+ b.Navigation("RoosterDefault");
+
+ b.Navigation("RoosterTrainingType");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTrainingType", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("RoosterTrainingTypes")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserDefaultAvailable", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("UserDefaultAvailables")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserDefaultGroup", "DefaultGroup")
+ .WithMany("UserDefaultAvailables")
+ .HasForeignKey("DefaultGroupId");
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterDefault", "RoosterDefault")
+ .WithMany("UserDefaultAvailables")
+ .HasForeignKey("RoosterDefaultId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", "User")
+ .WithMany("UserDefaultAvailables")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+
+ b.Navigation("DefaultGroup");
+
+ b.Navigation("RoosterDefault");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserDefaultGroup", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("UserDefaultGroups")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", "User")
+ .WithMany("UserDefaultGroups")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserFunctions", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("UserFunctions")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserHolidays", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("UserHolidays")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", "User")
+ .WithMany("UserHolidays")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserRoles", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("UserRoles")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserSettings", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("UserSettings")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", "User")
+ .WithMany("UserSettings")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbVehicles", b =>
+ {
+ b.HasOne("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", "Customer")
+ .WithMany("Vehicles")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Database.Models.DbUsers", b =>
+ {
+ b.Navigation("Audits");
+
+ b.Navigation("RoosterAvailables");
+
+ b.Navigation("UserDefaultAvailables");
+
+ b.Navigation("UserDefaultGroups");
+
+ b.Navigation("UserHolidays");
+
+ b.Navigation("UserSettings");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbCustomers", b =>
+ {
+ b.Navigation("Audits");
+
+ b.Navigation("CustomerSettings");
+
+ b.Navigation("LinkVehicleTrainings");
+
+ b.Navigation("PreComAlerts");
+
+ b.Navigation("RoosterAvailables");
+
+ b.Navigation("RoosterDefaults");
+
+ b.Navigation("RoosterItemDays");
+
+ b.Navigation("RoosterItemMonths");
+
+ b.Navigation("RoosterTrainingTypes");
+
+ b.Navigation("RoosterTrainings");
+
+ b.Navigation("UserDefaultAvailables");
+
+ b.Navigation("UserDefaultGroups");
+
+ b.Navigation("UserFunctions");
+
+ b.Navigation("UserHolidays");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("UserSettings");
+
+ b.Navigation("Users");
+
+ b.Navigation("Vehicles");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportAction", b =>
+ {
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbReportTraining", b =>
+ {
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterDefault", b =>
+ {
+ b.Navigation("RoosterTrainings");
+
+ b.Navigation("UserDefaultAvailables");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTraining", b =>
+ {
+ b.Navigation("RoosterAvailables");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbRoosterTrainingType", b =>
+ {
+ b.Navigation("RoosterDefaults");
+
+ b.Navigation("RoosterTrainings");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserDefaultGroup", b =>
+ {
+ b.Navigation("UserDefaultAvailables");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbUserFunctions", b =>
+ {
+ b.Navigation("RoosterAvailables");
+
+ b.Navigation("Users");
+ });
+
+ modelBuilder.Entity("Drogecode.Knrm.Oefenrooster.Server.Database.Models.DbVehicles", b =>
+ {
+ b.Navigation("RoosterAvailables");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/Server/Database/Migrations/20230917103347_modify-monthly-message.cs b/src/Server/Database/Migrations/20230917103347_modify-monthly-message.cs
new file mode 100644
index 00000000..a720e979
--- /dev/null
+++ b/src/Server/Database/Migrations/20230917103347_modify-monthly-message.cs
@@ -0,0 +1,75 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Drogecode.Knrm.Oefenrooster.Server.Database.Migrations
+{
+ ///
+ public partial class modifymonthlymessage : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("40cbe7bc-4ed4-4897-8cb9-357785cb58c9"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; Communicatie");
+
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("532b68c3-328f-45a2-8a7e-fdf7f9eee111"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; Algemene kennis");
+
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("b858e7fc-02ea-4a2a-a49d-f55c3a912c9c"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; Navigatie");
+
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("ca0fe95d-3b84-4136-bcee-ce080228c324"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; SAR en Hulpverlening");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("40cbe7bc-4ed4-4897-8cb9-357785cb58c9"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; ntb");
+
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("532b68c3-328f-45a2-8a7e-fdf7f9eee111"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; ntb");
+
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("b858e7fc-02ea-4a2a-a49d-f55c3a912c9c"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; ntb");
+
+ migrationBuilder.UpdateData(
+ table: "RoosterItemMonth",
+ keyColumn: "Id",
+ keyValue: new Guid("ca0fe95d-3b84-4136-bcee-ce080228c324"),
+ column: "Text",
+ value: "KNRM Kompas onderwerp; ntb");
+ }
+ }
+}
diff --git a/src/Server/Database/Migrations/DataContextModelSnapshot.cs b/src/Server/Database/Migrations/DataContextModelSnapshot.cs
index 34445d12..02ce9375 100644
--- a/src/Server/Database/Migrations/DataContextModelSnapshot.cs
+++ b/src/Server/Database/Migrations/DataContextModelSnapshot.cs
@@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "7.0.10")
+ .HasAnnotation("ProductVersion", "7.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -754,7 +754,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
Month = (short)9,
Order = 0,
Severity = 0,
- Text = "KNRM Kompas onderwerp; ntb",
+ Text = "KNRM Kompas onderwerp; Algemene kennis",
Type = 1
},
new
@@ -766,7 +766,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
Month = (short)10,
Order = 0,
Severity = 0,
- Text = "KNRM Kompas onderwerp; ntb",
+ Text = "KNRM Kompas onderwerp; Communicatie",
Type = 1
},
new
@@ -778,7 +778,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
Month = (short)11,
Order = 0,
Severity = 0,
- Text = "KNRM Kompas onderwerp; ntb",
+ Text = "KNRM Kompas onderwerp; SAR en Hulpverlening",
Type = 1
},
new
@@ -790,7 +790,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
Month = (short)12,
Order = 0,
Severity = 0,
- Text = "KNRM Kompas onderwerp; ntb",
+ Text = "KNRM Kompas onderwerp; Navigatie",
Type = 1
});
});
diff --git a/src/Server/Drogecode.Knrm.Oefenrooster.Server.csproj b/src/Server/Drogecode.Knrm.Oefenrooster.Server.csproj
index 42799db5..26cb6a6b 100644
--- a/src/Server/Drogecode.Knrm.Oefenrooster.Server.csproj
+++ b/src/Server/Drogecode.Knrm.Oefenrooster.Server.csproj
@@ -15,15 +15,15 @@
-
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -31,13 +31,13 @@
-
+
-
-
-
+
+
+
diff --git a/src/Server/Mappers/DefaultScheduleMapper.cs b/src/Server/Mappers/DefaultScheduleMapper.cs
index 1b8001f2..425bdb3d 100644
--- a/src/Server/Mappers/DefaultScheduleMapper.cs
+++ b/src/Server/Mappers/DefaultScheduleMapper.cs
@@ -45,6 +45,7 @@ public static PatchDefaultUserSchedule ToPatchDefaultUserSchedule(this DbRooster
return new PatchDefaultUserSchedule
{
DefaultId = defaultSchedule.Id,
+ GroupId = userDefault?.DefaultGroupId,
UserDefaultAvailableId = userDefault?.Id,
Available = userDefault?.Available,
ValidFromUser = userDefault?.ValidFrom,
diff --git a/src/Server/Services/DefaultScheduleService.cs b/src/Server/Services/DefaultScheduleService.cs
index 929e8f4b..4ba40f18 100644
--- a/src/Server/Services/DefaultScheduleService.cs
+++ b/src/Server/Services/DefaultScheduleService.cs
@@ -63,11 +63,11 @@ public async Task GetAlldefaultsForUser(Guid c
var list = new List();
var group = await _database.UserDefaultGroups.FindAsync(groupId);
var groupIsDefault = group?.IsDefault ?? false;
- var dbDefaults = _database.RoosterDefaults.Include(x => x.UserDefaultAvailables.Where(y => y.CustomerId == customerId && y.UserId == userId && (y.DefaultGroupId == groupId || (groupIsDefault && y.DefaultGroupId == null))));
+ var dbDefaults = _database.RoosterDefaults.Include(x => x.UserDefaultAvailables!.Where(y => y.CustomerId == customerId && y.UserId == userId && y.DefaultGroupId == groupId));
foreach (var dbDefault in dbDefaults)
{
if (dbDefault is null) continue;
- var userDefaults = dbDefault?.UserDefaultAvailables?.Where(x => x.UserId == userId && x.ValidUntil >= _dateTimeService.UtcNow()).OrderBy(x => x.ValidUntil);
+ var userDefaults = dbDefault?.UserDefaultAvailables?.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidUntil >= _dateTimeService.UtcNow() && x.DefaultGroupId == groupId).OrderBy(x => x.ValidUntil);
var innerList = new List();
if (userDefaults is not null)
{
@@ -161,11 +161,20 @@ public async Task PutDefaultSchedule(DefaultSchedule
public async Task PatchDefaultScheduleForUser(PatchDefaultUserSchedule body, Guid customerId, Guid userId)
{
+ var sw = Stopwatch.StartNew();
+ var result = new PatchDefaultScheduleForUserResponse();
DbRoosterDefault? dbDefault = DbQuery(body, userId);
- if (dbDefault is null) return new PatchDefaultScheduleForUserResponse { Success = false };
- var userDefault = dbDefault.UserDefaultAvailables?.FirstOrDefault(y => y.UserId == userId && y.Id == body.UserDefaultAvailableId);
- var validFrom = body.ValidFromUser ?? _dateTimeService.UtcNow();
- var validUntil = body.ValidUntilUser ?? DateTime.MaxValue;
+ DbUserDefaultGroup? dbGroup = await _database.UserDefaultGroups.FirstOrDefaultAsync(x=>x.CustomerId == customerId && x.UserId == userId && x.Id == body.GroupId && !x.IsDefault);
+ if (dbDefault is null)
+ {
+ sw.Stop();
+ result.Success = false;
+ result.ElapsedMilliseconds = sw.ElapsedMilliseconds;
+ return result;
+ }
+ var userDefault = dbDefault.UserDefaultAvailables?.FirstOrDefault(y => y.UserId == userId && y.Id == body.UserDefaultAvailableId && y.DefaultGroupId == body.GroupId);
+ var validFrom = dbGroup?.ValidFrom ?? body.ValidFromUser ?? _dateTimeService.UtcNow();
+ var validUntil = dbGroup?.ValidUntil ?? body.ValidUntilUser ?? DateTime.MaxValue;
if (validFrom.Kind == DateTimeKind.Unspecified)
validFrom = validFrom.DateTimeWithZone(dbDefault.Customer.TimeZone).ToUniversalTime();
if (validUntil.Kind == DateTimeKind.Unspecified)
@@ -174,7 +183,7 @@ public async Task PatchDefaultScheduleForUs
if (userDefault?.ValidFrom?.Date.CompareTo(_dateTimeService.UtcNow().Date) >= 0)
{
userDefault.DefaultGroupId = body.GroupId;
- userDefault!.Available = body.Available;
+ userDefault.Available = body.Available;
userDefault.Assigned = body.Assigned;
userDefault.ValidFrom = validFrom;
userDefault.ValidUntil = validUntil;
@@ -203,15 +212,15 @@ public async Task PatchDefaultScheduleForUs
};
_database.UserDefaultAvailables.Add(userDefault);
}
- _database.SaveChanges();
+ await _database.SaveChangesAsync();
body.UserDefaultAvailableId = userDefault.Id;
var dbPatched = DbQuery(body, userId);
var patched = dbPatched?.ToPatchDefaultUserSchedule(userId, userDefault.Id);
- return new PatchDefaultScheduleForUserResponse
- {
- Success = true,
- Patched = patched
- };
+ sw.Stop();
+ result.Success = true;
+ result.Patched = patched;
+ result.ElapsedMilliseconds = sw.ElapsedMilliseconds;
+ return result;
DbRoosterDefault? DbQuery(PatchDefaultUserSchedule body, Guid userId)
{
diff --git a/src/Server/Services/ScheduleService.cs b/src/Server/Services/ScheduleService.cs
index 2fa89403..777cc93c 100644
--- a/src/Server/Services/ScheduleService.cs
+++ b/src/Server/Services/ScheduleService.cs
@@ -27,7 +27,7 @@ public async Task ScheduleForUserAsync(Guid userId, G
var startDate = (new DateTime(yearStart, monthStart, dayStart, 0, 0, 0)).ToUniversalTime();
var tillDate = (new DateTime(yearEnd, monthEnd, dayEnd, 23, 59, 59, 999)).ToUniversalTime();
var defaults = await _database.RoosterDefaults.Where(x => x.CustomerId == customerId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
- var defaultAveUser = await _database.UserDefaultAvailables.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
+ var defaultAveUser = await _database.UserDefaultAvailables.Include(x=>x.DefaultGroup).Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
var userHolidays = await _database.UserHolidays.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
var trainings = _database.RoosterTrainings.Where(x => x.CustomerId == customerId && x.DateStart >= startDate && x.DateStart <= tillDate);
var availables = await _database.RoosterAvailables.Where(x => x.CustomerId == customerId && x.UserId == userId && x.Date >= startDate && x.Date <= tillDate).ToListAsync(cancellationToken: clt);
@@ -119,7 +119,7 @@ private static void GetAvailability(List? defaultAveUser
}
if ((setBy != AvailabilitySetBy.User && setBy != AvailabilitySetBy.Holiday && setBy is null) || availabilty is null || availabilty == Availabilty.None)
{
- defAvaForUser = defaultAveUser?.FirstOrDefault(x => x.RoosterDefaultId == roosterDefaultId && x.ValidFrom <= start && x.ValidUntil >= end && (userId is null || x.UserId == userId));
+ defAvaForUser = defaultAveUser?.Where(x => x.RoosterDefaultId == roosterDefaultId && x.ValidFrom <= start && x.ValidUntil >= end && (userId is null || x.UserId == userId)).OrderBy(x => x.DefaultGroup?.IsDefault).FirstOrDefault();
if (defAvaForUser?.Available != null)
{
availabilty = defAvaForUser.Available;
@@ -285,7 +285,7 @@ public async Task ScheduleForAllAsync(Guid userId, Guid
var tillDate = (new DateTime(yearEnd, monthEnd, dayEnd, 23, 59, 59, 999)).ToUniversalTime();
var users = await _database.Users.Include(x => x.UserDefaultAvailables).Include(x => x.UserFunction).Where(x => x.CustomerId == customerId && x.DeletedOn == null && x.UserFunction!.IsActive).ToListAsync(cancellationToken: clt);
var defaults = await _database.RoosterDefaults.Where(x => x.CustomerId == customerId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
- var defaultAveUser = await _database.UserDefaultAvailables.Where(x => x.CustomerId == customerId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
+ var defaultAveUser = await _database.UserDefaultAvailables.Include(x => x.DefaultGroup).Where(x => x.CustomerId == customerId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
var userHolidays = await _database.UserHolidays.Where(x => x.CustomerId == customerId && x.ValidFrom <= tillDate && x.ValidUntil >= startDate).ToListAsync(cancellationToken: clt);
var trainings = _database.RoosterTrainings.Where(x => x.CustomerId == customerId && x.DateStart >= startDate && x.DateStart <= tillDate).ToList();
var availables = _database.RoosterAvailables.Where(x => x.CustomerId == customerId && (includeUnAssigned || x.Assigned) && x.Date >= startDate && x.Date <= tillDate).ToList();
@@ -466,7 +466,7 @@ public async Task GetPlannedTrainingById(Guid custom
{
result = await dDbTrainingToGetPlannedTrainingResponse(result, dbTraining, clt);
- var ava = await _database.UserDefaultAvailables.Where(x => x.CustomerId == customerId && x.RoosterDefaultId == dbTraining!.RoosterDefaultId).ToListAsync(cancellationToken: clt);
+ var ava = await _database.UserDefaultAvailables.Include(x => x.DefaultGroup).Where(x => x.CustomerId == customerId && x.RoosterDefaultId == dbTraining!.RoosterDefaultId).ToListAsync(cancellationToken: clt);
var userHolidays = await _database.UserHolidays.Where(x => x.CustomerId == customerId && x.ValidFrom <= dbTraining.DateEnd.AddDays(1) && x.ValidUntil >= dbTraining.DateStart.AddDays(-1)).ToListAsync(cancellationToken: clt);
var availables = _database.RoosterAvailables.Where(x => x.CustomerId == customerId && x.TrainingId == trainingId);
var users = await _database.Users.Include(x => x.UserFunction).Where(x => x.CustomerId == customerId && x.DeletedOn == null && x.UserFunction!.IsActive).ToListAsync(cancellationToken: clt);
@@ -522,7 +522,7 @@ public async Task GetPlannedTrainingForDefaultDate(G
var trainingEnd = date.Date.AddHours(def.TimeEnd.Hour).AddMinutes(def.TimeEnd.Minute).AddSeconds(def.TimeEnd.Second);
var users = await _database.Users.Include(x => x.UserDefaultAvailables).Include(x => x.UserFunction).Where(x => x.CustomerId == customerId && x.DeletedOn == null && x.UserFunction!.IsActive).ToListAsync(cancellationToken: clt);
- var defaultAveUser = await _database.UserDefaultAvailables.Where(x => x.CustomerId == customerId && x.ValidFrom <= trainingStart && x.ValidUntil >= trainingEnd).ToListAsync(cancellationToken: clt);
+ var defaultAveUser = await _database.UserDefaultAvailables.Include(x => x.DefaultGroup).Where(x => x.CustomerId == customerId && x.ValidFrom <= trainingStart && x.ValidUntil >= trainingEnd).ToListAsync(cancellationToken: clt);
var userHolidays = await _database.UserHolidays.Where(x => x.CustomerId == customerId && x.ValidFrom <= trainingStart && x.ValidUntil >= trainingEnd).ToListAsync(cancellationToken: clt);
var newPlanner = new PlannedTraining
@@ -706,7 +706,7 @@ public async Task GetScheduledTrainingsFor
var sw = Stopwatch.StartNew();
var result = new GetScheduledTrainingsForUserResponse();
var userHolidays = await _database.UserHolidays.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= fromDate).ToListAsync(cancellationToken: clt);
- var defaultAveUser = await _database.UserDefaultAvailables.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= fromDate).ToListAsync(cancellationToken: clt);
+ var defaultAveUser = await _database.UserDefaultAvailables.Include(x => x.DefaultGroup).Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= fromDate).ToListAsync(cancellationToken: clt);
var scheduled = await _database.RoosterAvailables
.Where(x => x.CustomerId == customerId && x.UserId == userId && x.Assigned == true && x.Training.DeletedOn == null && (fromDate == null || x.Date >= fromDate))
.Include(i => i.Training.RoosterAvailables)
@@ -789,7 +789,7 @@ public async Task GetPinnedTrainingsForUser(G
.OrderBy(x => x.DateStart)
.ToListAsync(cancellationToken: token);
var userHolidays = await _database.UserHolidays.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= fromDate).ToListAsync(cancellationToken: token);
- var defaultAveUser = await _database.UserDefaultAvailables.Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= fromDate).ToListAsync(cancellationToken: token);
+ var defaultAveUser = await _database.UserDefaultAvailables.Include(x => x.DefaultGroup).Where(x => x.CustomerId == customerId && x.UserId == userId && x.ValidFrom <= fromDate).ToListAsync(cancellationToken: token);
foreach (var training in trainings)
{
diff --git a/src/Shared/Drogecode.Knrm.Oefenrooster.Shared.csproj b/src/Shared/Drogecode.Knrm.Oefenrooster.Shared.csproj
index 61827c13..425d5d98 100644
--- a/src/Shared/Drogecode.Knrm.Oefenrooster.Shared.csproj
+++ b/src/Shared/Drogecode.Knrm.Oefenrooster.Shared.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/tests/Drogecode.Knrm.Oefenrooster.TestClient/Drogecode.Knrm.Oefenrooster.TestClient.csproj b/tests/Drogecode.Knrm.Oefenrooster.TestClient/Drogecode.Knrm.Oefenrooster.TestClient.csproj
index 2b809103..a8e0118f 100644
--- a/tests/Drogecode.Knrm.Oefenrooster.TestClient/Drogecode.Knrm.Oefenrooster.TestClient.csproj
+++ b/tests/Drogecode.Knrm.Oefenrooster.TestClient/Drogecode.Knrm.Oefenrooster.TestClient.csproj
@@ -19,7 +19,7 @@
-
+
diff --git a/tests/Drogecode.Knrm.Oefenrooster.TestServer/Drogecode.Knrm.Oefenrooster.TestServer.csproj b/tests/Drogecode.Knrm.Oefenrooster.TestServer/Drogecode.Knrm.Oefenrooster.TestServer.csproj
index 424b0e2e..8fe14af5 100644
--- a/tests/Drogecode.Knrm.Oefenrooster.TestServer/Drogecode.Knrm.Oefenrooster.TestServer.csproj
+++ b/tests/Drogecode.Knrm.Oefenrooster.TestServer/Drogecode.Knrm.Oefenrooster.TestServer.csproj
@@ -16,9 +16,9 @@
-
+
-
+
diff --git a/tests/Drogecode.Knrm.Oefenrooster.TestServer/Tests/ControllerTests/DefaultScheduleControllerTests.cs b/tests/Drogecode.Knrm.Oefenrooster.TestServer/Tests/ControllerTests/DefaultScheduleControllerTests.cs
index c13420ec..4e63cb16 100644
--- a/tests/Drogecode.Knrm.Oefenrooster.TestServer/Tests/ControllerTests/DefaultScheduleControllerTests.cs
+++ b/tests/Drogecode.Knrm.Oefenrooster.TestServer/Tests/ControllerTests/DefaultScheduleControllerTests.cs
@@ -1,6 +1,7 @@
using Drogecode.Knrm.Oefenrooster.Server.Controllers;
using Drogecode.Knrm.Oefenrooster.Server.Database;
using Drogecode.Knrm.Oefenrooster.Shared.Enums;
+using Drogecode.Knrm.Oefenrooster.Shared.Helpers;
using Drogecode.Knrm.Oefenrooster.Shared.Models.DefaultSchedule;
using Drogecode.Knrm.Oefenrooster.Shared.Services.Interfaces;
using System;
@@ -158,7 +159,7 @@ public async Task PutScheduleToNewGroupTest()
{
var body = new DefaultGroup
{
- Name = "PutGroupTest",
+ Name = "PutScheduleToNewGroupTest",
ValidFrom = DateTime.Today.AddDays(4),
ValidUntil = DateTime.Today.AddDays(9),
IsDefault = false,
@@ -177,5 +178,59 @@ public async Task PutScheduleToNewGroupTest()
};
var patchResult = await DefaultScheduleController.PatchDefaultScheduleForUser(defaultSchedule);
Assert.NotNull(patchResult.Value?.Patched?.UserDefaultAvailableId);
+
+ var allForGroup = await DefaultScheduleController.GetAllByGroupId(newGroup.Id);
+ allForGroup.Value!.DefaultSchedules!.FirstOrDefault(x => x.Id == DefaultDefaultSchedule)!.UserSchedules.Should().Contain(x => x.UserDefaultAvailableId == patchResult.Value!.Patched!.UserDefaultAvailableId);
+
+ var idDefaultGroup = (await DefaultScheduleController.GetAllGroups()).Value!.Groups!.FirstOrDefault(x => x.IsDefault)!.Id;
+ var allForDefaultGroup = await DefaultScheduleController.GetAllByGroupId(idDefaultGroup);
+ allForDefaultGroup.Value!.DefaultSchedules!.FirstOrDefault(x => x.Id == DefaultDefaultSchedule)!.UserSchedules.Should().NotContain(x => x.UserDefaultAvailableId == patchResult.Value!.Patched!.UserDefaultAvailableId);
+ }
+
+ [Fact]
+ public async Task ConflictingDefaultsTest()
+ {
+ MockAuthenticatedUser(DefaultScheduleController, DefaultUserId, DefaultCustomerId);
+ MockAuthenticatedUser(ScheduleController, DefaultUserId, DefaultCustomerId);
+ var idDefaultGroup = (await DefaultScheduleController.GetAllGroups()).Value!.Groups!.FirstOrDefault(x => x.IsDefault)!.Id;
+ var body = new DefaultGroup
+ {
+ Name = "ConflictingDefaultsTest",
+ ValidFrom = new DateTime(2020, 6, 12),
+ ValidUntil = new DateTime(2020, 12, 13),
+ IsDefault = false,
+ };
+ var newGroup = (await DefaultScheduleController.PutGroup(body)).Value!.Group;
+ var defaultSchedule = new PatchDefaultUserSchedule
+ {
+ GroupId = idDefaultGroup,
+ UserDefaultAvailableId = null,
+ DefaultId = DefaultDefaultSchedule,
+ Assigned = false,
+ Available = Availabilty.NotAvailable,
+ ValidFromUser = new DateTime(2020, 1, 12)
+ };
+ var patchResult = await DefaultScheduleController.PatchDefaultScheduleForUser(defaultSchedule);
+ defaultSchedule.GroupId = newGroup!.Id;
+ defaultSchedule.Available = Availabilty.Available;
+ patchResult = await DefaultScheduleController.PatchDefaultScheduleForUser(defaultSchedule);
+
+ // default default
+ var scheduledTraining = await ScheduleController.GetPlannedTrainingForDefaultDate(new DateTime(2020, 2, 10), DefaultDefaultSchedule);
+ scheduledTraining.Value?.Training.Should().NotBeNull();
+ scheduledTraining.Value!.Training!.PlanUsers.Should().NotBeNull();
+ var user = scheduledTraining.Value.Training.PlanUsers.FirstOrDefault(x => x.UserId == DefaultUserId);
+ user.Should().NotBeNull();
+ user!.Availabilty.Should().Be(Availabilty.NotAvailable);
+
+ // group default
+ scheduledTraining = await ScheduleController.GetPlannedTrainingForDefaultDate(new DateTime(2020, 8, 10), DefaultDefaultSchedule);
+ scheduledTraining.Value?.Training.Should().NotBeNull();
+ scheduledTraining.Value!.Training!.PlanUsers.Should().NotBeNull();
+ user = scheduledTraining.Value.Training.PlanUsers.FirstOrDefault(x => x.UserId == DefaultUserId);
+ user.Should().NotBeNull();
+ user!.Availabilty.Should().Be(Availabilty.Available);
+ MockAuthenticatedUser(DefaultScheduleController, DefaultSettingsHelper.IdTaco, DefaultCustomerId);
+ MockAuthenticatedUser(ScheduleController, DefaultSettingsHelper.IdTaco, DefaultCustomerId);
}
}