Skip to content

Commit

Permalink
Add initiatives list to project dashboard and stub out initiative das…
Browse files Browse the repository at this point in the history
…hboard
  • Loading branch information
CorruptComputer committed Nov 10, 2024
1 parent 959f702 commit beb9dd8
Show file tree
Hide file tree
Showing 106 changed files with 1,211 additions and 670 deletions.
27 changes: 27 additions & 0 deletions Backend/Bones.Api/Bones.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,31 @@
<ItemGroup>
<Content Remove="appsettings.Development.json" Condition="$(Configuration) == 'Release'" />
</ItemGroup>

<ItemGroup>
<Compile Update="Controllers\ProjectController.Responses.cs">
<DependentUpon>ProjectController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\ProjectController.Requests.cs">
<DependentUpon>ProjectController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\LoginController.Responses.cs">
<DependentUpon>LoginController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\LoginController.Requests.cs">
<DependentUpon>LoginController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\AnonymousController.Responses.cs">
<DependentUpon>AnonymousController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\AnonymousController.Requests.cs">
<DependentUpon>AnonymousController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\AccountController.Responses.cs">
<DependentUpon>AccountController.cs</DependentUpon>
</Compile>
<Compile Update="Controllers\AccountController.Requests.cs">
<DependentUpon>AccountController.cs</DependentUpon>
</Compile>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions Backend/Bones.Api/Controllers/AccountController.Requests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Bones.Api.Controllers;

public sealed partial class AccountController
{

}
27 changes: 27 additions & 0 deletions Backend/Bones.Api/Controllers/AccountController.Responses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Text.Json.Serialization;

namespace Bones.Api.Controllers;

public sealed partial class AccountController
{
/// <summary>
///
/// </summary>
/// <param name="Email"></param>
/// <param name="DisplayName"></param>
[Serializable]
[JsonSerializable(typeof(GetMyBasicInfoResponse))]
public record GetMyBasicInfoResponse(string Email, string DisplayName);

/// <summary>
///
/// </summary>
/// <param name="Email"></param>
/// <param name="EmailConfirmed"></param>
/// <param name="EmailConfirmedDateTime"></param>
/// <param name="DisplayName"></param>
/// <param name="CreateDateTime"></param>
[Serializable]
[JsonSerializable(typeof(GetMyProfileResponse))]
public record GetMyProfileResponse(string Email, bool EmailConfirmed, DateTimeOffset? EmailConfirmedDateTime, string DisplayName, DateTimeOffset CreateDateTime);
}
19 changes: 1 addition & 18 deletions Backend/Bones.Api/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ namespace Bones.Api.Controllers;
/// Created using this as a reference:
/// https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs
/// </remarks>
public sealed class AccountController(ISender sender) : BonesControllerBase(sender)
public sealed partial class AccountController(ISender sender) : BonesControllerBase(sender)
{
/// <summary>
///
/// </summary>
/// <param name="Email"></param>
/// <param name="DisplayName"></param>
public record GetMyBasicInfoResponse(string Email, string DisplayName);

/// <summary>
///
/// </summary>
Expand All @@ -35,16 +28,6 @@ public async Task<ActionResult> GetMyBasicInfoAsync()
user.DisplayName ?? user.Email ?? string.Empty));
}

/// <summary>
///
/// </summary>
/// <param name="Email"></param>
/// <param name="EmailConfirmed"></param>
/// <param name="EmailConfirmedDateTime"></param>
/// <param name="DisplayName"></param>
/// <param name="CreateDateTime"></param>
public record GetMyProfileResponse(string Email, bool EmailConfirmed, DateTimeOffset? EmailConfirmedDateTime, string DisplayName, DateTimeOffset CreateDateTime);

/// <summary>
/// Returns a users own full profile info
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions Backend/Bones.Api/Controllers/AnonymousController.Requests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace Bones.Api.Controllers;

