Add password reset functionality for admin users: implement ResetPassword endpoint, update AdminUserEndpoints to include password reset logic, and enhance user interface for password management. Update translations for new features and ensure proper error handling in the reset process.
This commit is contained in:
+6
-2
@@ -7,7 +7,11 @@ namespace TeleWave.Application.Broadcast.CreateOverride;
|
||||
public sealed record CreateProgrammingOverrideCommand(
|
||||
Guid ChannelId,
|
||||
OverrideMode Mode,
|
||||
DateTimeOffset StartsAtUtc,
|
||||
DateTimeOffset EndsAtUtc,
|
||||
OverrideRecurrence Recurrence,
|
||||
DateTimeOffset? StartsAtUtc,
|
||||
DateTimeOffset? EndsAtUtc,
|
||||
int? DayOfWeek,
|
||||
int? StartMinute,
|
||||
int? EndMinute,
|
||||
IReadOnlyList<OverrideShowInput> Shows
|
||||
) : ICommand<Result<Guid>>;
|
||||
|
||||
+26
-2
@@ -2,6 +2,7 @@ using LiteCqrs;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TeleWave.Application.Common.Interfaces;
|
||||
using TeleWave.Application.Common.Models;
|
||||
using TeleWave.Domain.Broadcast;
|
||||
|
||||
namespace TeleWave.Application.Broadcast.CreateOverride;
|
||||
|
||||
@@ -13,8 +14,24 @@ public sealed class CreateProgrammingOverrideCommandHandler(IAppDbContext dbCont
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
if (command.EndsAtUtc <= command.StartsAtUtc)
|
||||
var weekly = command.Recurrence == OverrideRecurrence.Weekly;
|
||||
if (weekly)
|
||||
{
|
||||
if (
|
||||
command.DayOfWeek is not (>= 0 and <= 6)
|
||||
|| command.StartMinute is not { } sm
|
||||
|| command.EndMinute is not { } em
|
||||
|| em <= sm
|
||||
|| sm < 0
|
||||
|| em > 1440
|
||||
)
|
||||
return Result.Failure<Guid>(ChannelErrors.InvalidOverrideWindow);
|
||||
}
|
||||
else if (command.StartsAtUtc is not { } start || command.EndsAtUtc is not { } end || end <= start)
|
||||
{
|
||||
return Result.Failure<Guid>(ChannelErrors.InvalidOverrideWindow);
|
||||
}
|
||||
|
||||
if (command.Shows.Count == 0)
|
||||
return Result.Failure<Guid>(ChannelErrors.OverrideNeedsShow);
|
||||
|
||||
@@ -33,7 +50,14 @@ public sealed class CreateProgrammingOverrideCommandHandler(IAppDbContext dbCont
|
||||
if (existingCount != showIds.Count)
|
||||
return Result.Failure<Guid>(ChannelErrors.ShowNotFound);
|
||||
|
||||
var ovr = channel.AddOverride(command.Mode, command.StartsAtUtc, command.EndsAtUtc);
|
||||
var ovr = weekly
|
||||
? channel.AddWeeklyOverride(
|
||||
command.Mode,
|
||||
command.DayOfWeek!.Value,
|
||||
command.StartMinute!.Value,
|
||||
command.EndMinute!.Value
|
||||
)
|
||||
: channel.AddOverride(command.Mode, command.StartsAtUtc!.Value, command.EndsAtUtc!.Value);
|
||||
foreach (var show in command.Shows)
|
||||
ovr.AddShow(show.ShowId, show.Weight);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user