-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initiative Dashboard and start on WorkItem Queues
- Loading branch information
1 parent
7c2b833
commit b4e428a
Showing
93 changed files
with
1,263 additions
and
620 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Core/Bones.Database/Operations/AccountManagement/SetEmailConfirmedDateTimeDb.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Bones.Database.DbSets.AccountManagement; | ||
|
||
namespace Bones.Database.Operations.AccountManagement; | ||
|
||
/// <summary> | ||
/// Sets the email confirmed date time on the user | ||
/// </summary> | ||
/// <param name="User"></param> | ||
/// <param name="ConfirmedDateTime"></param> | ||
public sealed record SetEmailConfirmedDateTimeDbCommand(BonesUser User, DateTimeOffset ConfirmedDateTime) : IRequest<CommandResponse>; | ||
|
||
internal sealed class SetEmailConfirmedDateTimeDbCommandValidator : AbstractValidator<SetEmailConfirmedDateTimeDbCommand> | ||
{ | ||
public SetEmailConfirmedDateTimeDbCommandValidator() | ||
{ | ||
RuleFor(x => x.User).NotNull().Custom((user, ctx) => | ||
{ | ||
if (user.EmailConfirmed) | ||
{ | ||
ctx.AddFailure("User", "User already has email confirmed"); | ||
} | ||
}); | ||
|
||
RuleFor(x => x.ConfirmedDateTime).NotNull(); | ||
} | ||
} | ||
|
||
internal sealed class SetEmailConfirmedDateTimeDbHandler(BonesDbContext dbContext) : IRequestHandler<SetEmailConfirmedDateTimeDbCommand, CommandResponse> | ||
{ | ||
public async Task<CommandResponse> Handle(SetEmailConfirmedDateTimeDbCommand request, CancellationToken cancellationToken) | ||
{ | ||
request.User.EmailConfirmed = true; | ||
request.User.EmailConfirmedDateTime = request.ConfirmedDateTime; | ||
dbContext.Users.Update(request.User); | ||
await dbContext.SaveChangesAsync(cancellationToken); | ||
|
||
return CommandResponse.Pass(); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
...tions/AccountManagement/SetEmailConfirmedDateTimeDb/SetEmailConfirmedDateTimeDbCommand.cs
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
...ountManagement/SetEmailConfirmedDateTimeDb/SetEmailConfirmedDateTimeDbCommandValidator.cs
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...tions/AccountManagement/SetEmailConfirmedDateTimeDb/SetEmailConfirmedDateTimeDbHandler.cs
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
Core/Bones.Database/Operations/OrganizationManagement/GetOrganizationByIdDb.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Bones.Database.DbSets.OrganizationManagement; | ||
|
||
namespace Bones.Database.Operations.OrganizationManagement; | ||
|
||
/// <summary> | ||
/// DB Query to get the specified organization. | ||
/// </summary> | ||
/// <param name="OrganizationId"></param> | ||
public sealed record GetOrganizationByIdDbQuery(Guid OrganizationId) : IRequest<QueryResponse<BonesOrganization>>; | ||
|
||
internal sealed class GetOrganizationByIdDbQueryValidator : AbstractValidator<GetOrganizationByIdDbQuery> | ||
{ | ||
public override Task<ValidationResult> ValidateAsync(ValidationContext<GetOrganizationByIdDbQuery> context, CancellationToken cancellation = new()) | ||
{ | ||
RuleFor(x => x.OrganizationId).NotNull().NotEqual(Guid.Empty); | ||
|
||
return base.ValidateAsync(context, cancellation); | ||
} | ||
} | ||
|
||
internal sealed class GetOrganizationByIdDbHandler(BonesDbContext dbContext) : IRequestHandler<GetOrganizationByIdDbQuery, QueryResponse<BonesOrganization>> | ||
{ | ||
public async Task<QueryResponse<BonesOrganization>> Handle(GetOrganizationByIdDbQuery request, CancellationToken cancellationToken) | ||
{ | ||
BonesOrganization? organization = await dbContext.Organizations.FirstOrDefaultAsync(x => x.Id == request.OrganizationId, cancellationToken); | ||
|
||
if (organization is null) | ||
{ | ||
return QueryResponse<BonesOrganization>.Fail("Organization not found"); | ||
} | ||
|
||
return organization; | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...e/Operations/OrganizationManagement/GetOrganizationByIdDb/GetOrganizationByIdDbHandler.cs
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...ase/Operations/OrganizationManagement/GetOrganizationByIdDb/GetOrganizationByIdDbQuery.cs
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...tions/OrganizationManagement/GetOrganizationByIdDb/GetOrganizationByIdDbQueryValidator.cs
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
Core/Bones.Database/Operations/ProjectManagement/Initiatives/GetInitiativeByIdDb.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using Bones.Database.DbSets.ProjectManagement; | ||
|
||
namespace Bones.Database.Operations.ProjectManagement.Initiatives; | ||
|
||
/// <summary> | ||
/// DB Query for getting an initiative | ||
/// </summary> | ||
/// <param name="InitiativeId">Internal ID of the initiative</param> | ||
public record GetInitiativesByIdDbQuery(Guid InitiativeId) : IRequest<QueryResponse<Initiative>>; | ||
|
||
internal sealed class GetInitiativesByIdQueryDbValidator : AbstractValidator<GetInitiativesByIdDbQuery> | ||
{ | ||
|
||
} | ||
|
||
internal sealed class GetInitiativesByIdDbHandler(BonesDbContext dbContext) : IRequestHandler<GetInitiativesByIdDbQuery, QueryResponse<Initiative>> | ||
{ | ||
public async Task<QueryResponse<Initiative>> Handle(GetInitiativesByIdDbQuery request, CancellationToken cancellationToken) | ||
{ | ||
return await dbContext.Initiatives | ||
.Include(i => i.Queues) | ||
.Include(i => i.Project) | ||
.FirstOrDefaultAsync(i => i.Id == request.InitiativeId, cancellationToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
....Database/Operations/WorkItemManagement/WorkItemQueues/GetWorkItemQueuesByInitiativeDb.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Bones.Database.DbSets.WorkItemManagement; | ||
|
||
namespace Bones.Database.Operations.WorkItemManagement.WorkItemQueues; | ||
|
||
/// <summary> | ||
/// Backend query for getting work item queues that belong to an initiative. | ||
/// </summary> | ||
/// <param name="InitiativeId">Internal ID of the initiative</param> | ||
public record GetWorkItemQueuesByInitiativeDbQuery(Guid InitiativeId) : IRequest<QueryResponse<List<WorkItemQueue>>>; | ||
|
||
internal sealed class GetWorkItemQueuesByInitiativeDbQueryValidator : AbstractValidator<GetWorkItemQueuesByInitiativeDbQuery> | ||
{ | ||
|
||
} | ||
|
||
internal sealed class GetWorkItemQueuesByInitiativeDbHandler(BonesDbContext dbContext) : IRequestHandler<GetWorkItemQueuesByInitiativeDbQuery, QueryResponse<List<WorkItemQueue>>> | ||
{ | ||
public async Task<QueryResponse<List<WorkItemQueue>>> Handle(GetWorkItemQueuesByInitiativeDbQuery request, CancellationToken cancellationToken) | ||
{ | ||
return (await dbContext.Initiatives.Include(i => i.Queues).FirstOrDefaultAsync(i => i.Id == request.InitiativeId, cancellationToken))?.Queues | ||
// Should only really happen if the initiative doesn't exist, but that would have been checked in the Logic layer before here anyways | ||
?? []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
Core/Bones.Logic/Features/Accounts/ConfirmEmail/ConfirmEmailQuery.cs
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
Core/Bones.Logic/Features/Accounts/ConfirmEmail/ConfirmEmailQueryValidator.cs
This file was deleted.
Oops, something went wrong.
17 changes: 16 additions & 1 deletion
17
...ncipal/GetUserByClaimsPrincipalHandler.cs → ...ures/Accounts/GetUserByClaimsPrincipal.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
Core/Bones.Logic/Features/Accounts/GetUserByClaimsPrincipal/GetUserByClaimsPrincipalQuery.cs
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...ogic/Features/Accounts/GetUserByClaimsPrincipal/GetUserByClaimsPrincipalQueryValidator.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.