diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 9409310d..1dfeada3 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "mapster.tool": { - "version": "6.5.0", + "version": "8.0.0", "commands": [ "dotnet-mapster" ] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5d3ece05..e34e38c4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,7 +2,7 @@ # the repo. Unless a later match takes precedence, # @global-owner1 and @global-owner2 will be requested for # review when someone opens a pull request. -* @devinleighsmith @WadeBarnes @seeker25 @marzmehr +* @devinleighsmith @WadeBarnes @marzmehr # Order is important; the last matching pattern takes the most # precedence. When someone opens a pull request that only diff --git a/api/Startup.cs b/api/Startup.cs index af1c8272..4018a482 100644 --- a/api/Startup.cs +++ b/api/Startup.cs @@ -26,6 +26,8 @@ using SS.Api.services.ef; using SS.Db.models; using Microsoft.Extensions.Logging; +using Quartz; +using SS.Api.cronjobs; namespace SS.Api { @@ -137,6 +139,12 @@ public void ConfigureServices(IServiceCollection services) }); services.AddSwaggerGenNewtonsoftSupport(); + + services.AddQuartz(q => + { + q.AddJobAndTrigger(Configuration); + }); + services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/api/api.csproj b/api/api.csproj index 4cb06732..dd4a0c01 100644 --- a/api/api.csproj +++ b/api/api.csproj @@ -1,23 +1,22 @@  - netcoreapp3.1 + net5.0 SS.Api de959767-ede6-4f8a-b6b9-d36aed70339C 6224c484-3e23-4f06-a749-195c1e478110 - bin\$(Configuration)\netcoreapp3.1\api.xml + bin\$(Configuration)\net5.0\api.xml 1701;1702;1591 1701;1702;1591 - bin\$(Configuration)\netcoreapp3.1\api.xml + bin\$(Configuration)\net5.0\api.xml - - + @@ -34,10 +33,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/api/appsettings.json b/api/appsettings.json index 0a918c81..bd01df92 100644 --- a/api/appsettings.json +++ b/api/appsettings.json @@ -1,5 +1,7 @@ { "WebBaseHref": "/sheriff-scheduling/", + "PdfUrl": "http://localhost:5001", + "TrainingNotification": "0 30 5 * * ?", // Hint: Override these in secrets when doing local development. ByPassAuthAndUseImpersonatedUser - only works in development mode. "ByPassAuthAndUseImpersonatedUser": "true", "ImpersonateUser": { diff --git a/api/controllers/AuthController.cs b/api/controllers/AuthController.cs index 244777aa..7d62ffde 100644 --- a/api/controllers/AuthController.cs +++ b/api/controllers/AuthController.cs @@ -84,9 +84,9 @@ public async Task Logout() var baseUri = HttpContext.Request.Headers.ContainsKey("X-Forwarded-Host") ? $"{Configuration.GetNonEmptyValue("WebBaseHref")}logout" : "/api"; var applicationUrl = $"{XForwardedForHelper.BuildUrlString(forwardedHost, forwardedPort, baseUri)}"; - var keycloakLogoutUrl = $"{logoutUrl}?post_logout_redirect_uri={applicationUrl}"; + var keycloakLogoutUrl = $"{logoutUrl}?redirect_uri={applicationUrl}"; var siteminderLogoutUrl = $"{Configuration.GetNonEmptyValue("SiteMinderLogoutUrl")}?returl={keycloakLogoutUrl}&retnow=1"; - return Redirect(siteminderLogoutUrl); + return Redirect(keycloakLogoutUrl); } [HttpGet("requestAccess")] diff --git a/api/controllers/scheduling/DistributeScheduleController.cs b/api/controllers/scheduling/DistributeScheduleController.cs index a2019910..63fd880c 100644 --- a/api/controllers/scheduling/DistributeScheduleController.cs +++ b/api/controllers/scheduling/DistributeScheduleController.cs @@ -8,6 +8,7 @@ using SS.Api.helpers; using SS.Api.helpers.extensions; using SS.Api.infrastructure.authorization; +using SS.Api.models.dto; using SS.Api.models.dto.generated; using SS.Api.services.scheduling; using SS.Common.helpers.extensions; @@ -17,6 +18,7 @@ namespace SS.Api.controllers.scheduling { [Route("api/[controller]")] + [ApiController] public class DistributeScheduleController : ControllerBase { private DistributeScheduleService DistributeScheduleService { get; } @@ -24,7 +26,7 @@ public class DistributeScheduleController : ControllerBase private SheriffDbContext Db { get; } private IConfiguration Configuration { get; } - public DistributeScheduleController(DistributeScheduleService distributeSchedule, ShiftService shiftService, SheriffDbContext db, IConfiguration configuration) + public DistributeScheduleController(DistributeScheduleService distributeSchedule, ShiftService shiftService, SheriffDbContext db, IConfiguration configuration) { DistributeScheduleService = distributeSchedule; ShiftService = shiftService; @@ -73,5 +75,25 @@ public async Task>> GetDistributeSchedul return Ok(shiftsWithDuties.Adapt>()); } + + [HttpPost("print")] + [PermissionClaimAuthorize(perm: Permission.ViewDistributeSchedule)] + public async Task Print(PdfHtml pdfhtml) + { + var pdfContent = await DistributeScheduleService.PrintService(pdfhtml.html); + return new FileContentResult(pdfContent, "application/pdf"); + } + + [HttpPost("email")] + [PermissionClaimAuthorize(perm: Permission.ViewDistributeSchedule)] + public async Task Email(PdfHtml pdfhtml) + { + var pdfContent = await DistributeScheduleService.PrintService(pdfhtml.html); + + var senderEmail = $"{User.Email()}"; + await DistributeScheduleService.EmailService(senderEmail, pdfhtml.recipients, pdfhtml.emailSubject, pdfhtml.emailContent, pdfContent); + + return Ok("Email Sent."); + } } -} +} \ No newline at end of file diff --git a/api/controllers/usermanagement/SheriffController.cs b/api/controllers/usermanagement/SheriffController.cs index cc26c792..3778402e 100644 --- a/api/controllers/usermanagement/SheriffController.cs +++ b/api/controllers/usermanagement/SheriffController.cs @@ -32,15 +32,17 @@ public class SheriffController : UserController private ShiftService ShiftService { get; } private DutyRosterService DutyRosterService { get; } private SheriffDbContext Db { get; } + private TrainingService TrainingService { get; } // ReSharper disable once InconsistentNaming private readonly long _uploadPhotoSizeLimitKB; - public SheriffController(SheriffService sheriffService, DutyRosterService dutyRosterService, ShiftService shiftService, UserService userUserService, IConfiguration configuration, SheriffDbContext db) : base(userUserService) + public SheriffController(SheriffService sheriffService, DutyRosterService dutyRosterService, ShiftService shiftService, UserService userUserService,TrainingService trainingService, IConfiguration configuration, SheriffDbContext db) : base(userUserService) { SheriffService = sheriffService; ShiftService = shiftService; DutyRosterService = dutyRosterService; + TrainingService = trainingService; Db = db; _uploadPhotoSizeLimitKB = Convert.ToInt32(configuration.GetNonEmptyValue("UploadPhotoSizeLimitKB")); } @@ -155,6 +157,15 @@ public async Task> UploadPhoto(Guid? id, string badgeNu return Ok(sheriff.Adapt()); } + [HttpPut] + [Route("updateExcused")] + [PermissionClaimAuthorize(perm: Permission.GenerateReports)] + public async Task> UpdateExcused(Sheriff excusedSheriff) + { + var sheriff = await SheriffService.UpdateSheriffExcused(excusedSheriff); + return Ok(sheriff.Adapt()); + } + #endregion Sheriff #region SheriffAwayLocation @@ -268,8 +279,39 @@ public async Task RemoveSheriffLeave(int id, string expiryReason) #endregion SheriffLeave + #region SheriffTrainingReports + + [HttpPost] + [Route("training/reports")] + [PermissionClaimAuthorize(perm: Permission.GenerateReports)] + public async Task> GetSheriffsTrainingReports(TrainingReportSearchDto trainingReportSearch) + { + var sheriffs = await TrainingService.GetSheriffsTrainingReports(trainingReportSearch); + return Ok(sheriffs.Adapt>()); + } + + [HttpGet] + [Route("training/adjust-expiry")] + [PermissionClaimAuthorize(perm: Permission.AdjustTrainingExpiry)] + public async Task TrainingExpiryAdjustment() + { + await TrainingService.TrainingExpiryAdjustment(); + return Ok(new { result = "success"}); + } + + #endregion SheriffTrainingReports + #region SheriffTraining + [HttpGet] + [Route("training")] + [PermissionClaimAuthorize(perm: Permission.GenerateReports)] + public async Task> GetSheriffsTraining() + { + var sheriffs = await SheriffService.GetSheriffsTraining(); + return Ok(sheriffs.Adapt>()); + } + [HttpPost] [Route("training")] [PermissionClaimAuthorize(perm: Permission.EditUsers)] diff --git a/api/cronjobs/QuartzConfigService.cs b/api/cronjobs/QuartzConfigService.cs new file mode 100644 index 00000000..52e03654 --- /dev/null +++ b/api/cronjobs/QuartzConfigService.cs @@ -0,0 +1,34 @@ +using System; +using Microsoft.Extensions.Configuration; +using Quartz; + +namespace SS.Api.cronjobs +{ + public static class QuartzConfigService + { + public static void AddJobAndTrigger( + this IServiceCollectionQuartzConfigurator quartz, + IConfiguration config) + where T : IJob + { + + string jobName = typeof(T).Name; + var configKey = $"{jobName}"; + var cronSchedule = config[configKey]; + + if (string.IsNullOrEmpty(cronSchedule)) + { + throw new Exception($"No Quartz.NET Cron schedule found for job in configuration at {configKey}"); + } + + var jobKey = new JobKey(jobName); + quartz.AddJob(opts => opts.WithIdentity(jobKey)); + + quartz.AddTrigger(opts => opts + .ForJob(jobKey) + .WithIdentity(jobName + "-trigger") + .WithCronSchedule(cronSchedule)); + + } + } +} \ No newline at end of file diff --git a/api/cronjobs/TrainingNotification.cs b/api/cronjobs/TrainingNotification.cs new file mode 100644 index 00000000..25bfaada --- /dev/null +++ b/api/cronjobs/TrainingNotification.cs @@ -0,0 +1,89 @@ + + +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Quartz; +using SS.Api.services; +using SS.Api.services.usermanagement; +using SS.Db.models.sheriff; + +namespace SS.Api.cronjobs +{ + [DisallowConcurrentExecution] + public class TrainingNotification: IJob + { + private readonly ILogger Logger; + public IServiceProvider Services { get; } + + public TrainingNotification(ILogger logger, IServiceProvider services, ManageTypesService manageTypesService) + { + Logger = logger; + Services = services; + } + + public async void ProcessTrainings() + { + using var scope = Services.CreateScope(); + var TrainingService = scope.ServiceProvider.GetRequiredService(); + var ChesEmailService = scope.ServiceProvider.GetRequiredService(); + + var trainings = await TrainingService.GetTrainings(); + foreach(var training in trainings) + { + var noticeDate = DateTimeOffset.UtcNow.AddDays(training.TrainingType.AdvanceNotice); + + Logger.LogInformation(training.TrainingCertificationExpiry.ToString()); + Logger.LogInformation((training.TrainingCertificationExpiry < noticeDate).ToString()); + Logger.LogInformation(training.Sheriff.Email); + + if(training.TrainingCertificationExpiry < noticeDate){ + + bool rotatingTraining = TrainingService.IsRotatingTraining(training.TrainingType); + var emailBody = rotatingTraining? GetEmailRotatingBody(training) : GetEmailEndOfYearBody(training); + var emailTitle = rotatingTraining? "Training Expiry Notice" : "Training Requalification Notice"; + + var emailSent = await ChesEmailService.SendEmail( + emailBody, + emailTitle, + training.Sheriff.Email + ); + if(emailSent) + await TrainingService.UpdateTraining(training.Id); + } + } + Logger.LogInformation("CronJob Done"); + } + + public string GetEmailRotatingBody(SheriffTraining training) + { + var expiryDate = training.TrainingCertificationExpiry.Value.ToString("MMMM dd, yyyy"); + var emailBody = + $"Dear {training.Sheriff.FirstName} {training.Sheriff.LastName}, \n\n"+ + $"Your \'{training.TrainingType.Code}\' certification will expire on \'{expiryDate}\'. \n"+ + "Please ensure your certification is renewed before this date."; + + return emailBody; + } + + public string GetEmailEndOfYearBody(SheriffTraining training) + { + var expiryYear = training.TrainingCertificationExpiry.Value.AddDays(-1).AddYears(1).ToString("yyyy"); + var emailBody = + $"Dear {training.Sheriff.FirstName} {training.Sheriff.LastName}, \n\n"+ + $"Your \'{training.TrainingType.Code}\' certification will require renewal for the calendar year \'{expiryYear}\'. \n"+ + $"Please ensure you renew your certification between January 1st and December 31, {expiryYear}. \n\n" + + "It is recommended to schedule training early in the year to ensure end of year compliance."; + + return emailBody; + } + + public Task Execute(IJobExecutionContext context) + { + Logger.LogInformation("___Running CronJob___"); + ProcessTrainings(); + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/api/helpers/ConfigurationExtensions.cs b/api/helpers/ConfigurationExtensions.cs index 5f8380ce..e6d7d386 100644 --- a/api/helpers/ConfigurationExtensions.cs +++ b/api/helpers/ConfigurationExtensions.cs @@ -12,5 +12,13 @@ public static string GetNonEmptyValue(this IConfiguration configuration, string ? throw new ConfigurationException($"Configuration '{key}' is invalid or missing.") : configurationValue; } + + public static string GetBoolValue(this IConfiguration configuration, string key) + { + var configurationValue = configuration.GetValue(key); + return string.IsNullOrEmpty(configurationValue) + ? "false" + : configurationValue; + } } } \ No newline at end of file diff --git a/api/helpers/extensions/ClaimExtensions.cs b/api/helpers/extensions/ClaimExtensions.cs index 9b2ed387..3e6fc93b 100644 --- a/api/helpers/extensions/ClaimExtensions.cs +++ b/api/helpers/extensions/ClaimExtensions.cs @@ -11,14 +11,14 @@ public static class ClaimExtensions public static string GetValueByType(this IEnumerable claims, string type) => claims.FirstOrDefault(c => c.Type == type)?.Value; - public static string GetIdirUserName(this IEnumerable claims) => - claims.GetValueByType(CustomClaimTypes.IdirUserName).Replace("@idir", ""); + public static string GetIdirUserName(this IEnumerable claims) => + claims.GetValueByType(CustomClaimTypes.IdirUserName).Replace("@idir", "").ToLower(); public static Guid GetIdirId(this IEnumerable claims) => Guid.Parse(claims.GetValueByType(CustomClaimTypes.IdirId)); public static Guid GetKeyCloakId(this IEnumerable claims) => - Guid.Parse(claims.GetValueByType(ClaimTypes.NameIdentifier)); + Guid.Parse(claims.GetValueByType(ClaimTypes.NameIdentifier).Replace("@idir", "")); public static bool HasPermissions(this ClaimsPrincipal user, params string[] permissions) => user.HasClaim(c => c.Type == CustomClaimTypes.Permission) && permissions.All(perm => user.HasClaim(CustomClaimTypes.Permission, perm)); @@ -42,8 +42,11 @@ public static string FullName(this ClaimsPrincipal user) => public static string IdirId(this ClaimsPrincipal user) => user.FindFirstValue(CustomClaimTypes.IdirId); + public static string Email(this ClaimsPrincipal user) => + user.FindFirstValue(ClaimTypes.Email); + public static string IdirUserName(this ClaimsPrincipal user) => - user.FindFirstValue(CustomClaimTypes.IdirUserName).Replace("@idir",""); + user.FindFirstValue(CustomClaimTypes.IdirUserName).Replace("@idir", ""); public static Guid CurrentUserId(this ClaimsPrincipal user) { @@ -52,6 +55,5 @@ public static Guid CurrentUserId(this ClaimsPrincipal user) throw new InvalidOperationException("Missing UserId Guid from claims."); return userId; } - } -} +} \ No newline at end of file diff --git a/api/infrastructure/ServiceCollectionExtensions.cs b/api/infrastructure/ServiceCollectionExtensions.cs index 779d780b..b6b93fc4 100644 --- a/api/infrastructure/ServiceCollectionExtensions.cs +++ b/api/infrastructure/ServiceCollectionExtensions.cs @@ -70,6 +70,7 @@ public static IServiceCollection AddSSServices(this IServiceCollection services, services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); diff --git a/api/infrastructure/authorization/ClaimsTransformer.cs b/api/infrastructure/authorization/ClaimsTransformer.cs index 83dd0d69..d1e7054a 100644 --- a/api/infrastructure/authorization/ClaimsTransformer.cs +++ b/api/infrastructure/authorization/ClaimsTransformer.cs @@ -18,7 +18,7 @@ public class ClaimsTransformer : IClaimsTransformation private TimeSpan ClaimCachePeriod { get; } private bool _isTransformed; - public ClaimsTransformer(IMemoryCache cache, ClaimsService claimsService, IConfiguration configuration) + public ClaimsTransformer(IMemoryCache cache, ClaimsService claimsService, IConfiguration configuration) { Cache = cache; ClaimsService = claimsService; @@ -26,15 +26,15 @@ public ClaimsTransformer(IMemoryCache cache, ClaimsService claimsService, IConf } /// - /// Note these claims don't get saved in the cookie. + /// Note these claims don't get saved in the cookie. /// public async Task TransformAsync(ClaimsPrincipal principal) { if (!principal.Identity.IsAuthenticated || _isTransformed) return await Task.FromResult(principal); var currentPrincipal = (ClaimsIdentity)principal.Identity; var currentClaims = currentPrincipal.Claims.ToList(); - - var nameIdentifier = Guid.Parse(principal.FindFirstValue(ClaimTypes.NameIdentifier)); + + var nameIdentifier = Guid.Parse(principal.FindFirstValue(ClaimTypes.NameIdentifier).Replace("@idir", "")); if (!Cache.TryGetValue(nameIdentifier, out List claims)) { claims = await ClaimsService.GenerateClaims(currentClaims); @@ -46,9 +46,9 @@ public async Task TransformAsync(ClaimsPrincipal principal) } /// - /// This is so we can filter out the keycloak claims, as they're saved in the cookies and can be quite long. + /// This is so we can filter out the keycloak claims, as they're saved in the cookies and can be quite long. /// - public static List UsedProviderClaimTypes => + public static List UsedProviderClaimTypes => new List { ClaimTypes.NameIdentifier, CustomClaimTypes.IdirUserName, CustomClaimTypes.FullName, CustomClaimTypes.IdirId }; } -} +} \ No newline at end of file diff --git a/api/models/ches/ChesEmailOptions.cs b/api/models/ches/ChesEmailOptions.cs index 299f8d7e..ef3e72e7 100644 --- a/api/models/ches/ChesEmailOptions.cs +++ b/api/models/ches/ChesEmailOptions.cs @@ -22,4 +22,12 @@ public void ValidateOptions() SenderName.ThrowConfigurationExceptionIfNull($"{Position}:{SenderName}"); } } -} + + public class ChesEmailAttachment + { + public string content { get; set; } + public string contentType { get; set; } + public string encoding { get; set; } + public string filename { get; set; } + } +} \ No newline at end of file diff --git a/api/models/dto/AddLookupCodeDto.cs b/api/models/dto/AddLookupCodeDto.cs index b890cfb1..a378b1df 100644 --- a/api/models/dto/AddLookupCodeDto.cs +++ b/api/models/dto/AddLookupCodeDto.cs @@ -11,6 +11,11 @@ public class AddLookupCodeDto public DateTimeOffset? EffectiveDate { get; set; } public DateTimeOffset? ExpiryDate { get; set; } public int? LocationId { get; set; } + public bool? Mandatory { get; set; } + public bool? Rotating { get; set; } + public int? ValidityPeriod { get; set; } + public string? Category { get; set; } + public int? AdvanceNotice { get; set; } public AddLookupSortOrderDto SortOrderForLocation { get; set; } } } diff --git a/api/models/dto/PdfHtml.cs b/api/models/dto/PdfHtml.cs new file mode 100644 index 00000000..12d5fd14 --- /dev/null +++ b/api/models/dto/PdfHtml.cs @@ -0,0 +1,10 @@ +namespace SS.Api.models.dto +{ + public class PdfHtml + { + public string html { get; set; } + public string recipients { get; set; } + public string emailContent { get; set; } + public string emailSubject { get; set; } + } +} \ No newline at end of file diff --git a/api/models/dto/TrainingReportDto.cs b/api/models/dto/TrainingReportDto.cs new file mode 100644 index 00000000..a29a7501 --- /dev/null +++ b/api/models/dto/TrainingReportDto.cs @@ -0,0 +1,16 @@ +using System; + +namespace SS.Api.models.dto +{ + public class TrainingReportDto + { + public string name { get; set; } + public string trainingType { get; set; } + public DateTimeOffset? end { get; set; } + public DateTimeOffset? expiryDate { get; set; } + public bool excluded { get; set; } + public Guid sheriffId { get; set; } + public string status { get; set; } + public string _rowVariant { get; set; } + } +} \ No newline at end of file diff --git a/api/models/dto/TrainingReportSearchDto.cs b/api/models/dto/TrainingReportSearchDto.cs new file mode 100644 index 00000000..7b52535f --- /dev/null +++ b/api/models/dto/TrainingReportSearchDto.cs @@ -0,0 +1,14 @@ +using System; + + +namespace SS.Api.models.dto +{ + public class TrainingReportSearchDto + { + public int? regionId { get; set; } + public int? locationId { get; set; } + public int? reportSubtypeId { get; set; } + public DateTimeOffset? startDate { get; set; } + public DateTimeOffset? endDate { get; set; } + } +} \ No newline at end of file diff --git a/api/models/dto/generated/DutySlotDto.g.cs b/api/models/dto/generated/DutySlotDto.g.cs index ac0fb893..eb3402a6 100644 --- a/api/models/dto/generated/DutySlotDto.g.cs +++ b/api/models/dto/generated/DutySlotDto.g.cs @@ -20,6 +20,8 @@ public partial class DutySlotDto public bool IsOvertime { get; set; } public bool IsClosed { get; set; } public LookupCodeDto AssignmentLookupCode { get; set; } + public string DutyComment { get; set; } + public string AssignmentComment { get; set; } public uint ConcurrencyToken { get; set; } } } \ No newline at end of file diff --git a/api/models/dto/generated/LookupCodeDto.g.cs b/api/models/dto/generated/LookupCodeDto.g.cs index 16ab386b..5255a645 100644 --- a/api/models/dto/generated/LookupCodeDto.g.cs +++ b/api/models/dto/generated/LookupCodeDto.g.cs @@ -15,6 +15,11 @@ public partial class LookupCodeDto public DateTimeOffset? ExpiryDate { get; set; } public LocationDto Location { get; set; } public int? LocationId { get; set; } + public bool Mandatory { get; set; } + public int ValidityPeriod { get; set; } + public string Category { get; set; } + public int AdvanceNotice { get; set; } + public bool Rotating { get; set; } public uint ConcurrencyToken { get; set; } public LookupSortOrderDto SortOrderForLocation { get; set; } } diff --git a/api/models/dto/generated/SheriffDto.g.cs b/api/models/dto/generated/SheriffDto.g.cs index fe20f847..71982d91 100644 --- a/api/models/dto/generated/SheriffDto.g.cs +++ b/api/models/dto/generated/SheriffDto.g.cs @@ -16,6 +16,7 @@ public partial class SheriffDto public List Training { get; set; } public string PhotoUrl { get; set; } public DateTimeOffset LastPhotoUpdate { get; set; } + public bool Excused { get; set; } public Guid Id { get; set; } public bool IsEnabled { get; set; } public string FirstName { get; set; } diff --git a/api/models/dto/generated/SheriffTrainingDto.g.cs b/api/models/dto/generated/SheriffTrainingDto.g.cs index 3f19255d..7f406248 100644 --- a/api/models/dto/generated/SheriffTrainingDto.g.cs +++ b/api/models/dto/generated/SheriffTrainingDto.g.cs @@ -9,6 +9,7 @@ public partial class SheriffTrainingDto public int? TrainingTypeId { get; set; } public DateTimeOffset? TrainingCertificationExpiry { get; set; } public string Note { get; set; } + public bool FirstNotice { get; set; } public int Id { get; set; } public DateTimeOffset StartDate { get; set; } public DateTimeOffset EndDate { get; set; } diff --git a/api/models/dto/generated/ShiftAvailabilityConflictDto.g.cs b/api/models/dto/generated/ShiftAvailabilityConflictDto.g.cs new file mode 100644 index 00000000..5b17b66c --- /dev/null +++ b/api/models/dto/generated/ShiftAvailabilityConflictDto.g.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using SS.Api.models.dto.generated; +using SS.Db.models.scheduling.notmapped; + +namespace SS.Api.models.dto.generated +{ + public partial class ShiftAvailabilityConflictDto + { + public Guid? SheriffId { get; set; } + public ShiftConflictType Conflict { get; set; } + public DateTimeOffset Start { get; set; } + public DateTimeOffset End { get; set; } + public int? LocationId { get; set; } + public LocationDto Location { get; set; } + public int? ShiftId { get; set; } + public string WorkSection { get; set; } + public string Timezone { get; set; } + public double OvertimeHours { get; set; } + public string SheriffEventType { get; set; } + public string Comment { get; set; } + public ICollection DutySlots { get; set; } + } +} \ No newline at end of file diff --git a/api/models/dto/generated/ShiftAvailabilityDto.g.cs b/api/models/dto/generated/ShiftAvailabilityDto.g.cs index 85411abd..48daf9c3 100644 --- a/api/models/dto/generated/ShiftAvailabilityDto.g.cs +++ b/api/models/dto/generated/ShiftAvailabilityDto.g.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using SS.Api.models.dto.generated; -using SS.Db.models.scheduling.notmapped; namespace SS.Api.models.dto.generated { @@ -9,7 +8,7 @@ public partial class ShiftAvailabilityDto { public DateTimeOffset Start { get; set; } public DateTimeOffset End { get; set; } - public List Conflicts { get; set; } + public List Conflicts { get; set; } public SheriffDto Sheriff { get; set; } public Guid? SheriffId { get; set; } } diff --git a/api/models/types/TrainingStatus.cs b/api/models/types/TrainingStatus.cs new file mode 100644 index 00000000..7ef9de04 --- /dev/null +++ b/api/models/types/TrainingStatus.cs @@ -0,0 +1,8 @@ +namespace SS.Api.models.types +{ + public class TrainingStatus + { + public string status; + public string rowType; + } +} diff --git a/api/models/types/TrainingStatusTypes.cs b/api/models/types/TrainingStatusTypes.cs new file mode 100644 index 00000000..9249ebde --- /dev/null +++ b/api/models/types/TrainingStatusTypes.cs @@ -0,0 +1,10 @@ +namespace SS.Api.models.types +{ + public static class TrainingStatusTypes + { + public static readonly string danger = "Not Taken"; + public static readonly string alert = "Expired"; + public static readonly string warning = "Requalification"; + public static readonly string notify = "Notified"; + } +} diff --git a/api/services/ChesEmailService.cs b/api/services/ChesEmailService.cs index fb8e43c6..7b36c03e 100644 --- a/api/services/ChesEmailService.cs +++ b/api/services/ChesEmailService.cs @@ -56,7 +56,7 @@ public async Task GetEmailServiceToken() return null; } - public async Task SendEmail(string body, string subject, string recipientEmail) + public async Task SendEmail(string body, string subject, string recipientEmail) { body.ThrowIfNullOrEmpty(nameof(body)); subject.ThrowIfNullOrEmpty(nameof(subject)); @@ -81,7 +81,7 @@ public async Task SendEmail(string body, string subject, string recipientEmail) cc = new List(), delayTS = 0, encoding = "utf-8", - from = $@"{_chesEmailOptions.SenderName} <{_chesEmailOptions.SenderEmail}>", //This isn't clear in their documentation. + from = $@"{_chesEmailOptions.SenderName} <{_chesEmailOptions.SenderEmail}>", //This isn't clear in their documentation. priority = "normal", subject, to, @@ -97,12 +97,72 @@ public async Task SendEmail(string body, string subject, string recipientEmail) throw new BadRequestException($"While sending email - Received status code: {response.StatusCode} : {contents}"); Logger.LogInformation($"Email sent to {recipientEmail} successfully."); + return true; } catch (Exception e) { Logger.LogError(e, "Error happened while trying to send email."); + return false; } } - } -} + public async Task SendEmailWithPdfAttachment(string body, string subject, string from, string recipientEmail, byte[] pdfContent) + { + body.ThrowIfNullOrEmpty(nameof(body)); + subject.ThrowIfNullOrEmpty(nameof(subject)); + from.ThrowIfNullOrEmpty(nameof(from)); + recipientEmail.ThrowIfNullOrEmpty(nameof(recipientEmail)); + var attachments = new List(); + attachments.Add( + new ChesEmailAttachment + { + content = Convert.ToBase64String(pdfContent), + contentType = "application/pdf", + encoding = "base64", + filename = "Shift_Schedule.pdf" + } + ); + + var to = recipientEmail.Split(",").ToList(); + var emailServiceToken = await GetEmailServiceToken(); + emailServiceToken.ThrowIfNullOrEmpty(nameof(emailServiceToken)); + + var requestMessage = new HttpRequestMessage(HttpMethod.Post, _chesEmailOptions.EmailUrl); + requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", emailServiceToken); + + Logger.LogDebug($"Attempting to Send email to {recipientEmail}."); + try + { + var email = new + { + bcc = new List(), + bodyType = "text", + body, + cc = new List(), + delayTS = 0, + encoding = "utf-8", + from, + priority = "normal", + subject, + to, + tag = Guid.NewGuid(), + attachments + }; + + requestMessage.Content = + new StringContent(JsonConvert.SerializeObject(email), Encoding.UTF8, "application/json"); + + var response = await HttpClient.SendAsync(requestMessage); + var contents = await response.Content.ReadAsStringAsync(); + if (!response.IsSuccessStatusCode) + throw new BadRequestException($"While sending email - Received status code: {response.StatusCode} : {contents}"); + + Logger.LogInformation($"Email sent to {recipientEmail} successfully."); + } + catch (Exception e) + { + Logger.LogError(e, "Error happened while trying to send email."); + } + } + } +} \ No newline at end of file diff --git a/api/services/JC/JCDataUpdaterService.cs b/api/services/JC/JCDataUpdaterService.cs index a665fdde..9e4fd654 100644 --- a/api/services/JC/JCDataUpdaterService.cs +++ b/api/services/JC/JCDataUpdaterService.cs @@ -28,6 +28,7 @@ public class JCDataUpdaterService private bool ExpireRegions { get; } private bool ExpireLocations { get; } private bool ExpireRooms { get; } + private bool SkipLocationUpdates { get; } private bool AssociateUsersWithNoLocationToVictoria { get; } private TimeSpan UpdateEvery { get; } @@ -36,6 +37,7 @@ public JCDataUpdaterService(SheriffDbContext dbContext, LocationServicesClient l LocationClient = locationClient; Db = dbContext; Configuration = configuration; + SkipLocationUpdates = Configuration.GetBoolValue("SkipLocationUpdates").Equals("true"); ExpireRegions = Configuration.GetNonEmptyValue("JCSynchronization:ExpireRegions").Equals("true"); ExpireLocations = Configuration.GetNonEmptyValue("JCSynchronization:ExpireLocations").Equals("true"); ExpireRooms = Configuration.GetNonEmptyValue("JCSynchronization:ExpireCourtRooms").Equals("true"); @@ -55,6 +57,7 @@ public async Task ShouldSynchronize() return true; } + if(SkipLocationUpdates) return false; if (jcSynchronization.LastSynchronization.Add(UpdateEvery) > DateTimeOffset.UtcNow) return false; jcSynchronization.LastSynchronization = DateTimeOffset.UtcNow; await Db.SaveChangesAsync(); diff --git a/api/services/ManageTypesService.cs b/api/services/ManageTypesService.cs index f5b5fea9..b85e76b1 100644 --- a/api/services/ManageTypesService.cs +++ b/api/services/ManageTypesService.cs @@ -139,6 +139,26 @@ public async Task> GetAll(LookupTypes? codeType, int? locationI return lookupCodes; } + public async Task> GetAllForReports(int? id, LookupTypes? codeType, int? locationId, bool? mandatory, bool showExpired = false) + { + var lookupCodes = await Db.LookupCode.AsNoTracking() + .Include(lc => lc.SortOrder.Where(so => so.LocationId == locationId)) + .Where(lc => + (id == null || lc.Id == id) && + (codeType == null || lc.Type == codeType) && + (locationId == null || lc.LocationId == null || lc.LocationId == locationId) && + (mandatory == null || lc.Mandatory == mandatory) && + (showExpired || lc.ExpiryDate == null)) + .OrderBy(a => (int)a.Type) + .ThenBy(a => a.SortOrder.FirstOrDefault().SortOrder) + .ThenBy(a => a.Id) + .ToListAsync(); + + lookupCodes.ForEach(lc => lc.SortOrderForLocation = lc.SortOrder.FirstOrDefault()); + + return lookupCodes; + } + public async Task Find(int id) => await Db.LookupCode.AsNoTracking().FirstOrDefaultAsync(lc => lc.Id == id); public async Task Expire(int id) diff --git a/api/services/scheduling/DistributeScheduleService.cs b/api/services/scheduling/DistributeScheduleService.cs index 73ba9740..956a9ac3 100644 --- a/api/services/scheduling/DistributeScheduleService.cs +++ b/api/services/scheduling/DistributeScheduleService.cs @@ -1,8 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net.Http; +using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using SS.Api.helpers; using SS.Api.helpers.extensions; using SS.Common.helpers.extensions; using SS.Db.models; @@ -14,14 +18,19 @@ namespace SS.Api.services.scheduling public class DistributeScheduleService { private SheriffDbContext Db { get; } - public DistributeScheduleService(SheriffDbContext db) + private IConfiguration Configuration { get; } + private ChesEmailService ChesEmailService { get; } + + public DistributeScheduleService(SheriffDbContext db, IConfiguration configuration, ChesEmailService chesEmailService) { + Configuration = configuration; + ChesEmailService = chesEmailService; Db = db; } public async Task> GetDistributeSchedule(List shiftAvailabilities, bool includeWorkSection, DateTimeOffset start, DateTimeOffset end, int locationId) { - var shiftIds = shiftAvailabilities.SelectMany(s=> s.Conflicts) + var shiftIds = shiftAvailabilities.SelectMany(s => s.Conflicts) .Where(c => c.Conflict == ShiftConflictType.Scheduled).SelectDistinctToList(s => s.ShiftId); var shifts = await Db.Shift.AsSingleQuery().AsNoTracking() @@ -57,13 +66,15 @@ private List CombineShiftAvailability(ShiftAvailabili .Date }); - var newAvailabilityConflict = shiftAvailability.Conflicts.WhereToList(c => c.Conflict != ShiftConflictType.Scheduled); - foreach (var group in shiftsGroupedByDate) - { - var earliestShiftForDate = group.First(s => s.Start == group.Min(s => s.Start)); - earliestShiftForDate.End = group.Max(s => s.End); - newAvailabilityConflict.Add(earliestShiftForDate); - } + var newAvailabilityConflict = shiftAvailability.Conflicts; + // TODO + //.WhereToList(c => c.Conflict != ShiftConflictType.Scheduled); + //foreach (var group in shiftsGroupedByDate) + //{ + // var earliestShiftForDate = group.First(s => s.Start == group.Min(s => s.Start)); + // earliestShiftForDate.End = group.Max(s => s.End); + // newAvailabilityConflict.Add(earliestShiftForDate); + //} if (includeWorkSection) newAvailabilityConflict = DetermineWorkSections(newAvailabilityConflict, shifts); @@ -74,10 +85,29 @@ private List CombineShiftAvailability(ShiftAvailabili private List DetermineWorkSections(List availabilityConflicts, List shifts) { foreach (var availabilityConflict in availabilityConflicts) + { availabilityConflict.WorkSection = shifts.FirstOrDefault(s => s.Id == availabilityConflict.ShiftId)?.WorkSection; + availabilityConflict.DutySlots = + shifts.FirstOrDefault(s => s.Id == availabilityConflict.ShiftId)?.DutySlots; + } return availabilityConflicts; } + + public async Task PrintService(String html) + { + HttpClient HttpClient = new HttpClient(); + var requestMessage = new HttpRequestMessage(HttpMethod.Post, Configuration.GetNonEmptyValue("PdfUrl") + "/pdf?bootstrap=true"); + requestMessage.Content = new StringContent(html, Encoding.UTF8); + var pdfResponse = await HttpClient.SendAsync(requestMessage); + var content = await pdfResponse.Content.ReadAsByteArrayAsync(); + return content; + } + + public async Task EmailService(String senderEmail, String recipientEmails, String emailSubject, String emailContent, byte[] pdfContent) + { + await ChesEmailService.SendEmailWithPdfAttachment(emailContent, emailSubject, senderEmail, recipientEmails, pdfContent); + } } -} +} \ No newline at end of file diff --git a/api/services/usermanagement/SheriffService.cs b/api/services/usermanagement/SheriffService.cs index 3c0e2a08..b55f0fff 100644 --- a/api/services/usermanagement/SheriffService.cs +++ b/api/services/usermanagement/SheriffService.cs @@ -164,6 +164,15 @@ public async Task UpdateSheriffPhoto(Guid? id, string badgeNumber, byte return savedSheriff; } + public async Task UpdateSheriffExcused(Sheriff sheriff) + { + var savedSheriff = await Db.Sheriff.FindAsync(sheriff.Id); + savedSheriff.ThrowBusinessExceptionIfNull($"No {nameof(Sheriff)} with Id: {sheriff.Id}"); + savedSheriff.Excused = sheriff.Excused; + await Db.SaveChangesAsync(); + return savedSheriff; + } + public async Task UpdateSheriffHomeLocation(Guid id, int locationId) { var savedSheriff = await Db.Sheriff.FindAsync(id); @@ -330,6 +339,22 @@ public async Task RemoveSheriffLeave(int id, string expiryReason) #region Sheriff Training + public async Task> GetSheriffsTraining() + { + var daysPrevious = int.Parse(Configuration.GetNonEmptyValue("DaysInPastToIncludeAwayLocationAndTraining")); + var minDateForAwayAndTraining = DateTimeOffset.UtcNow.AddDays(-daysPrevious); + var sevenDaysFromNow = DateTimeOffset.UtcNow.AddDays(7); + + var sheriffQuery = Db.Sheriff.AsNoTracking() + .AsSplitQuery() + .ApplyPermissionFilters(User, minDateForAwayAndTraining, sevenDaysFromNow, Db) + .Include(s => s.Training.Where(t => t.ExpiryDate == null)) + .ThenInclude(t => t.TrainingType) + .Where(t => t.Training.Count > 0); + + return await sheriffQuery.ToListAsync(); + } + public async Task AddSheriffTraining(DutyRosterService dutyRosterService, ShiftService shiftService, SheriffTraining sheriffTraining, bool overrideConflicts) { ValidateStartAndEndDates(sheriffTraining.StartDate, sheriffTraining.EndDate); diff --git a/api/services/usermanagement/TrainingService.cs b/api/services/usermanagement/TrainingService.cs new file mode 100644 index 00000000..5d2feb24 --- /dev/null +++ b/api/services/usermanagement/TrainingService.cs @@ -0,0 +1,230 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using SS.Api.helpers.extensions; +using SS.Api.infrastructure.exceptions; +using SS.Api.models.dto; +using SS.Db.models; +using SS.Db.models.lookupcodes; +using SS.Db.models.sheriff; +using SS.Api.models.types; +using SS.Common.helpers.extensions; +using ss.db.models; +using Microsoft.Extensions.Logging; + +namespace SS.Api.services.usermanagement +{ + + public class TrainingService + { + private SheriffDbContext Db { get; } + private ManageTypesService ManageTypesService { get; } + private ILogger Logger { get; } + public static readonly IList YearsInDays = new List{365, 730, 1095, 1461, 1826, 2191, 2556, 2922, 3287, 3652}; + + public TrainingService(ManageTypesService manageTypesService, SheriffDbContext db, ILogger logger) + { + ManageTypesService = manageTypesService; + Db = db; + Logger = logger; + } + + + #region Training CronJob + public async Task> GetTrainings() + { + var sheriffTrainingQuery = Db.SheriffTraining.AsNoTracking() + .AsSplitQuery() + .Where(t => t.ExpiryDate == null) + .Where(t => t.FirstNotice != true) + .Where(t => t.TrainingType.AdvanceNotice > 0) + .Include(t => t.TrainingType) + .Include(t => t.Sheriff); + + return await sheriffTrainingQuery.ToListAsync(); + } + + public async Task UpdateTraining(int trainingId) + { + var training = await Db.SheriffTraining.FindAsync(trainingId); + training.ThrowBusinessExceptionIfNull( + $"{nameof(SheriffTraining)} with the id: {trainingId} could not be found. "); + + if (training.ExpiryDate.HasValue) + throw new BusinessLayerException($"{nameof(SheriffTraining)} with the id: {trainingId} has been expired"); + + training.FirstNotice = true; + await Db.SaveChangesAsync(); + } + + #endregion Training CronJob + + + + #region Training Reports + public async Task> GetSheriffsTrainingReports(TrainingReportSearchDto trainingReportSearch) + { + Logger.LogInformation("__________Start_Creating_Reports___________"); + var sheriffQuery = Db.Sheriff.AsNoTracking() + .AsSplitQuery() + .Where(s => + s.IsEnabled && + (trainingReportSearch.locationId == null || s.HomeLocationId==trainingReportSearch.locationId) + ) + .Include(s => s.Training.Where(t => t.ExpiryDate == null)) + .ThenInclude(t => t.TrainingType) + .Include(s => s.HomeLocation) + .Where(s => trainingReportSearch.regionId == null || s.HomeLocation.RegionId==trainingReportSearch.regionId); + + var sheriffs = await sheriffQuery.ToListAsync(); + + List mandatoryTrainings = await ManageTypesService.GetAllForReports(trainingReportSearch.reportSubtypeId, LookupTypes.TrainingType, null, true, false); + List optionalTrainings = await ManageTypesService.GetAllForReports(trainingReportSearch.reportSubtypeId, LookupTypes.TrainingType, null, false, false); + + var sheriffTrainings = new List(); + + foreach (var sheriff in sheriffs) + { + var sheriffTrainingsId = sheriff.Training.Select(t => t.TrainingTypeId).ToArray(); + List optionalSheriffTrainings = optionalTrainings.FindAll(t => sheriffTrainingsId.Contains(t.Id)); + List allSheriffTrainings = new List(); + allSheriffTrainings.AddRange(optionalSheriffTrainings); + allSheriffTrainings.AddRange(mandatoryTrainings); + + foreach (var training in allSheriffTrainings) + { + if (!sheriffTrainingsId.Contains(training.Id)) + { + sheriffTrainings.Add(new TrainingReportDto() + { + name = sheriff.FirstName + ' ' + sheriff.LastName, + trainingType = training.Description, + end = null, + expiryDate = null, + excluded = sheriff.Excused, + sheriffId = sheriff.Id, + status = TrainingStatusTypes.danger, + _rowVariant = "danger" + }); + } + else + { + var takenTraining = sheriff.Training.Find(t => t.TrainingTypeId == training.Id); + var timezone = takenTraining.Timezone == null? "America/Vancouver" : takenTraining.Timezone; + var trainingStatus = GetTrainingStatus(takenTraining.TrainingCertificationExpiry, timezone, training.AdvanceNotice, training, takenTraining.FirstNotice); + + sheriffTrainings.Add(new TrainingReportDto() + { + name = sheriff.FirstName + ' ' + sheriff.LastName, + trainingType = training.Description, + end = takenTraining.EndDate.ConvertToTimezone(timezone), + expiryDate = takenTraining.TrainingCertificationExpiry != null ? ((DateTimeOffset)takenTraining.TrainingCertificationExpiry).ConvertToTimezone(timezone): null, + excluded = sheriff.Excused, + sheriffId = sheriff.Id, + status = trainingStatus.status, + _rowVariant = trainingStatus.rowType + }); + } + } + } + + Logger.LogInformation("__________End_Creating_Reports____________"); + + if(trainingReportSearch.startDate != null && trainingReportSearch.endDate != null) + return sheriffTrainings.FindAll(t => + t.end>=trainingReportSearch.startDate && + t.end<=trainingReportSearch.endDate + ); + else + return sheriffTrainings; + } + + #endregion Training Reports + + + #region Training Expiry Adjustment + public async Task TrainingExpiryAdjustment() + { + var trainingsQuery = Db.SheriffTraining + .AsNoTracking() + .Where(t => t.ExpiryDate == null) + .Include(t => t.TrainingType); + var allTrainings = await trainingsQuery.ToListAsync(); + int processCounter = 0; + int allTrainingsCounts = allTrainings.Count(); + + foreach (var training in allTrainings) + { + if(training.TrainingType.ValidityPeriod > 0){ + var timezone = training.Timezone == null? "America/Vancouver" : training.Timezone; + if(!IsRotatingTraining(training.TrainingType)){ + int years = (training.TrainingType.ValidityPeriod / 365) - 1; + training.TrainingCertificationExpiry = training.EndDate.EndOfYearWithTimezone(years, timezone); + }else{ + training.TrainingCertificationExpiry = training.EndDate.AddDays(training.TrainingType.ValidityPeriod).ConvertToTimezone(timezone);//moment(this.selectedEndDate).add(this.selectedTrainingType.validityPeriod, 'days').format("YYYY-MM-DD"); + } + var noticeDate = DateTimeOffset.UtcNow.AddDays(training.TrainingType.AdvanceNotice); + if(training.TrainingCertificationExpiry > noticeDate){ + training.FirstNotice = false; + } + } + else{ + training.TrainingCertificationExpiry = null; + training.FirstNotice = false; + } + Db.Entry(training).Property(x => x.TrainingCertificationExpiry).IsModified = true; + Db.Entry(training).Property(x => x.FirstNotice).IsModified = true; + Db.SaveChanges(); + + processCounter++; + Logger.LogInformation($"_______Training Expiry Adjustment__{processCounter}_of_{allTrainingsCounts}_______"); + } + + } + + #endregion Training Expiry Adjustment + + + #region Help Methods + + private TrainingStatus GetTrainingStatus(DateTimeOffset? requalificationDate, string timezone, int advanceNotice, LookupCode trainingType, bool firstNotice) + { + TrainingStatus trainingStatus = new TrainingStatus(); + + var todayDate = DateTimeOffset.UtcNow.ConvertToTimezone(timezone); + var advanceNoticeDate = DateTimeOffset.UtcNow.AddDays(advanceNotice).ConvertToTimezone(timezone); + var expiryDate = IsRotatingTraining(trainingType)? requalificationDate : requalificationDate?.AddYears(1); + + if(todayDate > expiryDate) + { + trainingStatus.rowType = "alert"; + trainingStatus.status = TrainingStatusTypes.alert; + } + else if(todayDate > requalificationDate) + { + trainingStatus.rowType = "warning"; + trainingStatus.status = TrainingStatusTypes.warning; + } + else if((advanceNoticeDate > requalificationDate) && firstNotice) + { + trainingStatus.rowType = "notify"; + trainingStatus.status = TrainingStatusTypes.notify; + } + else + { + trainingStatus.rowType = "white"; + trainingStatus.status = ""; + } + + return trainingStatus; + } + + public bool IsRotatingTraining(LookupCode trainingType){ + return trainingType.Rotating || !YearsInDays.Contains(trainingType.ValidityPeriod); + } + + #endregion Help Methods + } +} \ No newline at end of file diff --git a/common/authorization/CustomClaimTypes.cs b/common/authorization/CustomClaimTypes.cs index 27e00035..e0afcdd3 100644 --- a/common/authorization/CustomClaimTypes.cs +++ b/common/authorization/CustomClaimTypes.cs @@ -3,12 +3,12 @@ public static class CustomClaimTypes { public const string FullName = "name"; - public const string IdirId = "idir_userid"; - public const string IdirUserName = "preferred_username"; + public const string IdirId = "idir_user_guid"; + public const string IdirUserName = "idir_username"; public const string FirstName = nameof(CustomClaimTypes) + nameof(FirstName); public const string LastName = nameof(CustomClaimTypes) + nameof(LastName); public const string UserId = nameof(CustomClaimTypes) + nameof(UserId); - public const string Permission = nameof(CustomClaimTypes)+ nameof(Permission); + public const string Permission = nameof(CustomClaimTypes) + nameof(Permission); public const string HomeLocationId = nameof(CustomClaimTypes) + nameof(HomeLocationId); } -} +} \ No newline at end of file diff --git a/common/common.csproj b/common/common.csproj index 4e601402..c679f236 100644 --- a/common/common.csproj +++ b/common/common.csproj @@ -1,13 +1,13 @@ - netcoreapp3.1 + net5.0 SS.Common SS.Common - + diff --git a/common/helpers/extensions/DateTimeOffsetExtensions.cs b/common/helpers/extensions/DateTimeOffsetExtensions.cs index 05e9beab..e3acf04b 100644 --- a/common/helpers/extensions/DateTimeOffsetExtensions.cs +++ b/common/helpers/extensions/DateTimeOffsetExtensions.cs @@ -40,6 +40,15 @@ public static DateTimeOffset ConvertToTimezone(this DateTimeOffset date, string return zoned.ToDateTimeOffset(); } + public static DateTimeOffset EndOfYearWithTimezone(this DateTimeOffset date, int yearOffset, string timezone) + { + var endDate = new DateTime(date.Year+yearOffset, 12, 31, 23, 59, 59); + var locationTimeZone = DateTimeZoneProviders.Tzdb[timezone]; + var instant = Instant.FromDateTimeOffset(endDate); + var zoned = instant.InZone(locationTimeZone); + return zoned.ToDateTimeOffset(); + } + private static string GetTimezoneAbbreviation(DateTimeOffset date, string timezone) { var abbreviations = TZNames.GetAbbreviationsForTimeZone(timezone, "en-CA"); diff --git a/db/configuration/PermissionConfiguration.cs b/db/configuration/PermissionConfiguration.cs index c13bf113..b5ac2c91 100644 --- a/db/configuration/PermissionConfiguration.cs +++ b/db/configuration/PermissionConfiguration.cs @@ -45,7 +45,9 @@ public override void Configure(EntityTypeBuilder builder) new Permission { Id = 39, Name = Permission.RemovePastTraining, Description = "Remove Past Training" }, new Permission { Id = 40, Name = Permission.ViewDutyRosterInFuture, Description = "View DutyRoster in the future" }, new Permission { Id = 41, Name = Permission.ViewAllFutureShifts, Description = "View Shifts in the future (not time constrained)" }, - new Permission { Id = 42, Name = Permission.ViewOtherProfiles, Description = "View other profiles (beside their own)" } + new Permission { Id = 42, Name = Permission.ViewOtherProfiles, Description = "View other profiles (beside their own)" }, + new Permission { Id = 43, Name = Permission.GenerateReports, Description = "Generate Reports based on Sheriff's activity" }, + new Permission { Id = 44, Name = Permission.AdjustTrainingExpiry, Description = "Adjust Training Expiry Dates based on new rules" } ); base.Configure(builder); } diff --git a/db/db.csproj b/db/db.csproj index 2015b9b7..e939bf78 100644 --- a/db/db.csproj +++ b/db/db.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 SS.Db true @@ -92,7 +92,7 @@ - + @@ -101,7 +101,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all diff --git a/db/migrations/20230103171941_UpdatePErmissions_7.Designer.cs b/db/migrations/20230103171941_UpdatePErmissions_7.Designer.cs new file mode 100644 index 00000000..a74afd7d --- /dev/null +++ b/db/migrations/20230103171941_UpdatePErmissions_7.Designer.cs @@ -0,0 +1,2378 @@ +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS.Db.models; + +namespace SS.Db.Migrations +{ + [DbContext(typeof(SheriffDbContext))] + [Migration("20230103171941_UpdatePErmissions_7")] + partial class UpdatePErmissions_7 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityByDefaultColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AgencyId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinCode") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentLocationId") + .HasColumnType("integer"); + + b.Property("RegionId") + .HasColumnType("integer"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AgencyId") + .IsUnique(); + + b.HasIndex("CreatedById"); + + b.HasIndex("RegionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Location"); + + b.HasData( + new + { + Id = 1, + AgencyId = "SS1", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of Professional Standards", + Timezone = "America/Vancouver" + }, + new + { + Id = 2, + AgencyId = "SS2", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Sheriff Provincial Operation Centre", + Timezone = "America/Vancouver" + }, + new + { + Id = 3, + AgencyId = "SS3", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Central Float Pool", + Timezone = "America/Vancouver" + }, + new + { + Id = 4, + AgencyId = "SS4", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "ITAU", + Timezone = "America/Vancouver" + }, + new + { + Id = 5, + AgencyId = "SS5", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of the Chief Sheriff", + Timezone = "America/Vancouver" + }, + new + { + Id = 6, + AgencyId = "SS6", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + JustinCode = "4882", + Name = "South Okanagan Escort Centre", + Timezone = "America/Vancouver" + }); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("KeyValues") + .HasColumnType("jsonb"); + + b.Property("NewValues") + .HasColumnType("jsonb"); + + b.Property("OldValues") + .HasColumnType("jsonb"); + + b.Property("TableName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("KeyValues"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Permission"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Allows the user to login.", + Name = "Login" + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Profile (User)", + Name = "CreateUsers" + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Profile (User)", + Name = "ExpireUsers" + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Profile (User)", + Name = "EditUsers" + }, + new + { + Id = 8, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View all Roles", + Name = "ViewRoles" + }, + new + { + Id = 9, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Roles", + Name = "CreateAndAssignRoles" + }, + new + { + Id = 10, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Roles", + Name = "ExpireRoles" + }, + new + { + Id = 11, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Roles", + Name = "EditRoles" + }, + new + { + Id = 13, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Types", + Name = "CreateTypes" + }, + new + { + Id = 14, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Types", + Name = "EditTypes" + }, + new + { + Id = 15, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Types", + Name = "ExpireTypes" + }, + new + { + Id = 16, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View shifts", + Name = "ViewShifts" + }, + new + { + Id = 19, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Shifts", + Name = "CreateAndAssignShifts" + }, + new + { + Id = 20, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Shifts", + Name = "ExpireShifts" + }, + new + { + Id = 21, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Shifts", + Name = "EditShifts" + }, + new + { + Id = 22, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Distribute Schedule", + Name = "ViewDistributeSchedule" + }, + new + { + Id = 23, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Assigned Location", + Name = "ViewAssignedLocation" + }, + new + { + Id = 24, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Region (all locations within region)", + Name = "ViewRegion" + }, + new + { + Id = 25, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Province (all regions, all locations)", + Name = "ViewProvince" + }, + new + { + Id = 27, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Home Location", + Name = "ViewHomeLocation" + }, + new + { + Id = 28, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Import Shifts", + Name = "ImportShifts" + }, + new + { + Id = 30, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Assignments", + Name = "CreateAssignments" + }, + new + { + Id = 31, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Assignments", + Name = "EditAssignments" + }, + new + { + Id = 32, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Assignments", + Name = "ExpireAssignments" + }, + new + { + Id = 33, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Duties", + Name = "ViewDutyRoster" + }, + new + { + Id = 34, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Duties", + Name = "CreateAndAssignDuties" + }, + new + { + Id = 35, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Duties", + Name = "EditDuties" + }, + new + { + Id = 36, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Duties", + Name = "ExpireDuties" + }, + new + { + Id = 37, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Idir", + Name = "EditIdir" + }, + new + { + Id = 38, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Past Training", + Name = "EditPastTraining" + }, + new + { + Id = 39, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Remove Past Training", + Name = "RemovePastTraining" + }, + new + { + Id = 40, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View DutyRoster in the future", + Name = "ViewDutyRosterInFuture" + }, + new + { + Id = 41, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Shifts in the future (not time constrained)", + Name = "ViewAllFutureShifts" + }, + new + { + Id = 42, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View other profiles (beside their own)", + Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(50L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Administrator", + Name = "Administrator" + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Manager", + Name = "Manager" + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sheriff", + Name = "Sheriff" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(100L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PermissionId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("RolePermission"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("HomeLocationId") + .HasColumnType("integer"); + + b.Property("IdirId") + .HasColumnType("uuid"); + + b.Property("IdirName") + .HasColumnType("text"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("KeyCloakId") + .HasColumnType("uuid"); + + b.Property("LastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("HomeLocationId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("User"); + + b.HasDiscriminator("Discriminator").HasValue("User"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0000-000000000001"), + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + FirstName = "SYSTEM", + IsEnabled = false, + LastName = "SYSTEM" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(5000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("UserId"); + + b.HasIndex("RoleId", "UserId") + .IsUnique(); + + b.ToTable("UserRole"); + }); + + modelBuilder.Entity("SS.Db.models.jc.JcSynchronization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("LastSynchronization") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("JcSynchronization"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("LookupCodeId", "LocationId") + .IsUnique(); + + b.ToTable("LookupSortOrder"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 1, + SortOrder = 1 + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 2, + SortOrder = 2 + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 3, + SortOrder = 3 + }, + new + { + Id = 4, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 4, + SortOrder = 4 + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 5, + SortOrder = 5 + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 6, + SortOrder = 6 + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 7, + SortOrder = 7 + }); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AdhocEndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("AdhocStartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("End") + .HasColumnType("interval"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Friday") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("Monday") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Saturday") + .HasColumnType("boolean"); + + b.Property("Start") + .HasColumnType("interval"); + + b.Property("Sunday") + .HasColumnType("boolean"); + + b.Property("Thursday") + .HasColumnType("boolean"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("Tuesday") + .HasColumnType("boolean"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("Wednesday") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Assignment"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Duty"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("DutyId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsClosed") + .HasColumnType("boolean"); + + b.Property("IsNotAvailable") + .HasColumnType("boolean"); + + b.Property("IsNotRequired") + .HasColumnType("boolean"); + + b.Property("IsOvertime") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DutyId"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("DutySlot"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AnticipatedAssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("OvertimeHours") + .HasColumnType("double precision"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AnticipatedAssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Shift"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Rank") + .HasColumnType("text"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffActingRank"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffAwayLocation"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LeaveTypeId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LeaveTypeId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffLeave"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Note") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("TrainingCertificationExpiry") + .HasColumnType("timestamp with time zone"); + + b.Property("TrainingTypeId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("TrainingTypeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffTraining"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("JustinId") + .IsUnique(); + + b.HasIndex("UpdatedById"); + + b.ToTable("Region"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SubCode") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("Type", "Code", "LocationId") + .IsUnique(); + + b.ToTable("LookupCode"); + + b.HasData( + new + { + Id = 1, + Code = "Chief Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Chief Sheriff", + Type = 7 + }, + new + { + Id = 2, + Code = "Superintendent", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Superintendent", + Type = 7 + }, + new + { + Id = 3, + Code = "Staff Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Inspector", + Type = 7 + }, + new + { + Id = 4, + Code = "Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Inspector", + Type = 7 + }, + new + { + Id = 5, + Code = "Staff Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Sergeant", + Type = 7 + }, + new + { + Id = 6, + Code = "Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sergeant", + Type = 7 + }, + new + { + Id = 7, + Code = "Deputy Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Deputy Sheriff", + Type = 7 + }, + new + { + Id = 8, + Code = "CEW (Taser)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "CEW (Taser)", + Type = 6 + }, + new + { + Id = 9, + Code = "DNA", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "DNA", + Type = 6 + }, + new + { + Id = 10, + Code = "FRO", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "FRO", + Type = 6 + }, + new + { + Id = 11, + Code = "Fire Arm", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Fire Arm", + Type = 6 + }, + new + { + Id = 12, + Code = "First Aid", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "First Aid", + Type = 6 + }, + new + { + Id = 13, + Code = "Advanced Escort SPC (AESOC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Advanced Escort SPC (AESOC)", + Type = 6 + }, + new + { + Id = 14, + Code = "Extenuating Circumstances SPC (EXSPC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Extenuating Circumstances SPC (EXSPC)", + Type = 6 + }, + new + { + Id = 15, + Code = "Search Gate", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Search Gate", + Type = 6 + }, + new + { + Id = 16, + Code = "Other", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Other", + Type = 6 + }, + new + { + Id = 17, + Code = "STIP", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "STIP", + Type = 5 + }, + new + { + Id = 18, + Code = "Annual", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Annual", + Type = 5 + }, + new + { + Id = 19, + Code = "Illness", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Illness", + Type = 5 + }, + new + { + Id = 20, + Code = "Special", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Special", + Type = 5 + }); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.HasBaseType("SS.Db.models.auth.User"); + + b.Property("BadgeNumber") + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastPhotoUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasColumnType("bytea"); + + b.Property("Rank") + .HasColumnType("text"); + + b.HasIndex("BadgeNumber") + .IsUnique(); + + b.HasDiscriminator().HasValue("Sheriff"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("db.models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Region"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Permission", "Permission") + .WithMany() + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Permission"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "HomeLocation") + .WithMany() + .HasForeignKey("HomeLocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("HomeLocation"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany("SortOrder") + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany() + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "Assignment") + .WithMany() + .HasForeignKey("AssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Assignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.scheduling.Duty", "Duty") + .WithMany("DutySlots") + .HasForeignKey("DutyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Duty"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "AnticipatedAssignment") + .WithMany() + .HasForeignKey("AnticipatedAssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("AnticipatedAssignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("ActingRank") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("AwayLocation") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ss.db.models.LookupCode", "LeaveType") + .WithMany() + .HasForeignKey("LeaveTypeId"); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Leave") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("LeaveType"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Training") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "TrainingType") + .WithMany() + .HasForeignKey("TrainingTypeId"); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("TrainingType"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Navigation("DutySlots"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Navigation("SortOrder"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.Navigation("ActingRank"); + + b.Navigation("AwayLocation"); + + b.Navigation("Leave"); + + b.Navigation("Training"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/db/migrations/20230103171941_UpdatePErmissions_7.cs b/db/migrations/20230103171941_UpdatePErmissions_7.cs new file mode 100644 index 00000000..23c7d1c6 --- /dev/null +++ b/db/migrations/20230103171941_UpdatePErmissions_7.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SS.Db.Migrations +{ + public partial class UpdatePErmissions_7 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Permission", + columns: new[] { "Id", "CreatedById", "Description", "Name", "UpdatedById", "UpdatedOn" }, + values: new object[] { 43, null, "Generate Reports based on Sheriff's activity", "GenerateReports", null, null }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Permission", + keyColumn: "Id", + keyValue: 43); + } + } +} diff --git a/db/migrations/20230819011757_UpdateLookupCode_TrainingExtra.Designer.cs b/db/migrations/20230819011757_UpdateLookupCode_TrainingExtra.Designer.cs new file mode 100644 index 00000000..00babb55 --- /dev/null +++ b/db/migrations/20230819011757_UpdateLookupCode_TrainingExtra.Designer.cs @@ -0,0 +1,2450 @@ +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS.Db.models; + +namespace SS.Db.Migrations +{ + [DbContext(typeof(SheriffDbContext))] + [Migration("20230819011757_UpdateLookupCode_TrainingExtra")] + partial class UpdateLookupCode_TrainingExtra + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityByDefaultColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AgencyId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinCode") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentLocationId") + .HasColumnType("integer"); + + b.Property("RegionId") + .HasColumnType("integer"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AgencyId") + .IsUnique(); + + b.HasIndex("CreatedById"); + + b.HasIndex("RegionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Location"); + + b.HasData( + new + { + Id = 1, + AgencyId = "SS1", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of Professional Standards", + Timezone = "America/Vancouver" + }, + new + { + Id = 2, + AgencyId = "SS2", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Sheriff Provincial Operation Centre", + Timezone = "America/Vancouver" + }, + new + { + Id = 3, + AgencyId = "SS3", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Central Float Pool", + Timezone = "America/Vancouver" + }, + new + { + Id = 4, + AgencyId = "SS4", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "ITAU", + Timezone = "America/Vancouver" + }, + new + { + Id = 5, + AgencyId = "SS5", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of the Chief Sheriff", + Timezone = "America/Vancouver" + }, + new + { + Id = 6, + AgencyId = "SS6", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + JustinCode = "4882", + Name = "South Okanagan Escort Centre", + Timezone = "America/Vancouver" + }); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("KeyValues") + .HasColumnType("jsonb"); + + b.Property("NewValues") + .HasColumnType("jsonb"); + + b.Property("OldValues") + .HasColumnType("jsonb"); + + b.Property("TableName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("KeyValues"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Permission"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Allows the user to login.", + Name = "Login" + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Profile (User)", + Name = "CreateUsers" + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Profile (User)", + Name = "ExpireUsers" + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Profile (User)", + Name = "EditUsers" + }, + new + { + Id = 8, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View all Roles", + Name = "ViewRoles" + }, + new + { + Id = 9, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Roles", + Name = "CreateAndAssignRoles" + }, + new + { + Id = 10, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Roles", + Name = "ExpireRoles" + }, + new + { + Id = 11, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Roles", + Name = "EditRoles" + }, + new + { + Id = 13, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Types", + Name = "CreateTypes" + }, + new + { + Id = 14, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Types", + Name = "EditTypes" + }, + new + { + Id = 15, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Types", + Name = "ExpireTypes" + }, + new + { + Id = 16, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View shifts", + Name = "ViewShifts" + }, + new + { + Id = 19, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Shifts", + Name = "CreateAndAssignShifts" + }, + new + { + Id = 20, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Shifts", + Name = "ExpireShifts" + }, + new + { + Id = 21, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Shifts", + Name = "EditShifts" + }, + new + { + Id = 22, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Distribute Schedule", + Name = "ViewDistributeSchedule" + }, + new + { + Id = 23, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Assigned Location", + Name = "ViewAssignedLocation" + }, + new + { + Id = 24, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Region (all locations within region)", + Name = "ViewRegion" + }, + new + { + Id = 25, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Province (all regions, all locations)", + Name = "ViewProvince" + }, + new + { + Id = 27, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Home Location", + Name = "ViewHomeLocation" + }, + new + { + Id = 28, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Import Shifts", + Name = "ImportShifts" + }, + new + { + Id = 30, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Assignments", + Name = "CreateAssignments" + }, + new + { + Id = 31, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Assignments", + Name = "EditAssignments" + }, + new + { + Id = 32, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Assignments", + Name = "ExpireAssignments" + }, + new + { + Id = 33, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Duties", + Name = "ViewDutyRoster" + }, + new + { + Id = 34, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Duties", + Name = "CreateAndAssignDuties" + }, + new + { + Id = 35, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Duties", + Name = "EditDuties" + }, + new + { + Id = 36, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Duties", + Name = "ExpireDuties" + }, + new + { + Id = 37, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Idir", + Name = "EditIdir" + }, + new + { + Id = 38, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Past Training", + Name = "EditPastTraining" + }, + new + { + Id = 39, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Remove Past Training", + Name = "RemovePastTraining" + }, + new + { + Id = 40, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View DutyRoster in the future", + Name = "ViewDutyRosterInFuture" + }, + new + { + Id = 41, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Shifts in the future (not time constrained)", + Name = "ViewAllFutureShifts" + }, + new + { + Id = 42, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View other profiles (beside their own)", + Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(50L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Administrator", + Name = "Administrator" + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Manager", + Name = "Manager" + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sheriff", + Name = "Sheriff" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(100L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PermissionId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("RolePermission"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("HomeLocationId") + .HasColumnType("integer"); + + b.Property("IdirId") + .HasColumnType("uuid"); + + b.Property("IdirName") + .HasColumnType("text"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("KeyCloakId") + .HasColumnType("uuid"); + + b.Property("LastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("HomeLocationId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("User"); + + b.HasDiscriminator("Discriminator").HasValue("User"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0000-000000000001"), + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + FirstName = "SYSTEM", + IsEnabled = false, + LastName = "SYSTEM" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(5000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("UserId"); + + b.HasIndex("RoleId", "UserId") + .IsUnique(); + + b.ToTable("UserRole"); + }); + + modelBuilder.Entity("SS.Db.models.jc.JcSynchronization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("LastSynchronization") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("JcSynchronization"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("LookupCodeId", "LocationId") + .IsUnique(); + + b.ToTable("LookupSortOrder"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 1, + SortOrder = 1 + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 2, + SortOrder = 2 + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 3, + SortOrder = 3 + }, + new + { + Id = 4, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 4, + SortOrder = 4 + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 5, + SortOrder = 5 + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 6, + SortOrder = 6 + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 7, + SortOrder = 7 + }); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AdhocEndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("AdhocStartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("End") + .HasColumnType("interval"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Friday") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("Monday") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Saturday") + .HasColumnType("boolean"); + + b.Property("Start") + .HasColumnType("interval"); + + b.Property("Sunday") + .HasColumnType("boolean"); + + b.Property("Thursday") + .HasColumnType("boolean"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("Tuesday") + .HasColumnType("boolean"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("Wednesday") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Assignment"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Duty"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("DutyId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsClosed") + .HasColumnType("boolean"); + + b.Property("IsNotAvailable") + .HasColumnType("boolean"); + + b.Property("IsNotRequired") + .HasColumnType("boolean"); + + b.Property("IsOvertime") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DutyId"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("DutySlot"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AnticipatedAssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("OvertimeHours") + .HasColumnType("double precision"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AnticipatedAssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Shift"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Rank") + .HasColumnType("text"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffActingRank"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffAwayLocation"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LeaveTypeId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LeaveTypeId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffLeave"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Note") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("TrainingCertificationExpiry") + .HasColumnType("timestamp with time zone"); + + b.Property("TrainingTypeId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("TrainingTypeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffTraining"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("JustinId") + .IsUnique(); + + b.HasIndex("UpdatedById"); + + b.ToTable("Region"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("AdvanceNotice") + .HasColumnType("integer"); + + b.Property("Category") + .HasColumnType("text"); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("Mandatory") + .HasColumnType("boolean"); + + b.Property("SubCode") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("ValidityPeriod") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("Type", "Code", "LocationId") + .IsUnique(); + + b.ToTable("LookupCode"); + + b.HasData( + new + { + Id = 1, + AdvanceNotice = 0, + Code = "Chief Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Chief Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 2, + AdvanceNotice = 0, + Code = "Superintendent", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Superintendent", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 3, + AdvanceNotice = 0, + Code = "Staff Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 4, + AdvanceNotice = 0, + Code = "Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 5, + AdvanceNotice = 0, + Code = "Staff Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 6, + AdvanceNotice = 0, + Code = "Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 7, + AdvanceNotice = 0, + Code = "Deputy Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Deputy Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 8, + AdvanceNotice = 0, + Code = "CEW (Taser)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "CEW (Taser)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 9, + AdvanceNotice = 0, + Code = "DNA", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "DNA", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 10, + AdvanceNotice = 0, + Code = "FRO", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "FRO", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 11, + AdvanceNotice = 0, + Code = "Fire Arm", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Fire Arm", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 12, + AdvanceNotice = 0, + Code = "First Aid", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "First Aid", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 13, + AdvanceNotice = 0, + Code = "Advanced Escort SPC (AESOC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Advanced Escort SPC (AESOC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 14, + AdvanceNotice = 0, + Code = "Extenuating Circumstances SPC (EXSPC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Extenuating Circumstances SPC (EXSPC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 15, + AdvanceNotice = 0, + Code = "Search Gate", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Search Gate", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 16, + AdvanceNotice = 0, + Code = "Other", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Other", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 17, + AdvanceNotice = 0, + Code = "STIP", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "STIP", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 18, + AdvanceNotice = 0, + Code = "Annual", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Annual", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 19, + AdvanceNotice = 0, + Code = "Illness", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Illness", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 20, + AdvanceNotice = 0, + Code = "Special", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Special", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.HasBaseType("SS.Db.models.auth.User"); + + b.Property("BadgeNumber") + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastPhotoUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasColumnType("bytea"); + + b.Property("Rank") + .HasColumnType("text"); + + b.HasIndex("BadgeNumber") + .IsUnique(); + + b.HasDiscriminator().HasValue("Sheriff"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("db.models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Region"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Permission", "Permission") + .WithMany() + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Permission"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "HomeLocation") + .WithMany() + .HasForeignKey("HomeLocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("HomeLocation"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany("SortOrder") + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany() + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "Assignment") + .WithMany() + .HasForeignKey("AssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Assignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.scheduling.Duty", "Duty") + .WithMany("DutySlots") + .HasForeignKey("DutyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Duty"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "AnticipatedAssignment") + .WithMany() + .HasForeignKey("AnticipatedAssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("AnticipatedAssignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("ActingRank") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("AwayLocation") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ss.db.models.LookupCode", "LeaveType") + .WithMany() + .HasForeignKey("LeaveTypeId"); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Leave") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("LeaveType"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Training") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "TrainingType") + .WithMany() + .HasForeignKey("TrainingTypeId"); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("TrainingType"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Navigation("DutySlots"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Navigation("SortOrder"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.Navigation("ActingRank"); + + b.Navigation("AwayLocation"); + + b.Navigation("Leave"); + + b.Navigation("Training"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/db/migrations/20230819011757_UpdateLookupCode_TrainingExtra.cs b/db/migrations/20230819011757_UpdateLookupCode_TrainingExtra.cs new file mode 100644 index 00000000..d18abd4c --- /dev/null +++ b/db/migrations/20230819011757_UpdateLookupCode_TrainingExtra.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SS.Db.Migrations +{ + public partial class UpdateLookupCode_TrainingExtra : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AdvanceNotice", + table: "LookupCode", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Category", + table: "LookupCode", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "Mandatory", + table: "LookupCode", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ValidityPeriod", + table: "LookupCode", + type: "integer", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AdvanceNotice", + table: "LookupCode"); + + migrationBuilder.DropColumn( + name: "Category", + table: "LookupCode"); + + migrationBuilder.DropColumn( + name: "Mandatory", + table: "LookupCode"); + + migrationBuilder.DropColumn( + name: "ValidityPeriod", + table: "LookupCode"); + } + } +} diff --git a/db/migrations/20230826223829_UpdateSheriffTraining_AddNotice.Designer.cs b/db/migrations/20230826223829_UpdateSheriffTraining_AddNotice.Designer.cs new file mode 100644 index 00000000..64e73491 --- /dev/null +++ b/db/migrations/20230826223829_UpdateSheriffTraining_AddNotice.Designer.cs @@ -0,0 +1,2453 @@ +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS.Db.models; + +namespace SS.Db.Migrations +{ + [DbContext(typeof(SheriffDbContext))] + [Migration("20230826223829_UpdateSheriffTraining_AddNotice")] + partial class UpdateSheriffTraining_AddNotice + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityByDefaultColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AgencyId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinCode") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentLocationId") + .HasColumnType("integer"); + + b.Property("RegionId") + .HasColumnType("integer"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AgencyId") + .IsUnique(); + + b.HasIndex("CreatedById"); + + b.HasIndex("RegionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Location"); + + b.HasData( + new + { + Id = 1, + AgencyId = "SS1", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of Professional Standards", + Timezone = "America/Vancouver" + }, + new + { + Id = 2, + AgencyId = "SS2", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Sheriff Provincial Operation Centre", + Timezone = "America/Vancouver" + }, + new + { + Id = 3, + AgencyId = "SS3", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Central Float Pool", + Timezone = "America/Vancouver" + }, + new + { + Id = 4, + AgencyId = "SS4", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "ITAU", + Timezone = "America/Vancouver" + }, + new + { + Id = 5, + AgencyId = "SS5", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of the Chief Sheriff", + Timezone = "America/Vancouver" + }, + new + { + Id = 6, + AgencyId = "SS6", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + JustinCode = "4882", + Name = "South Okanagan Escort Centre", + Timezone = "America/Vancouver" + }); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("KeyValues") + .HasColumnType("jsonb"); + + b.Property("NewValues") + .HasColumnType("jsonb"); + + b.Property("OldValues") + .HasColumnType("jsonb"); + + b.Property("TableName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("KeyValues"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Permission"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Allows the user to login.", + Name = "Login" + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Profile (User)", + Name = "CreateUsers" + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Profile (User)", + Name = "ExpireUsers" + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Profile (User)", + Name = "EditUsers" + }, + new + { + Id = 8, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View all Roles", + Name = "ViewRoles" + }, + new + { + Id = 9, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Roles", + Name = "CreateAndAssignRoles" + }, + new + { + Id = 10, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Roles", + Name = "ExpireRoles" + }, + new + { + Id = 11, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Roles", + Name = "EditRoles" + }, + new + { + Id = 13, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Types", + Name = "CreateTypes" + }, + new + { + Id = 14, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Types", + Name = "EditTypes" + }, + new + { + Id = 15, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Types", + Name = "ExpireTypes" + }, + new + { + Id = 16, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View shifts", + Name = "ViewShifts" + }, + new + { + Id = 19, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Shifts", + Name = "CreateAndAssignShifts" + }, + new + { + Id = 20, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Shifts", + Name = "ExpireShifts" + }, + new + { + Id = 21, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Shifts", + Name = "EditShifts" + }, + new + { + Id = 22, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Distribute Schedule", + Name = "ViewDistributeSchedule" + }, + new + { + Id = 23, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Assigned Location", + Name = "ViewAssignedLocation" + }, + new + { + Id = 24, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Region (all locations within region)", + Name = "ViewRegion" + }, + new + { + Id = 25, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Province (all regions, all locations)", + Name = "ViewProvince" + }, + new + { + Id = 27, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Home Location", + Name = "ViewHomeLocation" + }, + new + { + Id = 28, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Import Shifts", + Name = "ImportShifts" + }, + new + { + Id = 30, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Assignments", + Name = "CreateAssignments" + }, + new + { + Id = 31, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Assignments", + Name = "EditAssignments" + }, + new + { + Id = 32, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Assignments", + Name = "ExpireAssignments" + }, + new + { + Id = 33, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Duties", + Name = "ViewDutyRoster" + }, + new + { + Id = 34, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Duties", + Name = "CreateAndAssignDuties" + }, + new + { + Id = 35, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Duties", + Name = "EditDuties" + }, + new + { + Id = 36, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Duties", + Name = "ExpireDuties" + }, + new + { + Id = 37, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Idir", + Name = "EditIdir" + }, + new + { + Id = 38, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Past Training", + Name = "EditPastTraining" + }, + new + { + Id = 39, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Remove Past Training", + Name = "RemovePastTraining" + }, + new + { + Id = 40, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View DutyRoster in the future", + Name = "ViewDutyRosterInFuture" + }, + new + { + Id = 41, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Shifts in the future (not time constrained)", + Name = "ViewAllFutureShifts" + }, + new + { + Id = 42, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View other profiles (beside their own)", + Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(50L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Administrator", + Name = "Administrator" + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Manager", + Name = "Manager" + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sheriff", + Name = "Sheriff" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(100L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PermissionId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("RolePermission"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("HomeLocationId") + .HasColumnType("integer"); + + b.Property("IdirId") + .HasColumnType("uuid"); + + b.Property("IdirName") + .HasColumnType("text"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("KeyCloakId") + .HasColumnType("uuid"); + + b.Property("LastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("HomeLocationId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("User"); + + b.HasDiscriminator("Discriminator").HasValue("User"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0000-000000000001"), + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + FirstName = "SYSTEM", + IsEnabled = false, + LastName = "SYSTEM" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(5000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("UserId"); + + b.HasIndex("RoleId", "UserId") + .IsUnique(); + + b.ToTable("UserRole"); + }); + + modelBuilder.Entity("SS.Db.models.jc.JcSynchronization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("LastSynchronization") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("JcSynchronization"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("LookupCodeId", "LocationId") + .IsUnique(); + + b.ToTable("LookupSortOrder"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 1, + SortOrder = 1 + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 2, + SortOrder = 2 + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 3, + SortOrder = 3 + }, + new + { + Id = 4, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 4, + SortOrder = 4 + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 5, + SortOrder = 5 + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 6, + SortOrder = 6 + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 7, + SortOrder = 7 + }); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AdhocEndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("AdhocStartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("End") + .HasColumnType("interval"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Friday") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("Monday") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Saturday") + .HasColumnType("boolean"); + + b.Property("Start") + .HasColumnType("interval"); + + b.Property("Sunday") + .HasColumnType("boolean"); + + b.Property("Thursday") + .HasColumnType("boolean"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("Tuesday") + .HasColumnType("boolean"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("Wednesday") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Assignment"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Duty"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("DutyId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsClosed") + .HasColumnType("boolean"); + + b.Property("IsNotAvailable") + .HasColumnType("boolean"); + + b.Property("IsNotRequired") + .HasColumnType("boolean"); + + b.Property("IsOvertime") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DutyId"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("DutySlot"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AnticipatedAssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("OvertimeHours") + .HasColumnType("double precision"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AnticipatedAssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Shift"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Rank") + .HasColumnType("text"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffActingRank"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffAwayLocation"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LeaveTypeId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LeaveTypeId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffLeave"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("FirstNotice") + .HasColumnType("boolean"); + + b.Property("Note") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("TrainingCertificationExpiry") + .HasColumnType("timestamp with time zone"); + + b.Property("TrainingTypeId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("TrainingTypeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffTraining"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("JustinId") + .IsUnique(); + + b.HasIndex("UpdatedById"); + + b.ToTable("Region"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("AdvanceNotice") + .HasColumnType("integer"); + + b.Property("Category") + .HasColumnType("text"); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("Mandatory") + .HasColumnType("boolean"); + + b.Property("SubCode") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("ValidityPeriod") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("Type", "Code", "LocationId") + .IsUnique(); + + b.ToTable("LookupCode"); + + b.HasData( + new + { + Id = 1, + AdvanceNotice = 0, + Code = "Chief Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Chief Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 2, + AdvanceNotice = 0, + Code = "Superintendent", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Superintendent", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 3, + AdvanceNotice = 0, + Code = "Staff Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 4, + AdvanceNotice = 0, + Code = "Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 5, + AdvanceNotice = 0, + Code = "Staff Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 6, + AdvanceNotice = 0, + Code = "Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 7, + AdvanceNotice = 0, + Code = "Deputy Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Deputy Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 8, + AdvanceNotice = 0, + Code = "CEW (Taser)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "CEW (Taser)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 9, + AdvanceNotice = 0, + Code = "DNA", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "DNA", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 10, + AdvanceNotice = 0, + Code = "FRO", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "FRO", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 11, + AdvanceNotice = 0, + Code = "Fire Arm", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Fire Arm", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 12, + AdvanceNotice = 0, + Code = "First Aid", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "First Aid", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 13, + AdvanceNotice = 0, + Code = "Advanced Escort SPC (AESOC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Advanced Escort SPC (AESOC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 14, + AdvanceNotice = 0, + Code = "Extenuating Circumstances SPC (EXSPC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Extenuating Circumstances SPC (EXSPC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 15, + AdvanceNotice = 0, + Code = "Search Gate", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Search Gate", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 16, + AdvanceNotice = 0, + Code = "Other", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Other", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 17, + AdvanceNotice = 0, + Code = "STIP", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "STIP", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 18, + AdvanceNotice = 0, + Code = "Annual", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Annual", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 19, + AdvanceNotice = 0, + Code = "Illness", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Illness", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 20, + AdvanceNotice = 0, + Code = "Special", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Special", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.HasBaseType("SS.Db.models.auth.User"); + + b.Property("BadgeNumber") + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastPhotoUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasColumnType("bytea"); + + b.Property("Rank") + .HasColumnType("text"); + + b.HasIndex("BadgeNumber") + .IsUnique(); + + b.HasDiscriminator().HasValue("Sheriff"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("db.models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Region"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Permission", "Permission") + .WithMany() + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Permission"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "HomeLocation") + .WithMany() + .HasForeignKey("HomeLocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("HomeLocation"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany("SortOrder") + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany() + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "Assignment") + .WithMany() + .HasForeignKey("AssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Assignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.scheduling.Duty", "Duty") + .WithMany("DutySlots") + .HasForeignKey("DutyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Duty"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "AnticipatedAssignment") + .WithMany() + .HasForeignKey("AnticipatedAssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("AnticipatedAssignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("ActingRank") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("AwayLocation") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ss.db.models.LookupCode", "LeaveType") + .WithMany() + .HasForeignKey("LeaveTypeId"); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Leave") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("LeaveType"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Training") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "TrainingType") + .WithMany() + .HasForeignKey("TrainingTypeId"); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("TrainingType"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Navigation("DutySlots"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Navigation("SortOrder"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.Navigation("ActingRank"); + + b.Navigation("AwayLocation"); + + b.Navigation("Leave"); + + b.Navigation("Training"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/db/migrations/20230826223829_UpdateSheriffTraining_AddNotice.cs b/db/migrations/20230826223829_UpdateSheriffTraining_AddNotice.cs new file mode 100644 index 00000000..2d093c8d --- /dev/null +++ b/db/migrations/20230826223829_UpdateSheriffTraining_AddNotice.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SS.Db.Migrations +{ + public partial class UpdateSheriffTraining_AddNotice : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "FirstNotice", + table: "SheriffTraining", + type: "boolean", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "FirstNotice", + table: "SheriffTraining"); + } + } +} diff --git a/db/migrations/20231104164350_UpdateSheriff_Add_Excused.Designer.cs b/db/migrations/20231104164350_UpdateSheriff_Add_Excused.Designer.cs new file mode 100644 index 00000000..1ff2eef8 --- /dev/null +++ b/db/migrations/20231104164350_UpdateSheriff_Add_Excused.Designer.cs @@ -0,0 +1,2456 @@ +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS.Db.models; + +namespace SS.Db.Migrations +{ + [DbContext(typeof(SheriffDbContext))] + [Migration("20231104164350_UpdateSheriff_Add_Excused")] + partial class UpdateSheriff_Add_Excused + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityByDefaultColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AgencyId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinCode") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentLocationId") + .HasColumnType("integer"); + + b.Property("RegionId") + .HasColumnType("integer"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AgencyId") + .IsUnique(); + + b.HasIndex("CreatedById"); + + b.HasIndex("RegionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Location"); + + b.HasData( + new + { + Id = 1, + AgencyId = "SS1", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of Professional Standards", + Timezone = "America/Vancouver" + }, + new + { + Id = 2, + AgencyId = "SS2", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Sheriff Provincial Operation Centre", + Timezone = "America/Vancouver" + }, + new + { + Id = 3, + AgencyId = "SS3", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Central Float Pool", + Timezone = "America/Vancouver" + }, + new + { + Id = 4, + AgencyId = "SS4", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "ITAU", + Timezone = "America/Vancouver" + }, + new + { + Id = 5, + AgencyId = "SS5", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of the Chief Sheriff", + Timezone = "America/Vancouver" + }, + new + { + Id = 6, + AgencyId = "SS6", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + JustinCode = "4882", + Name = "South Okanagan Escort Centre", + Timezone = "America/Vancouver" + }); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("KeyValues") + .HasColumnType("jsonb"); + + b.Property("NewValues") + .HasColumnType("jsonb"); + + b.Property("OldValues") + .HasColumnType("jsonb"); + + b.Property("TableName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("KeyValues"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Permission"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Allows the user to login.", + Name = "Login" + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Profile (User)", + Name = "CreateUsers" + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Profile (User)", + Name = "ExpireUsers" + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Profile (User)", + Name = "EditUsers" + }, + new + { + Id = 8, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View all Roles", + Name = "ViewRoles" + }, + new + { + Id = 9, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Roles", + Name = "CreateAndAssignRoles" + }, + new + { + Id = 10, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Roles", + Name = "ExpireRoles" + }, + new + { + Id = 11, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Roles", + Name = "EditRoles" + }, + new + { + Id = 13, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Types", + Name = "CreateTypes" + }, + new + { + Id = 14, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Types", + Name = "EditTypes" + }, + new + { + Id = 15, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Types", + Name = "ExpireTypes" + }, + new + { + Id = 16, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View shifts", + Name = "ViewShifts" + }, + new + { + Id = 19, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Shifts", + Name = "CreateAndAssignShifts" + }, + new + { + Id = 20, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Shifts", + Name = "ExpireShifts" + }, + new + { + Id = 21, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Shifts", + Name = "EditShifts" + }, + new + { + Id = 22, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Distribute Schedule", + Name = "ViewDistributeSchedule" + }, + new + { + Id = 23, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Assigned Location", + Name = "ViewAssignedLocation" + }, + new + { + Id = 24, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Region (all locations within region)", + Name = "ViewRegion" + }, + new + { + Id = 25, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Province (all regions, all locations)", + Name = "ViewProvince" + }, + new + { + Id = 27, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Home Location", + Name = "ViewHomeLocation" + }, + new + { + Id = 28, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Import Shifts", + Name = "ImportShifts" + }, + new + { + Id = 30, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Assignments", + Name = "CreateAssignments" + }, + new + { + Id = 31, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Assignments", + Name = "EditAssignments" + }, + new + { + Id = 32, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Assignments", + Name = "ExpireAssignments" + }, + new + { + Id = 33, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Duties", + Name = "ViewDutyRoster" + }, + new + { + Id = 34, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Duties", + Name = "CreateAndAssignDuties" + }, + new + { + Id = 35, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Duties", + Name = "EditDuties" + }, + new + { + Id = 36, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Duties", + Name = "ExpireDuties" + }, + new + { + Id = 37, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Idir", + Name = "EditIdir" + }, + new + { + Id = 38, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Past Training", + Name = "EditPastTraining" + }, + new + { + Id = 39, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Remove Past Training", + Name = "RemovePastTraining" + }, + new + { + Id = 40, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View DutyRoster in the future", + Name = "ViewDutyRosterInFuture" + }, + new + { + Id = 41, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Shifts in the future (not time constrained)", + Name = "ViewAllFutureShifts" + }, + new + { + Id = 42, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View other profiles (beside their own)", + Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(50L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Administrator", + Name = "Administrator" + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Manager", + Name = "Manager" + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sheriff", + Name = "Sheriff" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(100L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PermissionId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("RolePermission"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("HomeLocationId") + .HasColumnType("integer"); + + b.Property("IdirId") + .HasColumnType("uuid"); + + b.Property("IdirName") + .HasColumnType("text"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("KeyCloakId") + .HasColumnType("uuid"); + + b.Property("LastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("HomeLocationId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("User"); + + b.HasDiscriminator("Discriminator").HasValue("User"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0000-000000000001"), + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + FirstName = "SYSTEM", + IsEnabled = false, + LastName = "SYSTEM" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(5000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("UserId"); + + b.HasIndex("RoleId", "UserId") + .IsUnique(); + + b.ToTable("UserRole"); + }); + + modelBuilder.Entity("SS.Db.models.jc.JcSynchronization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("LastSynchronization") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("JcSynchronization"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("LookupCodeId", "LocationId") + .IsUnique(); + + b.ToTable("LookupSortOrder"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 1, + SortOrder = 1 + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 2, + SortOrder = 2 + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 3, + SortOrder = 3 + }, + new + { + Id = 4, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 4, + SortOrder = 4 + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 5, + SortOrder = 5 + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 6, + SortOrder = 6 + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 7, + SortOrder = 7 + }); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AdhocEndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("AdhocStartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("End") + .HasColumnType("interval"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Friday") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("Monday") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Saturday") + .HasColumnType("boolean"); + + b.Property("Start") + .HasColumnType("interval"); + + b.Property("Sunday") + .HasColumnType("boolean"); + + b.Property("Thursday") + .HasColumnType("boolean"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("Tuesday") + .HasColumnType("boolean"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("Wednesday") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Assignment"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Duty"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("DutyId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsClosed") + .HasColumnType("boolean"); + + b.Property("IsNotAvailable") + .HasColumnType("boolean"); + + b.Property("IsNotRequired") + .HasColumnType("boolean"); + + b.Property("IsOvertime") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DutyId"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("DutySlot"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AnticipatedAssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("OvertimeHours") + .HasColumnType("double precision"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AnticipatedAssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Shift"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Rank") + .HasColumnType("text"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffActingRank"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffAwayLocation"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LeaveTypeId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LeaveTypeId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffLeave"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("FirstNotice") + .HasColumnType("boolean"); + + b.Property("Note") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("TrainingCertificationExpiry") + .HasColumnType("timestamp with time zone"); + + b.Property("TrainingTypeId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("TrainingTypeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffTraining"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("JustinId") + .IsUnique(); + + b.HasIndex("UpdatedById"); + + b.ToTable("Region"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("AdvanceNotice") + .HasColumnType("integer"); + + b.Property("Category") + .HasColumnType("text"); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("Mandatory") + .HasColumnType("boolean"); + + b.Property("SubCode") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("ValidityPeriod") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("Type", "Code", "LocationId") + .IsUnique(); + + b.ToTable("LookupCode"); + + b.HasData( + new + { + Id = 1, + AdvanceNotice = 0, + Code = "Chief Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Chief Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 2, + AdvanceNotice = 0, + Code = "Superintendent", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Superintendent", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 3, + AdvanceNotice = 0, + Code = "Staff Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 4, + AdvanceNotice = 0, + Code = "Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 5, + AdvanceNotice = 0, + Code = "Staff Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 6, + AdvanceNotice = 0, + Code = "Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 7, + AdvanceNotice = 0, + Code = "Deputy Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Deputy Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 8, + AdvanceNotice = 0, + Code = "CEW (Taser)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "CEW (Taser)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 9, + AdvanceNotice = 0, + Code = "DNA", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "DNA", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 10, + AdvanceNotice = 0, + Code = "FRO", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "FRO", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 11, + AdvanceNotice = 0, + Code = "Fire Arm", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Fire Arm", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 12, + AdvanceNotice = 0, + Code = "First Aid", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "First Aid", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 13, + AdvanceNotice = 0, + Code = "Advanced Escort SPC (AESOC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Advanced Escort SPC (AESOC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 14, + AdvanceNotice = 0, + Code = "Extenuating Circumstances SPC (EXSPC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Extenuating Circumstances SPC (EXSPC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 15, + AdvanceNotice = 0, + Code = "Search Gate", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Search Gate", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 16, + AdvanceNotice = 0, + Code = "Other", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Other", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 17, + AdvanceNotice = 0, + Code = "STIP", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "STIP", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 18, + AdvanceNotice = 0, + Code = "Annual", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Annual", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 19, + AdvanceNotice = 0, + Code = "Illness", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Illness", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 20, + AdvanceNotice = 0, + Code = "Special", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Special", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.HasBaseType("SS.Db.models.auth.User"); + + b.Property("BadgeNumber") + .HasColumnType("text"); + + b.Property("Excused") + .HasColumnType("boolean"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastPhotoUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasColumnType("bytea"); + + b.Property("Rank") + .HasColumnType("text"); + + b.HasIndex("BadgeNumber") + .IsUnique(); + + b.HasDiscriminator().HasValue("Sheriff"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("db.models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Region"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Permission", "Permission") + .WithMany() + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Permission"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "HomeLocation") + .WithMany() + .HasForeignKey("HomeLocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("HomeLocation"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany("SortOrder") + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany() + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "Assignment") + .WithMany() + .HasForeignKey("AssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Assignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.scheduling.Duty", "Duty") + .WithMany("DutySlots") + .HasForeignKey("DutyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Duty"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "AnticipatedAssignment") + .WithMany() + .HasForeignKey("AnticipatedAssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("AnticipatedAssignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("ActingRank") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("AwayLocation") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ss.db.models.LookupCode", "LeaveType") + .WithMany() + .HasForeignKey("LeaveTypeId"); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Leave") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("LeaveType"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Training") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "TrainingType") + .WithMany() + .HasForeignKey("TrainingTypeId"); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("TrainingType"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Navigation("DutySlots"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Navigation("SortOrder"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.Navigation("ActingRank"); + + b.Navigation("AwayLocation"); + + b.Navigation("Leave"); + + b.Navigation("Training"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/db/migrations/20231104164350_UpdateSheriff_Add_Excused.cs b/db/migrations/20231104164350_UpdateSheriff_Add_Excused.cs new file mode 100644 index 00000000..f16da9c5 --- /dev/null +++ b/db/migrations/20231104164350_UpdateSheriff_Add_Excused.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SS.Db.Migrations +{ + public partial class UpdateSheriff_Add_Excused : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Excused", + table: "User", + type: "boolean", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Excused", + table: "User"); + } + } +} diff --git a/db/migrations/20231119170825_UpdatePermission_AdjTraining.Designer.cs b/db/migrations/20231119170825_UpdatePermission_AdjTraining.Designer.cs new file mode 100644 index 00000000..c6b1c919 --- /dev/null +++ b/db/migrations/20231119170825_UpdatePermission_AdjTraining.Designer.cs @@ -0,0 +1,2464 @@ +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS.Db.models; + +namespace SS.Db.Migrations +{ + [DbContext(typeof(SheriffDbContext))] + [Migration("20231119170825_UpdatePermission_AdjTraining")] + partial class UpdatePermission_AdjTraining + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityByDefaultColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AgencyId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinCode") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentLocationId") + .HasColumnType("integer"); + + b.Property("RegionId") + .HasColumnType("integer"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AgencyId") + .IsUnique(); + + b.HasIndex("CreatedById"); + + b.HasIndex("RegionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Location"); + + b.HasData( + new + { + Id = 1, + AgencyId = "SS1", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of Professional Standards", + Timezone = "America/Vancouver" + }, + new + { + Id = 2, + AgencyId = "SS2", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Sheriff Provincial Operation Centre", + Timezone = "America/Vancouver" + }, + new + { + Id = 3, + AgencyId = "SS3", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Central Float Pool", + Timezone = "America/Vancouver" + }, + new + { + Id = 4, + AgencyId = "SS4", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "ITAU", + Timezone = "America/Vancouver" + }, + new + { + Id = 5, + AgencyId = "SS5", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of the Chief Sheriff", + Timezone = "America/Vancouver" + }, + new + { + Id = 6, + AgencyId = "SS6", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + JustinCode = "4882", + Name = "South Okanagan Escort Centre", + Timezone = "America/Vancouver" + }); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("KeyValues") + .HasColumnType("jsonb"); + + b.Property("NewValues") + .HasColumnType("jsonb"); + + b.Property("OldValues") + .HasColumnType("jsonb"); + + b.Property("TableName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("KeyValues"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Permission"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Allows the user to login.", + Name = "Login" + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Profile (User)", + Name = "CreateUsers" + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Profile (User)", + Name = "ExpireUsers" + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Profile (User)", + Name = "EditUsers" + }, + new + { + Id = 8, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View all Roles", + Name = "ViewRoles" + }, + new + { + Id = 9, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Roles", + Name = "CreateAndAssignRoles" + }, + new + { + Id = 10, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Roles", + Name = "ExpireRoles" + }, + new + { + Id = 11, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Roles", + Name = "EditRoles" + }, + new + { + Id = 13, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Types", + Name = "CreateTypes" + }, + new + { + Id = 14, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Types", + Name = "EditTypes" + }, + new + { + Id = 15, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Types", + Name = "ExpireTypes" + }, + new + { + Id = 16, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View shifts", + Name = "ViewShifts" + }, + new + { + Id = 19, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Shifts", + Name = "CreateAndAssignShifts" + }, + new + { + Id = 20, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Shifts", + Name = "ExpireShifts" + }, + new + { + Id = 21, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Shifts", + Name = "EditShifts" + }, + new + { + Id = 22, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Distribute Schedule", + Name = "ViewDistributeSchedule" + }, + new + { + Id = 23, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Assigned Location", + Name = "ViewAssignedLocation" + }, + new + { + Id = 24, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Region (all locations within region)", + Name = "ViewRegion" + }, + new + { + Id = 25, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Province (all regions, all locations)", + Name = "ViewProvince" + }, + new + { + Id = 27, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Home Location", + Name = "ViewHomeLocation" + }, + new + { + Id = 28, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Import Shifts", + Name = "ImportShifts" + }, + new + { + Id = 30, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Assignments", + Name = "CreateAssignments" + }, + new + { + Id = 31, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Assignments", + Name = "EditAssignments" + }, + new + { + Id = 32, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Assignments", + Name = "ExpireAssignments" + }, + new + { + Id = 33, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Duties", + Name = "ViewDutyRoster" + }, + new + { + Id = 34, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Duties", + Name = "CreateAndAssignDuties" + }, + new + { + Id = 35, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Duties", + Name = "EditDuties" + }, + new + { + Id = 36, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Duties", + Name = "ExpireDuties" + }, + new + { + Id = 37, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Idir", + Name = "EditIdir" + }, + new + { + Id = 38, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Past Training", + Name = "EditPastTraining" + }, + new + { + Id = 39, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Remove Past Training", + Name = "RemovePastTraining" + }, + new + { + Id = 40, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View DutyRoster in the future", + Name = "ViewDutyRosterInFuture" + }, + new + { + Id = 41, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Shifts in the future (not time constrained)", + Name = "ViewAllFutureShifts" + }, + new + { + Id = 42, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View other profiles (beside their own)", + Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }, + new + { + Id = 44, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Adjust Training Expiry Dates based on new rules", + Name = "AdjustTrainingExpiry" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(50L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Administrator", + Name = "Administrator" + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Manager", + Name = "Manager" + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sheriff", + Name = "Sheriff" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(100L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PermissionId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("RolePermission"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("HomeLocationId") + .HasColumnType("integer"); + + b.Property("IdirId") + .HasColumnType("uuid"); + + b.Property("IdirName") + .HasColumnType("text"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("KeyCloakId") + .HasColumnType("uuid"); + + b.Property("LastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("HomeLocationId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("User"); + + b.HasDiscriminator("Discriminator").HasValue("User"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0000-000000000001"), + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + FirstName = "SYSTEM", + IsEnabled = false, + LastName = "SYSTEM" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(5000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("UserId"); + + b.HasIndex("RoleId", "UserId") + .IsUnique(); + + b.ToTable("UserRole"); + }); + + modelBuilder.Entity("SS.Db.models.jc.JcSynchronization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("LastSynchronization") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("JcSynchronization"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("LookupCodeId", "LocationId") + .IsUnique(); + + b.ToTable("LookupSortOrder"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 1, + SortOrder = 1 + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 2, + SortOrder = 2 + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 3, + SortOrder = 3 + }, + new + { + Id = 4, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 4, + SortOrder = 4 + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 5, + SortOrder = 5 + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 6, + SortOrder = 6 + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 7, + SortOrder = 7 + }); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AdhocEndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("AdhocStartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("End") + .HasColumnType("interval"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Friday") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("Monday") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Saturday") + .HasColumnType("boolean"); + + b.Property("Start") + .HasColumnType("interval"); + + b.Property("Sunday") + .HasColumnType("boolean"); + + b.Property("Thursday") + .HasColumnType("boolean"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("Tuesday") + .HasColumnType("boolean"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("Wednesday") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Assignment"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Duty"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("DutyId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsClosed") + .HasColumnType("boolean"); + + b.Property("IsNotAvailable") + .HasColumnType("boolean"); + + b.Property("IsNotRequired") + .HasColumnType("boolean"); + + b.Property("IsOvertime") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DutyId"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("DutySlot"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AnticipatedAssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("OvertimeHours") + .HasColumnType("double precision"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AnticipatedAssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Shift"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Rank") + .HasColumnType("text"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffActingRank"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffAwayLocation"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LeaveTypeId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LeaveTypeId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffLeave"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("FirstNotice") + .HasColumnType("boolean"); + + b.Property("Note") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("TrainingCertificationExpiry") + .HasColumnType("timestamp with time zone"); + + b.Property("TrainingTypeId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("TrainingTypeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffTraining"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("JustinId") + .IsUnique(); + + b.HasIndex("UpdatedById"); + + b.ToTable("Region"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("AdvanceNotice") + .HasColumnType("integer"); + + b.Property("Category") + .HasColumnType("text"); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("Mandatory") + .HasColumnType("boolean"); + + b.Property("SubCode") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("ValidityPeriod") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("Type", "Code", "LocationId") + .IsUnique(); + + b.ToTable("LookupCode"); + + b.HasData( + new + { + Id = 1, + AdvanceNotice = 0, + Code = "Chief Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Chief Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 2, + AdvanceNotice = 0, + Code = "Superintendent", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Superintendent", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 3, + AdvanceNotice = 0, + Code = "Staff Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 4, + AdvanceNotice = 0, + Code = "Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Inspector", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 5, + AdvanceNotice = 0, + Code = "Staff Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 6, + AdvanceNotice = 0, + Code = "Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sergeant", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 7, + AdvanceNotice = 0, + Code = "Deputy Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Deputy Sheriff", + Mandatory = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 8, + AdvanceNotice = 0, + Code = "CEW (Taser)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "CEW (Taser)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 9, + AdvanceNotice = 0, + Code = "DNA", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "DNA", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 10, + AdvanceNotice = 0, + Code = "FRO", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "FRO", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 11, + AdvanceNotice = 0, + Code = "Fire Arm", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Fire Arm", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 12, + AdvanceNotice = 0, + Code = "First Aid", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "First Aid", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 13, + AdvanceNotice = 0, + Code = "Advanced Escort SPC (AESOC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Advanced Escort SPC (AESOC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 14, + AdvanceNotice = 0, + Code = "Extenuating Circumstances SPC (EXSPC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Extenuating Circumstances SPC (EXSPC)", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 15, + AdvanceNotice = 0, + Code = "Search Gate", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Search Gate", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 16, + AdvanceNotice = 0, + Code = "Other", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Other", + Mandatory = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 17, + AdvanceNotice = 0, + Code = "STIP", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "STIP", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 18, + AdvanceNotice = 0, + Code = "Annual", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Annual", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 19, + AdvanceNotice = 0, + Code = "Illness", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Illness", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 20, + AdvanceNotice = 0, + Code = "Special", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Special", + Mandatory = false, + Type = 5, + ValidityPeriod = 0 + }); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.HasBaseType("SS.Db.models.auth.User"); + + b.Property("BadgeNumber") + .HasColumnType("text"); + + b.Property("Excused") + .HasColumnType("boolean"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastPhotoUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasColumnType("bytea"); + + b.Property("Rank") + .HasColumnType("text"); + + b.HasIndex("BadgeNumber") + .IsUnique(); + + b.HasDiscriminator().HasValue("Sheriff"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("db.models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Region"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Permission", "Permission") + .WithMany() + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Permission"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "HomeLocation") + .WithMany() + .HasForeignKey("HomeLocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("HomeLocation"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany("SortOrder") + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany() + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "Assignment") + .WithMany() + .HasForeignKey("AssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Assignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.scheduling.Duty", "Duty") + .WithMany("DutySlots") + .HasForeignKey("DutyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Duty"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "AnticipatedAssignment") + .WithMany() + .HasForeignKey("AnticipatedAssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("AnticipatedAssignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("ActingRank") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("AwayLocation") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ss.db.models.LookupCode", "LeaveType") + .WithMany() + .HasForeignKey("LeaveTypeId"); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Leave") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("LeaveType"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Training") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "TrainingType") + .WithMany() + .HasForeignKey("TrainingTypeId"); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("TrainingType"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Navigation("DutySlots"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Navigation("SortOrder"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.Navigation("ActingRank"); + + b.Navigation("AwayLocation"); + + b.Navigation("Leave"); + + b.Navigation("Training"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/db/migrations/20231119170825_UpdatePermission_AdjTraining.cs b/db/migrations/20231119170825_UpdatePermission_AdjTraining.cs new file mode 100644 index 00000000..613dfc0e --- /dev/null +++ b/db/migrations/20231119170825_UpdatePermission_AdjTraining.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SS.Db.Migrations +{ + public partial class UpdatePermission_AdjTraining : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Permission", + columns: new[] { "Id", "CreatedById", "Description", "Name", "UpdatedById", "UpdatedOn" }, + values: new object[] { 44, null, "Adjust Training Expiry Dates based on new rules", "AdjustTrainingExpiry", null, null }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Permission", + keyColumn: "Id", + keyValue: 44); + } + } +} diff --git a/db/migrations/20231217161823_UpdateLookupCode_Training_RotatingFlag.Designer.cs b/db/migrations/20231217161823_UpdateLookupCode_Training_RotatingFlag.Designer.cs new file mode 100644 index 00000000..7a20114e --- /dev/null +++ b/db/migrations/20231217161823_UpdateLookupCode_Training_RotatingFlag.Designer.cs @@ -0,0 +1,2487 @@ +// +using System; +using System.Text.Json; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SS.Db.models; + +namespace SS.Db.Migrations +{ + [DbContext(typeof(SheriffDbContext))] + [Migration("20231217161823_UpdateLookupCode_Training_RotatingFlag")] + partial class UpdateLookupCode_Training_RotatingFlag + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityByDefaultColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AgencyId") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinCode") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ParentLocationId") + .HasColumnType("integer"); + + b.Property("RegionId") + .HasColumnType("integer"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AgencyId") + .IsUnique(); + + b.HasIndex("CreatedById"); + + b.HasIndex("RegionId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Location"); + + b.HasData( + new + { + Id = 1, + AgencyId = "SS1", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of Professional Standards", + Timezone = "America/Vancouver" + }, + new + { + Id = 2, + AgencyId = "SS2", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Sheriff Provincial Operation Centre", + Timezone = "America/Vancouver" + }, + new + { + Id = 3, + AgencyId = "SS3", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Central Float Pool", + Timezone = "America/Vancouver" + }, + new + { + Id = 4, + AgencyId = "SS4", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "ITAU", + Timezone = "America/Vancouver" + }, + new + { + Id = 5, + AgencyId = "SS5", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Name = "Office of the Chief Sheriff", + Timezone = "America/Vancouver" + }, + new + { + Id = 6, + AgencyId = "SS6", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + JustinCode = "4882", + Name = "South Okanagan Escort Centre", + Timezone = "America/Vancouver" + }); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("KeyValues") + .HasColumnType("jsonb"); + + b.Property("NewValues") + .HasColumnType("jsonb"); + + b.Property("OldValues") + .HasColumnType("jsonb"); + + b.Property("TableName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("KeyValues"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Permission"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Allows the user to login.", + Name = "Login" + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Profile (User)", + Name = "CreateUsers" + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Profile (User)", + Name = "ExpireUsers" + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Profile (User)", + Name = "EditUsers" + }, + new + { + Id = 8, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View all Roles", + Name = "ViewRoles" + }, + new + { + Id = 9, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Roles", + Name = "CreateAndAssignRoles" + }, + new + { + Id = 10, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Roles", + Name = "ExpireRoles" + }, + new + { + Id = 11, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Roles", + Name = "EditRoles" + }, + new + { + Id = 13, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Types", + Name = "CreateTypes" + }, + new + { + Id = 14, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Types", + Name = "EditTypes" + }, + new + { + Id = 15, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Types", + Name = "ExpireTypes" + }, + new + { + Id = 16, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View shifts", + Name = "ViewShifts" + }, + new + { + Id = 19, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create and Assign Shifts", + Name = "CreateAndAssignShifts" + }, + new + { + Id = 20, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Shifts", + Name = "ExpireShifts" + }, + new + { + Id = 21, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Shifts", + Name = "EditShifts" + }, + new + { + Id = 22, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Distribute Schedule", + Name = "ViewDistributeSchedule" + }, + new + { + Id = 23, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Assigned Location", + Name = "ViewAssignedLocation" + }, + new + { + Id = 24, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Region (all locations within region)", + Name = "ViewRegion" + }, + new + { + Id = 25, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Province (all regions, all locations)", + Name = "ViewProvince" + }, + new + { + Id = 27, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Home Location", + Name = "ViewHomeLocation" + }, + new + { + Id = 28, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Import Shifts", + Name = "ImportShifts" + }, + new + { + Id = 30, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Assignments", + Name = "CreateAssignments" + }, + new + { + Id = 31, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Assignments", + Name = "EditAssignments" + }, + new + { + Id = 32, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Assignments", + Name = "ExpireAssignments" + }, + new + { + Id = 33, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Duties", + Name = "ViewDutyRoster" + }, + new + { + Id = 34, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Create Duties", + Name = "CreateAndAssignDuties" + }, + new + { + Id = 35, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Duties", + Name = "EditDuties" + }, + new + { + Id = 36, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Expire Duties", + Name = "ExpireDuties" + }, + new + { + Id = 37, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Idir", + Name = "EditIdir" + }, + new + { + Id = 38, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Edit Past Training", + Name = "EditPastTraining" + }, + new + { + Id = 39, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Remove Past Training", + Name = "RemovePastTraining" + }, + new + { + Id = 40, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View DutyRoster in the future", + Name = "ViewDutyRosterInFuture" + }, + new + { + Id = 41, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View Shifts in the future (not time constrained)", + Name = "ViewAllFutureShifts" + }, + new + { + Id = 42, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "View other profiles (beside their own)", + Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }, + new + { + Id = 44, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Adjust Training Expiry Dates based on new rules", + Name = "AdjustTrainingExpiry" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(50L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Administrator", + Name = "Administrator" + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Manager", + Name = "Manager" + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sheriff", + Name = "Sheriff" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(100L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("PermissionId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PermissionId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("RolePermission"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasColumnType("text"); + + b.Property("HomeLocationId") + .HasColumnType("integer"); + + b.Property("IdirId") + .HasColumnType("uuid"); + + b.Property("IdirName") + .HasColumnType("text"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("KeyCloakId") + .HasColumnType("uuid"); + + b.Property("LastLogin") + .HasColumnType("timestamp with time zone"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("HomeLocationId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("User"); + + b.HasDiscriminator("Discriminator").HasValue("User"); + + b.HasData( + new + { + Id = new Guid("00000000-0000-0000-0000-000000000001"), + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + FirstName = "SYSTEM", + IsEnabled = false, + LastName = "SYSTEM" + }); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(5000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("UserId"); + + b.HasIndex("RoleId", "UserId") + .IsUnique(); + + b.ToTable("UserRole"); + }); + + modelBuilder.Entity("SS.Db.models.jc.JcSynchronization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("LastSynchronization") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("JcSynchronization"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("LookupCodeId", "LocationId") + .IsUnique(); + + b.ToTable("LookupSortOrder"); + + b.HasData( + new + { + Id = 1, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 1, + SortOrder = 1 + }, + new + { + Id = 2, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 2, + SortOrder = 2 + }, + new + { + Id = 3, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 3, + SortOrder = 3 + }, + new + { + Id = 4, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 4, + SortOrder = 4 + }, + new + { + Id = 5, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 5, + SortOrder = 5 + }, + new + { + Id = 6, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 6, + SortOrder = 6 + }, + new + { + Id = 7, + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + LookupCodeId = 7, + SortOrder = 7 + }); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AdhocEndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("AdhocStartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("End") + .HasColumnType("interval"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Friday") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("LookupCodeId") + .HasColumnType("integer"); + + b.Property("Monday") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Saturday") + .HasColumnType("boolean"); + + b.Property("Start") + .HasColumnType("interval"); + + b.Property("Sunday") + .HasColumnType("boolean"); + + b.Property("Thursday") + .HasColumnType("boolean"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("Tuesday") + .HasColumnType("boolean"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("Wednesday") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("LookupCodeId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("Assignment"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Duty"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("DutyId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsClosed") + .HasColumnType("boolean"); + + b.Property("IsNotAvailable") + .HasColumnType("boolean"); + + b.Property("IsNotRequired") + .HasColumnType("boolean"); + + b.Property("IsOvertime") + .HasColumnType("boolean"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("DutyId"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("DutySlot"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(200L, null, null, null, null, null); + + b.Property("AnticipatedAssignmentId") + .HasColumnType("integer"); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("OvertimeHours") + .HasColumnType("double precision"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("AnticipatedAssignmentId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("Shift"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("Rank") + .HasColumnType("text"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffActingRank"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffAwayLocation"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("LeaveTypeId") + .HasColumnType("integer"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LeaveTypeId"); + + b.HasIndex("SheriffId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffLeave"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Comment") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryReason") + .HasColumnType("text"); + + b.Property("FirstNotice") + .HasColumnType("boolean"); + + b.Property("Note") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SheriffId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Timezone") + .HasColumnType("text"); + + b.Property("TrainingCertificationExpiry") + .HasColumnType("timestamp with time zone"); + + b.Property("TrainingTypeId") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("SheriffId"); + + b.HasIndex("TrainingTypeId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("StartDate", "EndDate"); + + b.ToTable("SheriffTraining"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn(); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("JustinId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("JustinId") + .IsUnique(); + + b.HasIndex("UpdatedById"); + + b.ToTable("Region"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .UseIdentityByDefaultColumn() + .HasIdentityOptions(1000L, null, null, null, null, null); + + b.Property("AdvanceNotice") + .HasColumnType("integer"); + + b.Property("Category") + .HasColumnType("text"); + + b.Property("Code") + .HasColumnType("text"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("CreatedById") + .HasColumnType("uuid"); + + b.Property("CreatedOn") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("now()"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("EffectiveDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LocationId") + .HasColumnType("integer"); + + b.Property("Mandatory") + .HasColumnType("boolean"); + + b.Property("Rotating") + .HasColumnType("boolean"); + + b.Property("SubCode") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UpdatedById") + .HasColumnType("uuid"); + + b.Property("UpdatedOn") + .HasColumnType("timestamp with time zone"); + + b.Property("ValidityPeriod") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LocationId"); + + b.HasIndex("UpdatedById"); + + b.HasIndex("Type", "Code", "LocationId") + .IsUnique(); + + b.ToTable("LookupCode"); + + b.HasData( + new + { + Id = 1, + AdvanceNotice = 0, + Code = "Chief Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Chief Sheriff", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 2, + AdvanceNotice = 0, + Code = "Superintendent", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Superintendent", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 3, + AdvanceNotice = 0, + Code = "Staff Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Inspector", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 4, + AdvanceNotice = 0, + Code = "Inspector", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Inspector", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 5, + AdvanceNotice = 0, + Code = "Staff Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Staff Sergeant", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 6, + AdvanceNotice = 0, + Code = "Sergeant", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Sergeant", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 7, + AdvanceNotice = 0, + Code = "Deputy Sheriff", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Deputy Sheriff", + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 + }, + new + { + Id = 8, + AdvanceNotice = 0, + Code = "CEW (Taser)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "CEW (Taser)", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 9, + AdvanceNotice = 0, + Code = "DNA", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "DNA", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 10, + AdvanceNotice = 0, + Code = "FRO", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "FRO", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 11, + AdvanceNotice = 0, + Code = "Fire Arm", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Fire Arm", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 12, + AdvanceNotice = 0, + Code = "First Aid", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "First Aid", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 13, + AdvanceNotice = 0, + Code = "Advanced Escort SPC (AESOC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Advanced Escort SPC (AESOC)", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 14, + AdvanceNotice = 0, + Code = "Extenuating Circumstances SPC (EXSPC)", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Extenuating Circumstances SPC (EXSPC)", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 15, + AdvanceNotice = 0, + Code = "Search Gate", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Search Gate", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 16, + AdvanceNotice = 0, + Code = "Other", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Other", + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 + }, + new + { + Id = 17, + AdvanceNotice = 0, + Code = "STIP", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "STIP", + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 18, + AdvanceNotice = 0, + Code = "Annual", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Annual", + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 19, + AdvanceNotice = 0, + Code = "Illness", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Illness", + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 + }, + new + { + Id = 20, + AdvanceNotice = 0, + Code = "Special", + ConcurrencyToken = 0u, + CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Special", + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 + }); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.HasBaseType("SS.Db.models.auth.User"); + + b.Property("BadgeNumber") + .HasColumnType("text"); + + b.Property("Excused") + .HasColumnType("boolean"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastPhotoUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Photo") + .HasColumnType("bytea"); + + b.Property("Rank") + .HasColumnType("text"); + + b.HasIndex("BadgeNumber") + .IsUnique(); + + b.HasDiscriminator().HasValue("Sheriff"); + }); + + modelBuilder.Entity("SS.Api.Models.DB.Location", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("db.models.Region", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Region"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.audit.Audit", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Permission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.RolePermission", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Permission", "Permission") + .WithMany() + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Permission"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "HomeLocation") + .WithMany() + .HasForeignKey("HomeLocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("HomeLocation"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.UserRole", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Role"); + + b.Navigation("UpdatedBy"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SS.Db.models.lookupcodes.LookupSortOrder", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany("SortOrder") + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Assignment", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "LookupCode") + .WithMany() + .HasForeignKey("LookupCodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("LookupCode"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "Assignment") + .WithMany() + .HasForeignKey("AssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Assignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.DutySlot", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.scheduling.Duty", "Duty") + .WithMany("DutySlots") + .HasForeignKey("DutyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Duty"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Shift", b => + { + b.HasOne("SS.Db.models.scheduling.Assignment", "AnticipatedAssignment") + .WithMany() + .HasForeignKey("AnticipatedAssignmentId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany() + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("AnticipatedAssignment"); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffActingRank", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("ActingRank") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffAwayLocation", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("AwayLocation") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffLeave", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ss.db.models.LookupCode", "LeaveType") + .WithMany() + .HasForeignKey("LeaveTypeId"); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Leave") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("LeaveType"); + + b.Navigation("Sheriff"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.SheriffTraining", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.sheriff.Sheriff", "Sheriff") + .WithMany("Training") + .HasForeignKey("SheriffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ss.db.models.LookupCode", "TrainingType") + .WithMany() + .HasForeignKey("TrainingTypeId"); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Sheriff"); + + b.Navigation("TrainingType"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("db.models.Region", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.HasOne("SS.Db.models.auth.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Api.Models.DB.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SS.Db.models.auth.User", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("CreatedBy"); + + b.Navigation("Location"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("SS.Db.models.auth.Role", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.auth.User", b => + { + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("SS.Db.models.scheduling.Duty", b => + { + b.Navigation("DutySlots"); + }); + + modelBuilder.Entity("ss.db.models.LookupCode", b => + { + b.Navigation("SortOrder"); + }); + + modelBuilder.Entity("SS.Db.models.sheriff.Sheriff", b => + { + b.Navigation("ActingRank"); + + b.Navigation("AwayLocation"); + + b.Navigation("Leave"); + + b.Navigation("Training"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/db/migrations/20231217161823_UpdateLookupCode_Training_RotatingFlag.cs b/db/migrations/20231217161823_UpdateLookupCode_Training_RotatingFlag.cs new file mode 100644 index 00000000..969a13f6 --- /dev/null +++ b/db/migrations/20231217161823_UpdateLookupCode_Training_RotatingFlag.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SS.Db.Migrations +{ + public partial class UpdateLookupCode_Training_RotatingFlag : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Rotating", + table: "LookupCode", + type: "boolean", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Rotating", + table: "LookupCode"); + } + } +} diff --git a/db/migrations/SheriffDbContextModelSnapshot.cs b/db/migrations/SheriffDbContextModelSnapshot.cs index d127b1ce..e5b4488d 100644 --- a/db/migrations/SheriffDbContextModelSnapshot.cs +++ b/db/migrations/SheriffDbContextModelSnapshot.cs @@ -515,6 +515,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "View other profiles (beside their own)", Name = "ViewOtherProfiles" + }, + new + { + Id = 43, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Generate Reports based on Sheriff's activity", + Name = "GenerateReports" + }, + new + { + Id = 44, + ConcurrencyToken = 0u, + CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Adjust Training Expiry Dates based on new rules", + Name = "AdjustTrainingExpiry" }); }); @@ -1454,6 +1470,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ExpiryReason") .HasColumnType("text"); + b.Property("FirstNotice") + .HasColumnType("boolean"); + b.Property("Note") .HasMaxLength(200) .HasColumnType("character varying(200)"); @@ -1553,6 +1572,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) .UseIdentityByDefaultColumn() .HasIdentityOptions(1000L, null, null, null, null, null); + b.Property("AdvanceNotice") + .HasColumnType("integer"); + + b.Property("Category") + .HasColumnType("text"); + b.Property("Code") .HasColumnType("text"); @@ -1582,6 +1607,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("LocationId") .HasColumnType("integer"); + b.Property("Mandatory") + .HasColumnType("boolean"); + + b.Property("Rotating") + .HasColumnType("boolean"); + b.Property("SubCode") .HasColumnType("text"); @@ -1594,6 +1625,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UpdatedOn") .HasColumnType("timestamp with time zone"); + b.Property("ValidityPeriod") + .HasColumnType("integer"); + b.HasKey("Id"); b.HasIndex("CreatedById"); @@ -1611,202 +1645,282 @@ protected override void BuildModel(ModelBuilder modelBuilder) new { Id = 1, + AdvanceNotice = 0, Code = "Chief Sheriff", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Chief Sheriff", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 2, + AdvanceNotice = 0, Code = "Superintendent", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Superintendent", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 3, + AdvanceNotice = 0, Code = "Staff Inspector", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Staff Inspector", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 4, + AdvanceNotice = 0, Code = "Inspector", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Inspector", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 5, + AdvanceNotice = 0, Code = "Staff Sergeant", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Staff Sergeant", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 6, + AdvanceNotice = 0, Code = "Sergeant", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Sergeant", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 7, + AdvanceNotice = 0, Code = "Deputy Sheriff", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Deputy Sheriff", - Type = 7 + Mandatory = false, + Rotating = false, + Type = 7, + ValidityPeriod = 0 }, new { Id = 8, + AdvanceNotice = 0, Code = "CEW (Taser)", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "CEW (Taser)", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 9, + AdvanceNotice = 0, Code = "DNA", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "DNA", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 10, + AdvanceNotice = 0, Code = "FRO", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "FRO", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 11, + AdvanceNotice = 0, Code = "Fire Arm", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Fire Arm", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 12, + AdvanceNotice = 0, Code = "First Aid", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "First Aid", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 13, + AdvanceNotice = 0, Code = "Advanced Escort SPC (AESOC)", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Advanced Escort SPC (AESOC)", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 14, + AdvanceNotice = 0, Code = "Extenuating Circumstances SPC (EXSPC)", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Extenuating Circumstances SPC (EXSPC)", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 15, + AdvanceNotice = 0, Code = "Search Gate", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Search Gate", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 16, + AdvanceNotice = 0, Code = "Other", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Other", - Type = 6 + Mandatory = false, + Rotating = false, + Type = 6, + ValidityPeriod = 0 }, new { Id = 17, + AdvanceNotice = 0, Code = "STIP", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "STIP", - Type = 5 + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 }, new { Id = 18, + AdvanceNotice = 0, Code = "Annual", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Annual", - Type = 5 + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 }, new { Id = 19, + AdvanceNotice = 0, Code = "Illness", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Illness", - Type = 5 + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 }, new { Id = 20, + AdvanceNotice = 0, Code = "Special", ConcurrencyToken = 0u, CreatedById = new Guid("00000000-0000-0000-0000-000000000001"), CreatedOn = new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), Description = "Special", - Type = 5 + Mandatory = false, + Rotating = false, + Type = 5, + ValidityPeriod = 0 }); }); @@ -1817,6 +1931,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("BadgeNumber") .HasColumnType("text"); + b.Property("Excused") + .HasColumnType("boolean"); + b.Property("Gender") .HasColumnType("integer"); diff --git a/db/models/auth/Permission.cs b/db/models/auth/Permission.cs index 81be1247..47999525 100644 --- a/db/models/auth/Permission.cs +++ b/db/models/auth/Permission.cs @@ -42,6 +42,8 @@ public class Permission : BaseEntity public const string ViewDutyRosterInFuture = nameof(ViewDutyRosterInFuture); public const string ViewAllFutureShifts = nameof(ViewAllFutureShifts); public const string ViewOtherProfiles = nameof(ViewOtherProfiles); + public const string GenerateReports = nameof(GenerateReports); + public const string AdjustTrainingExpiry = nameof(AdjustTrainingExpiry); [Key] public int Id { get; set; } diff --git a/db/models/lookupcodes/LookupCode.cs b/db/models/lookupcodes/LookupCode.cs index 5cb9c7a9..79e4e148 100644 --- a/db/models/lookupcodes/LookupCode.cs +++ b/db/models/lookupcodes/LookupCode.cs @@ -26,5 +26,12 @@ public class LookupCode : BaseEntity public List SortOrder { get; set; } [NotMapped] public LookupSortOrder SortOrderForLocation; + + public Boolean Mandatory { get; set; } + public int ValidityPeriod { get; set; } + public string Category { get; set; } + public int AdvanceNotice { get; set; } + public Boolean Rotating { get; set; } + } } diff --git a/db/models/scheduling/DutySlot.cs b/db/models/scheduling/DutySlot.cs index d7b05f7c..8409f84f 100644 --- a/db/models/scheduling/DutySlot.cs +++ b/db/models/scheduling/DutySlot.cs @@ -16,27 +16,44 @@ public class DutySlot : BaseEntity { [Key, ExcludeFromAddDto] public int Id { get; set; } - public DateTimeOffset StartDate { get; set; } + + public DateTimeOffset StartDate { get; set; } public DateTimeOffset EndDate { get; set; } public DateTimeOffset? ExpiryDate { get; set; } + [ExcludeFromAddAndUpdateDto] [AdaptIgnore] - public Duty Duty { get; set;} + public Duty Duty { get; set; } + public int DutyId { get; set; } + [ExcludeFromAddAndUpdateDto] public Sheriff Sheriff { get; set; } + public Guid? SheriffId { get; set; } + [ExcludeFromAddAndUpdateDto] public Location Location { get; set; } + [ExcludeFromAddAndUpdateDto] public int LocationId { get; set; } + public string Timezone { get; set; } public bool IsNotRequired { get; set; } public bool IsNotAvailable { get; set; } public bool IsOvertime { get; set; } - public bool IsClosed { get;set;} + public bool IsClosed { get; set; } + [NotMapped] [ExcludeFromAddAndUpdateDto] public LookupCode AssignmentLookupCode => Duty?.Assignment?.LookupCode; + + [NotMapped] + [ExcludeFromAddAndUpdateDto] + public string DutyComment => Duty?.Comment; + + [NotMapped] + [ExcludeFromAddAndUpdateDto] + public string AssignmentComment => Duty?.Assignment?.Comment; } -} +} \ No newline at end of file diff --git a/db/models/scheduling/notmapped/ShiftAvailability.cs b/db/models/scheduling/notmapped/ShiftAvailability.cs index 5e488cdc..8d9ec0c5 100644 --- a/db/models/scheduling/notmapped/ShiftAvailability.cs +++ b/db/models/scheduling/notmapped/ShiftAvailability.cs @@ -12,23 +12,28 @@ public class ShiftAvailability { [NotMapped] public DateTimeOffset Start { get; set; } + [NotMapped] public DateTimeOffset End { get; set; } + [NotMapped] public List Conflicts { get; set; } + [NotMapped] public Sheriff Sheriff { get; set; } + [NotMapped] public Guid? SheriffId { get; set; } } + [AdaptTo("[name]Dto")] public class ShiftAvailabilityConflict { public Guid? SheriffId { get; set; } public ShiftConflictType Conflict { get; set; } public DateTimeOffset Start { get; set; } public DateTimeOffset End { get; set; } - public int? LocationId { get; set;} + public int? LocationId { get; set; } public Location Location { get; set; } public int? ShiftId { get; set; } public string WorkSection { get; set; } @@ -36,6 +41,8 @@ public class ShiftAvailabilityConflict public double OvertimeHours { get; set; } public string SheriffEventType { get; set; } public string Comment { get; set; } + + public ICollection DutySlots { get; set; } } public enum ShiftConflictType @@ -45,4 +52,4 @@ public enum ShiftConflictType AwayLocation, Scheduled } -} +} \ No newline at end of file diff --git a/db/models/sheriff/Sheriff.cs b/db/models/sheriff/Sheriff.cs index c06f2031..e8874f6b 100644 --- a/db/models/sheriff/Sheriff.cs +++ b/db/models/sheriff/Sheriff.cs @@ -25,5 +25,6 @@ public class Sheriff : User public string PhotoUrl => Photo?.Length > 0 ? $"/api/sheriff/getPhoto/{Id}?{LastPhotoUpdate.Ticks}" : null; public DateTimeOffset LastPhotoUpdate { get; set; } + public Boolean Excused { get; set; } } } \ No newline at end of file diff --git a/db/models/sheriff/SheriffTraining.cs b/db/models/sheriff/SheriffTraining.cs index 09ef5ce0..4fecc13d 100644 --- a/db/models/sheriff/SheriffTraining.cs +++ b/db/models/sheriff/SheriffTraining.cs @@ -13,5 +13,7 @@ public class SheriffTraining : SheriffEvent public DateTimeOffset? TrainingCertificationExpiry { get; set; } [MaxLength(200)] public string Note { get; set; } + + public Boolean FirstNotice { get; set; } } } diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index ae3f22b8..5f65bab7 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -39,6 +39,10 @@ services: - Logging__LogLevel__Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker=${ControllerLoggingLevel} - Logging__LogLevel__SS.Api.infrastructure.middleware.ErrorHandlingMiddleware=${MiddlewareLoggingLevel} - Logging__LogLevel__Microsoft.EntityFrameworkCore.Database.Command=${DatabaseLoggingLevel} + - ASPNETCORE_Kestrel__Certificates__Default__Password=${KestrelPassword} + - ASPNETCORE_Kestrel__Certificates__Default__Path=${KestrelPath} + - PdfUrl=${PdfUrl} + - TrainingNotification=${TrainingNotification} ports: - 5000:5000 volumes: @@ -62,4 +66,9 @@ services: ports: - 5432:5432 volumes: - - ./tmp:/tmp2 \ No newline at end of file + - ./tmp:/tmp2 + + pdf: + image: hassananv/weasyprint + ports: + - 8083:5001 \ No newline at end of file diff --git a/docker/manage b/docker/manage old mode 100644 new mode 100755 index 293fb15c..d51a187a --- a/docker/manage +++ b/docker/manage @@ -80,7 +80,7 @@ build-api() { -e "CORS_DOMAIN=http://localhost:8080" \ -e "DOTNET_STARTUP_PROJECT=./api/api.csproj" \ '..' \ - 'registry.centos.org/dotnet/dotnet-31-centos7' \ + 'registry.redhat.io/rhel8/dotnet-50' \ 'ss-api' echo -e "====================================================================================================" } @@ -161,10 +161,13 @@ configureEnvironment () { export POSTGRESQL_USER=${POSTGRESQL_USER:-shersched} export POSTGRESQL_PASSWORD=${POSTGRESQL_PASSWORD:-n05dmkFjio1GCUVY} export POSTGRESQL_ADMIN_PASSWORD=${POSTGRESQL_ADMIN_PASSWORD:-A?]qosqxBqNLdesFKWe} - + export TrainingNotification=${TrainingNotification:-"0 0/5 * * * ?"} # ss-web export API_URL=${API_URL-http://api:5000/api/} export WEB_BASE_HREF=${WEB_BASE_HREF-/sheriff-scheduling/} + + # ss-pdf + export PdfUrl=${PdfUrl-http://pdf:5001} } getStartupParams() { diff --git a/jc-interface-client/jc-interface-client.csproj b/jc-interface-client/jc-interface-client.csproj index 62d1ec67..6da6736b 100644 --- a/jc-interface-client/jc-interface-client.csproj +++ b/jc-interface-client/jc-interface-client.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 jc_interface_client @@ -11,7 +11,7 @@ - + diff --git a/tests/tests.csproj b/tests/tests.csproj index d3e24359..cc3d7b7b 100644 --- a/tests/tests.csproj +++ b/tests/tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 de959767-ede6-4f8a-b6b9-d36aed70339C diff --git a/web/package-lock.json b/web/package-lock.json index da57ae9e..5ce9103b 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -330,6 +330,12 @@ "@babel/types": "^7.16.7" } }, + "@babel/helper-string-parser": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "dev": true + }, "@babel/helper-validator-identifier": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", @@ -1211,48 +1217,123 @@ } }, "@babel/traverse": { - "version": "7.16.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz", - "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.8", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.10", - "@babel/types": "^7.16.8", - "debug": "^4.1.0", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", + "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.9", + "@babel/types": "^7.23.9", + "debug": "^4.3.1", "globals": "^11.1.0" }, "dependencies": { "@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dev": true, "requires": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + } + }, + "@babel/generator": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "dev": true, + "requires": { + "@babel/types": "^7.23.6", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "requires": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" } }, "@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true }, "@babel/highlight": { - "version": "7.16.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", - "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" } + }, + "@babel/parser": { + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", + "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "dev": true + }, + "@babel/template": { + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", + "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.23.9", + "@babel/types": "^7.23.9" + } + }, + "@babel/types": { + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", + "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } } } }, @@ -1354,6 +1435,45 @@ "postcss": "^7.0.0" } }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", @@ -1387,9 +1507,9 @@ "dev": true }, "@sindresorhus/is": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", - "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==" + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" }, "@soda/friendly-errors-webpack-plugin": { "version": "1.8.1", @@ -1486,6 +1606,14 @@ "integrity": "sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w==", "dev": true }, + "@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "requires": { + "defer-to-connect": "^2.0.0" + } + }, "@types/body-parser": { "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", @@ -1496,6 +1624,17 @@ "@types/node": "*" } }, + "@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -1560,6 +1699,11 @@ "@types/node": "*" } }, + "@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, "@types/http-proxy": { "version": "1.17.8", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.8.tgz", @@ -1575,6 +1719,14 @@ "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", "dev": true }, + "@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "requires": { + "@types/node": "*" + } + }, "@types/mime": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", @@ -1596,8 +1748,7 @@ "@types/node": { "version": "17.0.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.12.tgz", - "integrity": "sha512-4YpbAsnJXWYK/fpTVFlMIcUIho2AYCi4wg5aNPrG1ng7fn/1/RZfCIpRCiBX+12RVa34RluilnvCqD+g3KiSiA==", - "dev": true + "integrity": "sha512-4YpbAsnJXWYK/fpTVFlMIcUIho2AYCi4wg5aNPrG1ng7fn/1/RZfCIpRCiBX+12RVa34RluilnvCqD+g3KiSiA==" }, "@types/normalize-package-data": { "version": "2.4.1", @@ -1606,9 +1757,9 @@ "dev": true }, "@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", "dev": true }, "@types/q": { @@ -1629,6 +1780,14 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + } + }, "@types/serve-static": { "version": "1.13.10", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", @@ -2942,12 +3101,9 @@ "dev": true }, "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "requires": { - "lodash": "^4.17.14" - } + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" }, "async-each": { "version": "1.0.3", @@ -3015,17 +3171,17 @@ "dev": true }, "axios": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz", - "integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "requires": { "follow-redirects": "^1.14.0" } }, "axios-auth-refresh": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/axios-auth-refresh/-/axios-auth-refresh-3.0.0.tgz", - "integrity": "sha512-0XJnJY711f7opdT+b/au/xw1g4MYrjntXB8Oy5l48plbzOWLjUtJ+m8CtiNLgN3MAvGFJ/Q1NtQ7WKf2euKu6g==" + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/axios-auth-refresh/-/axios-auth-refresh-3.3.6.tgz", + "integrity": "sha512-2CeBUce/SxIfFxow5/n8vApJ97yYF6qoV4gh1UrswT7aEOnlOdBLxxyhOI4IaxGs6BY0l8YujU2jlc4aCmK17Q==" }, "babel-code-frame": { "version": "6.26.0", @@ -3241,8 +3397,7 @@ "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" }, "binary-extensions": { "version": "2.2.0", @@ -3399,26 +3554,32 @@ } }, "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", + "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", "dev": true, "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.4", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.6", + "readable-stream": "^3.6.2", + "safe-buffer": "^5.2.1" }, "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "dev": true + }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -3551,24 +3712,32 @@ "schema-utils": "^2.0.0" } }, + "cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" + }, "cacheable-request": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", - "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", "requires": { - "clone-response": "1.0.2", - "get-stream": "3.0.0", - "http-cache-semantics": "3.8.1", - "keyv": "3.0.0", - "lowercase-keys": "1.0.0", - "normalize-url": "2.0.1", - "responselike": "1.0.2" + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" }, "dependencies": { - "lowercase-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", - "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=" + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } } } }, @@ -3973,9 +4142,9 @@ } }, "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", "requires": { "mimic-response": "^1.0.0" } @@ -4377,7 +4546,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cosmiconfig": { "version": "6.0.0", @@ -4823,16 +4993,23 @@ "dev": true }, "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==" }, "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", "requires": { - "mimic-response": "^1.0.0" + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + } } }, "deep-equal": { @@ -4856,9 +5033,9 @@ "dev": true }, "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true }, "default-gateway": { @@ -4985,6 +5162,11 @@ "clone": "^1.0.2" } }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -5267,11 +5449,6 @@ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" - }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -5352,8 +5529,7 @@ "emojis-list": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==" }, "encodeurl": { "version": "1.0.2", @@ -5365,7 +5541,6 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, "requires": { "once": "^1.4.0" } @@ -5866,6 +6041,11 @@ } } }, + "export-to-csv": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/export-to-csv/-/export-to-csv-0.2.1.tgz", + "integrity": "sha512-KTbrd3CAZ0cFceJEZr1e5uiMasabeCpXq1/5uvVxDl53o4jXJHnltasQoj2NkzrxD8hU9kdwjnMhoir/7nNx/A==" + }, "express": { "version": "4.18.2", "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", @@ -6429,9 +6609,9 @@ } }, "follow-redirects": { - "version": "1.14.8", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", - "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==" + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==" }, "for-in": { "version": "1.0.2", @@ -6585,12 +6765,13 @@ "from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", - "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=" + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==" }, "from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, "requires": { "inherits": "^2.0.1", "readable-stream": "^2.0.0" @@ -6609,9 +6790,9 @@ } }, "fs-monkey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.3.tgz", - "integrity": "sha512-cybjIfiiE+pTWicSCLFHSrXZ6EilF30oh91FDP9S2B051prEa7QWfrVTQm10/dDpswBDXZugPa1Ogu8Yh+HV0Q==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.5.tgz", + "integrity": "sha512-8uMbBjrhzW76TYgEV27Y5E//W2f/lTFmx78P2w19FZSxarhI/798APGQyuGCwmkNxgwGRhrLfvWyLBvNtuOmew==", "dev": true }, "fs-write-stream-atomic": { @@ -6677,7 +6858,8 @@ "get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true }, "get-symbol-description": { "version": "1.0.0", @@ -6764,27 +6946,21 @@ } }, "got": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", - "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", - "requires": { - "@sindresorhus/is": "^0.7.0", - "cacheable-request": "^2.1.1", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "into-stream": "^3.1.0", - "is-retry-allowed": "^1.1.0", - "isurl": "^1.0.0-alpha5", - "lowercase-keys": "^1.0.0", - "mimic-response": "^1.0.0", - "p-cancelable": "^0.4.0", - "p-timeout": "^2.0.1", - "pify": "^3.0.0", - "safe-buffer": "^5.1.1", - "timed-out": "^4.0.1", - "url-parse-lax": "^3.0.0", - "url-to-options": "^1.0.1" + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "requires": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" } }, "graceful-fs": { @@ -6861,25 +7037,12 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, - "has-symbol-support-x": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", - "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==" - }, "has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, - "has-to-string-tag-x": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", - "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", - "requires": { - "has-symbol-support-x": "^1.4.1" - } - }, "has-tostringtag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", @@ -7161,9 +7324,9 @@ } }, "http-cache-semantics": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", - "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" }, "http-deceiver": { "version": "1.2.7", @@ -7269,6 +7432,15 @@ "sshpk": "^1.7.0" } }, + "http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + } + }, "https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", @@ -7411,7 +7583,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "inquirer": { "version": "7.3.3", @@ -7558,15 +7731,6 @@ "resolved": "https://registry.npmjs.org/intersection-observer/-/intersection-observer-0.10.0.tgz", "integrity": "sha512-fn4bQ0Xq8FTej09YC/jqKZwtijpvARlRp6wxL5WTA6yPe2YWSJ5RJh7Nm79rK2qB0wr6iDQzH60XGq5V/7u8YQ==" }, - "into-stream": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", - "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", - "requires": { - "from2": "^2.1.1", - "p-is-promise": "^1.1.0" - } - }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -7818,11 +7982,6 @@ "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, - "is-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", - "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" - }, "is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", @@ -7850,7 +8009,8 @@ "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true }, "is-plain-object": { "version": "2.0.4", @@ -7877,11 +8037,6 @@ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, - "is-retry-allowed": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", - "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==" - }, "is-shared-array-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", @@ -7942,7 +8097,8 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true }, "isexe": { "version": "2.0.0", @@ -7962,15 +8118,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "isurl": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", - "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", - "requires": { - "has-to-string-tag-x": "^1.2.0", - "is-object": "^1.0.1" - } - }, "jake": { "version": "10.8.5", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", @@ -7990,11 +8137,6 @@ "color-convert": "^2.0.1" } }, - "async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" - }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -8087,9 +8229,9 @@ "dev": true }, "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" }, "json-parse-better-errors": { "version": "1.0.2", @@ -8165,11 +8307,11 @@ } }, "keyv": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", - "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", + "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", "requires": { - "json-buffer": "3.0.0" + "json-buffer": "3.0.1" } }, "killable": { @@ -8277,10 +8419,9 @@ "dev": true }, "loader-utils": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", - "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", - "dev": true, + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", + "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", "requires": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -8288,10 +8429,9 @@ }, "dependencies": { "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "requires": { "minimist": "^1.2.0" } @@ -8311,12 +8451,13 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=" + "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" }, "lodash.debounce": { "version": "4.0.8", @@ -8382,9 +8523,9 @@ "dev": true }, "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" }, "lru-cache": { "version": "5.1.1", @@ -8421,7 +8562,7 @@ "map-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", - "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=" + "integrity": "sha512-C0X0KQmGm3N2ftbTGBhSyuydQ+vV1LC3f3zPvT3RXHXNZrvfPZcoXp/N5DOa8vedX/rTMm2CjTtivFg2STJMRQ==" }, "map-visit": { "version": "1.0.0", @@ -8456,12 +8597,12 @@ "dev": true }, "memfs": { - "version": "3.4.12", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.4.12.tgz", - "integrity": "sha512-BcjuQn6vfqP+k100e0E9m61Hyqa//Brp+I3f0OBmN0ATHlFA8vx3Lt8z57R3u2bPqe3WGDBC+nF72fTH7isyEw==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.3.tgz", + "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", "dev": true, "requires": { - "fs-monkey": "^1.0.3" + "fs-monkey": "^1.0.4" } }, "memory-fs": { @@ -8593,9 +8734,9 @@ "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, "mingo": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/mingo/-/mingo-1.3.3.tgz", - "integrity": "sha1-aSLE0Ufvx3GgFCWixMj3eER4xUY=" + "version": "6.4.10", + "resolved": "https://registry.npmjs.org/mingo/-/mingo-6.4.10.tgz", + "integrity": "sha512-/pOGeZKcZrKKw8YkCMKn9+XPiUYeNhkfaVbTn9tqvZvfccxf1idk8ezSulecZmPdKJLibNDtp4UBfDK3nzvMrQ==" }, "mini-css-extract-plugin": { "version": "0.9.0", @@ -8672,9 +8813,9 @@ "dev": true }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } @@ -8682,8 +8823,7 @@ "minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "minipass": { "version": "3.1.6", @@ -8751,16 +8891,16 @@ } }, "moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" }, "moment-timezone": { - "version": "0.5.31", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz", - "integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==", + "version": "0.5.45", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.45.tgz", + "integrity": "sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ==", "requires": { - "moment": ">= 2.9.0" + "moment": "^2.29.4" } }, "move-concurrently": { @@ -8984,14 +9124,9 @@ "dev": true }, "normalize-url": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", - "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", - "requires": { - "prepend-http": "^2.0.0", - "query-string": "^5.0.1", - "sort-keys": "^2.0.0" - } + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" }, "npm-run-path": { "version": "2.0.2", @@ -9026,7 +9161,8 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -9155,7 +9291,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -9254,19 +9389,15 @@ "dev": true }, "p-cancelable": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", - "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" - }, - "p-is-promise": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", - "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=" + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true }, "p-limit": { "version": "2.3.0", @@ -9301,14 +9432,6 @@ "retry": "^0.12.0" } }, - "p-timeout": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", - "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", - "requires": { - "p-finally": "^1.0.0" - } - }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -9478,7 +9601,7 @@ "pause-stream": { "version": "0.0.11", "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", - "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", "requires": { "through": "~2.3" } @@ -9517,7 +9640,8 @@ "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true }, "pinkie": { "version": "2.0.4", @@ -9609,6 +9733,15 @@ "mkdirp": "^0.5.5" }, "dependencies": { + "async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + }, "debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -10256,11 +10389,6 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" - }, "prettier": { "version": "1.19.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", @@ -10291,7 +10419,8 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "progress": { "version": "2.0.3", @@ -10359,7 +10488,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -10401,21 +10529,11 @@ "dev": true }, "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "dev": true }, - "query-string": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", - "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", - "requires": { - "decode-uri-component": "^0.2.0", - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" - } - }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -10434,6 +10552,11 @@ "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", "dev": true }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -10515,6 +10638,7 @@ "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -10528,7 +10652,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true } } }, @@ -10798,6 +10923,11 @@ "path-parse": "^1.0.6" } }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, "resolve-cwd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", @@ -10828,11 +10958,11 @@ "dev": true }, "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", "requires": { - "lowercase-keys": "^1.0.0" + "lowercase-keys": "^2.0.0" } }, "restore-cursor": { @@ -10915,7 +11045,8 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true }, "safe-regex": { "version": "1.1.0", @@ -10965,14 +11096,21 @@ } }, "save": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/save/-/save-2.4.0.tgz", - "integrity": "sha512-wd5L2uVnsKYkIUaK6i8Ie66IOHaI328gMF0MPuTJtYOjXgUolC33LSIk7Qr8WVA55QHaGwfiVS8a7EFIeGOR3w==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/save/-/save-2.9.0.tgz", + "integrity": "sha512-eg8+g8CjvehE/2C6EbLdtK1pINVD27pcJLj4M9PjWWhoeha/y5bWf4dp/0RF+OzbKTcG1bae9qi3PAqiR8CJTg==", "requires": { - "async": "^2.6.2", + "async": "^3.2.2", "event-stream": "^4.0.1", "lodash.assign": "^4.2.0", - "mingo": "1" + "mingo": "^6.1.0" + }, + "dependencies": { + "async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" + } } }, "sax": { @@ -11395,14 +11533,6 @@ } } }, - "sort-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", - "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", - "requires": { - "is-plain-obj": "^1.0.0" - } - }, "sortablejs": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.12.0.tgz", @@ -11636,7 +11766,7 @@ "stream-combiner": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", - "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", + "integrity": "sha512-6yHMqgLYDzQDcAkL+tjJDC5nSNuNIx0vZtRZeiPh7Saef7VHX9H5Ijn9l2VIol2zaNYlYEX6KyuT/237A58qEQ==", "requires": { "duplexer": "~0.1.1", "through": "~2.3.4" @@ -11674,7 +11804,8 @@ "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true }, "string-width": { "version": "4.2.0", @@ -11711,6 +11842,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "requires": { "safe-buffer": "~5.1.0" }, @@ -11718,7 +11850,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true } } }, @@ -11875,9 +12008,9 @@ "dev": true }, "terser": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", - "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.1.tgz", + "integrity": "sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==", "dev": true, "requires": { "commander": "^2.20.0", @@ -12027,11 +12160,6 @@ "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "dev": true }, - "timed-out": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" - }, "timers-browserify": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", @@ -12442,9 +12570,9 @@ } }, "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true }, "unpipe": { @@ -12565,19 +12693,6 @@ "requires-port": "^1.0.0" } }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "requires": { - "prepend-http": "^2.0.0" - } - }, - "url-to-options": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", - "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=" - }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -12604,7 +12719,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "util.promisify": { "version": "1.0.1", @@ -12780,11 +12896,11 @@ } }, "vue-resource": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/vue-resource/-/vue-resource-1.5.1.tgz", - "integrity": "sha512-o6V4wNgeqP+9v9b2bPXrr20CGNQPEXjpbUWdZWq9GJhqVeAGcYoeTtn/D4q059ZiyN0DIrDv/ADrQUmlUQcsmg==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/vue-resource/-/vue-resource-1.5.3.tgz", + "integrity": "sha512-REhTuEuYSpwmEH/VN4fgDQVC/VXxDK/xsguuiDPnINxOwy1s0CSu//p++osTUkiAXi6d/vptwBpb0AcBIDsXzw==", "requires": { - "got": "^8.0.3" + "got": ">=8.0 <12.0" } }, "vue-router": { @@ -13679,8 +13795,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { "version": "1.0.3", diff --git a/web/package.json b/web/package.json index aca83c75..590601f7 100644 --- a/web/package.json +++ b/web/package.json @@ -14,26 +14,35 @@ "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/vue-fontawesome": "^2.0.0", "@types/underscore": "^1.10.0", - "axios": "^0.21.2", - "axios-auth-refresh": "^3.0.0", + "ansi-regex": "^6.0.1", + "axios": "^0.21.4", + "axios-auth-refresh": "^3.2.1", "bootstrap": "^4.4.1", "bootstrap-vue": "^2.12.0", "core-js": "^3.6.5", "ejs": "^3.1.8", + "export-to-csv": "0.2.1", + "express": "^4.18.2", "intersection-observer": "^0.10.0", "jquery": "^3.5.1", - "moment-timezone": "^0.5.31", + "json5": "^2.2.3", + "loader-utils": "^3.2.1", + "moment-timezone": "^0.5.45", + "node-forge": "^1.3.1", + "postcss": "^8.4.35", "printd": "^1.4.2", + "qs": "^6.11.2", "regenerator-runtime": "^0.13.5", - "save": "^2.4.0", + "save": "^2.9.0", "sortablejs": "^1.10.2", + "tough-cookie": "^4.1.3", "underscore": "^1.12.1", "vue": "2.6.11", "vue-auth-image": "0.0.3", "vue-class-component": "6.3.2", "vue-cookies": "^1.7.4", "vue-property-decorator": "^8.4.2", - "vue-resource": "^1.5.1", + "vue-resource": "^1.5.3", "vue-router": "^3.1.6", "vuex": "^3.3.0", "vuex-class": "^0.3.2", diff --git a/web/public/images/bcss-crest-lw.png b/web/public/images/bcss-crest-lw.png new file mode 100644 index 00000000..8615f924 Binary files /dev/null and b/web/public/images/bcss-crest-lw.png differ diff --git a/web/src/App.vue b/web/src/App.vue index e12a622f..f853f404 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -18,7 +18,7 @@ import NavigationFooter from "@components/NavigationFooter.vue"; import { Component, Vue } from 'vue-property-decorator'; import { namespace } from 'vuex-class'; - import {commonInfoType, locationInfoType, sheriffRankInfoType, userInfoType} from './types/common'; + import {commonInfoType, locationInfoType, sheriffRankInfoType, userInfoType, regionInfoType} from './types/common'; import {sheriffRankJsonType} from './types/common/jsonTypes' import "@store/modules/CommonInformation"; const commonState = namespace("CommonInformation"); @@ -52,6 +52,9 @@ @commonState.Action public UpdateUser!: (newUser: userInfoType) => void + @commonState.Action + public UpdateRegionList!: (newRegionList: regionInfoType[]) => void + @commonState.State public locationList!: locationInfoType[]; @@ -102,7 +105,8 @@ lastName: userData.lastName, roles: userData.roles, homeLocationId: userData.homeLocationId, - permissions: userData.permissions + permissions: userData.permissions, + userId: userData.userId }) this.getAllLocations() } @@ -125,9 +129,11 @@ this.userDetails.roles.length>0 && this.locationList.length>0) { this.isCommonDataReady = true; - if(this.$route.name == 'Home') - this.$router.push({path:'/manage-duty-roster'}) + //console.log(this.$route.path) + if(this.$route.path!='/' && this.$route.name == 'Home') + this.$router.push({path:'/'}) } + this.getRegions(); } },err => { this.errorText = err + ' - ' + moment().format(); @@ -165,6 +171,21 @@ }) } + + public getRegions() { + const url = 'api/region' + this.$http.get(url) + .then(response => { + if(response.data){ + this.extractRegionInfo(response.data); + } + },err => { + this.errorText = err + ' - ' + moment().format(); + if (this.errorText.indexOf('401') == -1) { + this.displayError = true; + } + }) + } public getLocations() { const url = 'api/location' @@ -184,16 +205,28 @@ public extractLocationInfo(locationListJson, allLocations: boolean){ const locations: locationInfoType[] = []; - for(const locationJson of locationListJson){ - const locationInfo: locationInfoType = {id: locationJson.id, name: locationJson.name, regionId: locationJson.regionId, timezone: locationJson.timezone} - locations.push(locationInfo) + for(const locationJson of locationListJson){ + if (locationJson.regionId > 0) { + const locationInfo: locationInfoType = {id: locationJson.id, name: locationJson.name, regionId: locationJson.regionId, timezone: locationJson.timezone} + locations.push(locationInfo); + } } if (allLocations) { this.UpdateAllLocationList(_.sortBy(locations,'name')); } else { this.UpdateLocationList(_.sortBy(locations,'name')); - } + } + } + + public extractRegionInfo(regionListJson){ + + const regions: regionInfoType[] = regionListJson.filter(region=>(region.justinId > 0)); + + const vancouverIndex = regions.findIndex((region => region.name == 'Vancouver')); + + if(vancouverIndex>=0) regions[vancouverIndex].name = 'Coastal'; + this.UpdateRegionList(_.sortBy(regions,'name')); } } diff --git a/web/src/assets/bcss-crest-lw.png b/web/src/assets/bcss-crest-lw.png new file mode 100644 index 00000000..8615f924 Binary files /dev/null and b/web/src/assets/bcss-crest-lw.png differ diff --git a/web/src/components/DutyRoster/DutyRosterDayView.vue b/web/src/components/DutyRoster/DutyRosterDayView.vue index adaf5938..c67aab7a 100644 --- a/web/src/components/DutyRoster/DutyRosterDayView.vue +++ b/web/src/components/DutyRoster/DutyRosterDayView.vue @@ -48,7 +48,7 @@