public sealed partial class AnonymousController
{
/// <summary>
/// Request to register a new user
/// </summary>
/// <param name="Email">Email, must be valid and unique</param>
/// <param name="Password">Password, must pass validation (1 upper, 1 lower, 1 number, 1 special character, and at least 8 characters long)</param>
[Serializable]
[JsonSerializable(typeof(RegisterUserApiRequest))]
public sealed record RegisterUserApiRequest([Required] string Email, [Required] string Password);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Bones.Api.Controllers;

public sealed partial class AnonymousController
{

}
19 changes: 5 additions & 14 deletions Backend/Bones.Api/Controllers/AnonymousController.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations;
using Bones.Api.Models;
using Bones.Backend.Features.AccountManagement.ConfirmEmail;
using Bones.Backend.Features.AccountManagement.QueueForgotPasswordEmail;
using Bones.Backend.Features.AccountManagement.QueueResendConfirmationEmail;
using Bones.Backend.Features.AccountManagement.RegisterUser;
using Bones.Backend.Features.Accounts.ConfirmEmail;
using Bones.Backend.Features.Accounts.QueueForgotPasswordEmail;
using Bones.Backend.Features.Accounts.QueueResendConfirmationEmail;
using Bones.Backend.Features.Accounts.RegisterUser;
using Bones.Shared.Backend.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
Expand All @@ -16,15 +16,8 @@ namespace Bones.Api.Controllers;
/// </summary>
/// <param name="sender">MediatR sender</param>
[AllowAnonymous]
public class AnonymousController(ISender sender) : BonesControllerBase(sender)
public sealed partial class AnonymousController(ISender sender) : BonesControllerBase(sender)
{
/// <summary>
/// Request to register a new user
/// </summary>
/// <param name="Email">Email, must be valid and unique</param>
/// <param name="Password">Password, must pass validation (1 upper, 1 lower, 1 number, 1 special character, and at least 8 characters long)</param>
public sealed record RegisterUserApiRequest([Required] string Email, [Required] string Password);

/// <summary>
/// Registers a new user if all validations pass
/// </summary>
Expand All @@ -45,8 +38,6 @@ public async Task<ActionResult> RegisterAsync([FromBody] RegisterUserApiRequest
return Ok(EmptyResponse.Value);
}



/// <summary>
/// Confirms a users email address
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Backend/Bones.Api/Controllers/BonesControllerBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Net.Mime;
using Bones.Api.Models;
using Bones.Backend.Features.AccountManagement.GetUserByClaimsPrincipal;
using Bones.Backend.Features.Accounts.GetUserByClaimsPrincipal;
using Bones.Database.DbSets.AccountManagement;
using Bones.Shared.Exceptions;
using Microsoft.AspNetCore.Authorization;
Expand Down
18 changes: 18 additions & 0 deletions Backend/Bones.Api/Controllers/LoginController.Requests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace Bones.Api.Controllers;

public sealed partial class LoginController
{
/// <summary>
/// Request to login
/// </summary>
/// <param name="Email">The users email address</param>
/// <param name="Password">The users password</param>
/// <param name="TwoFactorCode">If they have 2fa, include the code here</param>
/// <param name="TwoFactorRecoveryCode">If they have 2fa and can't use their authenticator, include a recovery code here</param>
[Serializable]
[JsonSerializable(typeof(LoginUserApiRequest))]
public sealed record LoginUserApiRequest([Required] string Email, [Required] string Password, string? TwoFactorCode, string? TwoFactorRecoveryCode);
}
6 changes: 6 additions & 0 deletions Backend/Bones.Api/Controllers/LoginController.Responses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Bones.Api.Controllers;

public sealed partial class LoginController
{

}
11 changes: 1 addition & 10 deletions Backend/Bones.Api/Controllers/LoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,8 @@ namespace Bones.Api.Controllers;
/// Created using this as a reference:
/// https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Core/src/IdentityApiEndpointRouteBuilderExtensions.cs
/// </remarks>
public class LoginController(SignInManager<BonesUser> signInManager, ISender sender) : BonesControllerBase(sender)
public sealed partial class LoginController(SignInManager<BonesUser> signInManager, ISender sender) : BonesControllerBase(sender)
{
/// <summary>
/// Request to login
/// </summary>
/// <param name="Email">The users email address</param>
/// <param name="Password">The users password</param>
/// <param name="TwoFactorCode">If they have 2fa, include the code here</param>
/// <param name="TwoFactorRecoveryCode">If they have 2fa and can't use their authenticator, include a recovery code here</param>
public sealed record LoginUserApiRequest([Required] string Email, [Required] string Password, string? TwoFactorCode, string? TwoFactorRecoveryCode);

/// <summary>
/// Logs in a user, returns the active token as a cookie header if successful
/// </summary>
Expand Down
34 changes: 34 additions & 0 deletions Backend/Bones.Api/Controllers/ProjectController.Requests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Bones.Shared.Backend.Enums;

namespace Bones.Api.Controllers;

public sealed partial class ProjectController
{
/// <summary>
/// Request to create a new project
/// </summary>
/// <param name="Name">Name of the project to create</param>
/// <param name="OrganizationId">Optionally the organization that this should be created under, if not specified will be created for the requesting user.</param>
[Serializable]
[JsonSerializable(typeof(CreateProjectRequest))]
public record CreateProjectRequest([Required] string Name, Guid? OrganizationId = null);

/// <summary>
/// Request to create a new initiative
/// </summary>
/// <param name="Name">Name of the initiative to create</param>
[Serializable]
[JsonSerializable(typeof(CreateInitiativeRequest))]
public record CreateInitiativeRequest([Required] string Name);

/// <summary>
/// Request to get the projects for a given User/Organization
/// </summary>
/// <param name="OwnerType">OwnerType to get</param>
/// <param name="OrganizationId">Optionally the organization that this should be created under, if not specified will be created for the requesting user.</param>
[Serializable]
[JsonSerializable(typeof(GetProjectsByOwnerRequest))]
public record GetProjectsByOwnerRequest([Required] OwnershipType OwnerType, Guid? OrganizationId = null);
}
53 changes: 53 additions & 0 deletions Backend/Bones.Api/Controllers/ProjectController.Responses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Text.Json.Serialization;
using Bones.Shared.Backend.Enums;

namespace Bones.Api.Controllers;

public sealed partial class ProjectController
{
/// <summary>
///
/// </summary>
/// <param name="ProjectId"></param>
/// <param name="ProjectName"></param>
[Serializable]
[JsonSerializable(typeof(GetProjectQuickSelectResponse))]
public record GetProjectQuickSelectResponse(
Guid ProjectId,
string ProjectName
);

/// <summary>
///
/// </summary>
/// <param name="ProjectId"></param>
/// <param name="ProjectName"></param>
/// <param name="OwnerType"></param>
/// <param name="OwnerId"></param>
/// <param name="InitiativeCount"></param>
/// <param name="Initiatives"></param>
[Serializable]
[JsonSerializable(typeof(GetProjectDashboardResponse))]
public record GetProjectDashboardResponse(
Guid ProjectId,
string ProjectName,
OwnershipType OwnerType,
Guid OwnerId,
int InitiativeCount,
List<InitiativeListModel> Initiatives
);

/// <summary>
///
/// </summary>
/// <param name="InitiativeId"></param>
/// <param name="InitiativeName"></param>
/// <param name="QueueCount"></param>
[Serializable]
[JsonSerializable(typeof(InitiativeListModel))]
public sealed record InitiativeListModel(
Guid InitiativeId,
string InitiativeName,
int QueueCount
);
}
Loading

0 comments on commit beb9dd8

Please sign in to comment.