-
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.
Create project and project dashboard
- Loading branch information
1 parent
914cfcb
commit 98a1747
Showing
29 changed files
with
1,076 additions
and
217 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
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
30 changes: 30 additions & 0 deletions
30
...Bones.Backend/Features/ProjectManagement/Projects/GetProjectById/GetProjectByIdHandler.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,30 @@ | ||
using Bones.Backend.Features.ProjectManagement.Projects.UserHasProjectPermission; | ||
using Bones.Database.DbSets.ProjectManagement; | ||
using Bones.Database.Operations.ProjectManagement.Projects.GetProjectByIdDb; | ||
using Bones.Shared.Consts; | ||
|
||
namespace Bones.Backend.Features.ProjectManagement.Projects.GetProjectById; | ||
|
||
internal sealed class GetProjectByIdHandler(ISender sender) : IRequestHandler<GetProjectByIdQuery, QueryResponse<Project>> | ||
{ | ||
public async Task<QueryResponse<Project>> Handle(GetProjectByIdQuery request, CancellationToken cancellationToken) | ||
{ | ||
const string perm = BonesClaimTypes.Role.Project.VIEW_PROJECT; | ||
bool? hasPermission = | ||
await sender.Send(new UserHasProjectPermissionQuery(request.ProjectId, request.RequestingUser, perm), cancellationToken); | ||
|
||
if (hasPermission is not true) | ||
{ | ||
return QueryResponse<Project>.Forbid(); | ||
} | ||
|
||
Project? project = await sender.Send(new GetProjectByIdDbQuery(request.ProjectId), cancellationToken); | ||
|
||
if (project is null) | ||
{ | ||
return QueryResponse<Project>.Fail("Project not found"); | ||
} | ||
|
||
return QueryResponse<Project>.Pass(project); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...d/Bones.Backend/Features/ProjectManagement/Projects/GetProjectById/GetProjectByIdQuery.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,11 @@ | ||
using Bones.Database.DbSets.AccountManagement; | ||
using Bones.Database.DbSets.ProjectManagement; | ||
|
||
namespace Bones.Backend.Features.ProjectManagement.Projects.GetProjectById; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="ProjectId"></param> | ||
/// <param name="RequestingUser"></param> | ||
public sealed record GetProjectByIdQuery(Guid ProjectId, BonesUser RequestingUser) : IRequest<QueryResponse<Project>>; |
Oops, something went wrong.