Release v1.0.0 #16

Merged
Wesser merged 492 commits from release/v1.0.0 into master 2025-02-12 09:19:32 +03:00
302 changed files with 15830 additions and 99 deletions
Showing only changes of commit b3a0964aac - Show all commits
.editorconfig.env
.gitea/workflows
.gitignore
ApiDto
Backend.slnDockerfile
Endpoint
Backend.http
Common
Configuration
Controllers
Endpoint.csprojProgram.cs
Sync
WeatherForecast.cs
wwwroot
css
README.md
Security
SqlData
Application
Application.csproj
Common
Cqrs
Campus
Discipline
Faculty
Group
LectureHall
Professor
Schedule
TypeOfOccupation
DependencyInjection.cs
Interfaces
Domain
Migrations
Persistence
nuget.config

@ -18,7 +18,7 @@ public static class CronUpdateSkipService
throw new ArgumentException("It is impossible to create a structure because it has incorrect values.");
}
public static List<ScheduleSettings.CronUpdateSkip> Filter(this List<ScheduleSettings.CronUpdateSkip> data, DateOnly? currentDate = null)
public static List<ScheduleSettings.CronUpdateSkip> FilterDateEntry(this List<ScheduleSettings.CronUpdateSkip> data, DateOnly? currentDate = null)
{
currentDate ??= DateOnly.FromDateTime(DateTime.Now);
return data.OrderBy(x => x.End ?? x.Date)
@ -26,8 +26,18 @@ public static class CronUpdateSkipService
.ToList();
}
public static List<ScheduleSettings.CronUpdateSkip> Filter(this List<ScheduleSettings.CronUpdateSkip> data, DateTime? currentDate = null) =>
data.Filter(DateOnly.FromDateTime(currentDate ?? DateTime.Now));
public static List<ScheduleSettings.CronUpdateSkip> FilterDateEntry(this List<ScheduleSettings.CronUpdateSkip> data, DateTime? currentDate = null) =>
data.FilterDateEntry(DateOnly.FromDateTime(currentDate ?? DateTime.Now));
public static List<ScheduleSettings.CronUpdateSkip> Filter(this List<ScheduleSettings.CronUpdateSkip> data, DateOnly? currentDate = null)
{
currentDate ??= DateOnly.FromDateTime(DateTime.Now);
return data.Where(x => x.Date >= currentDate || x.End >= currentDate)
.OrderBy(x => x.End ?? x.Date)
.ToList();
}
public static List<DateTimeOffset> GetNextTask(this List<ScheduleSettings.CronUpdateSkip> data,
CronExpression expression, int depth = 1, DateOnly? currentDate = null)
@ -42,7 +52,7 @@ public static class CronUpdateSkipService
do
{
var lastSkip = data.Filter(nextRunTime.DateTime).LastOrDefault();
var lastSkip = data.FilterDateEntry(nextRunTime.DateTime).LastOrDefault();
if (lastSkip is { Start: not null, End: not null })
nextRunTime = new DateTimeOffset(lastSkip.End.Value.AddDays(1), new TimeOnly(0, 0, 0), TimeSpan.Zero);
@ -56,7 +66,7 @@ public static class CronUpdateSkipService
nextRunTime = next.Value;
if (data.Filter(nextRunTime.DateTime).Any())
if (data.FilterDateEntry(nextRunTime.DateTime).Any())
continue;
result.Add(nextRunTime);

@ -103,7 +103,9 @@ public class ScheduleController(ILogger<ScheduleController> logger, IOptionsSnap
/// <returns>Cron update skip dates.</returns>
[HttpGet("CronUpdateSkip")]
public ActionResult<List<CronUpdateSkip>> CronUpdateSkip() =>
config.Value.ScheduleSettings!.CronUpdateSkipDateList.Filter(DateTime.Now).ConvertToDto();
config.Value.ScheduleSettings!.CronUpdateSkipDateList
.Filter()
.ConvertToDto();
/// <summary>
/// Updates the list of cron update skip dates in the configuration.
@ -124,7 +126,7 @@ public class ScheduleController(ILogger<ScheduleController> logger, IOptionsSnap
throw new ControllerArgumentException(ex.Message);
}
config.Value.ScheduleSettings!.CronUpdateSkipDateList = result.Filter(DateTime.Now);
config.Value.ScheduleSettings!.CronUpdateSkipDateList = result.Filter();
config.Value.SaveSetting();
return Ok();