Skip to content

Commit

Permalink
Redirect to project dashboard after creation
Browse files Browse the repository at this point in the history
  • Loading branch information
CorruptComputer committed Nov 10, 2024
1 parent 02affd5 commit f972d49
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 40 deletions.
4 changes: 2 additions & 2 deletions Backend/Bones.Api/Controllers/ProjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public record CreateProjectRequest([Required] string Name, Guid? OrganizationId
/// <param name="request">The request</param>
/// <returns>Created if created, otherwise BadRequest with a message of what went wrong.</returns>
[HttpPost("create", Name = "CreateProjectAsync")]
[ProducesResponseType<EmptyResponse>(StatusCodes.Status200OK)]
[ProducesResponseType<Guid>(StatusCodes.Status200OK)]
[ProducesResponseType<Dictionary<string, string[]>>(StatusCodes.Status400BadRequest)]
public async Task<ActionResult> CreateProjectAsync([FromBody] CreateProjectRequest request)
{
Expand All @@ -42,7 +42,7 @@ public async Task<ActionResult> CreateProjectAsync([FromBody] CreateProjectReque
return BadRequest(response.FailureReasons);
}

return Ok(EmptyResponse.Value);
return Ok(response.Id);
}

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion Backend/Bones.Api/OpenApi/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmptyResponse"
"type": "string",
"format": "uuid"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Frontend/Bones.Api.Client/AutoGenBonesApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings()
/// <param name="body">The request</param>
/// <returns>OK</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<object> CreateProjectAsync(CreateProjectRequest body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public virtual async System.Threading.Tasks.Task<System.Guid> CreateProjectAsync(CreateProjectRequest body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var client_ = _httpClient;
var disposeClient_ = false;
Expand Down Expand Up @@ -1011,7 +1011,7 @@ private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings()
else
if (status_ == 200)
{
var objectResponse_ = await ReadObjectResponseAsync<object>(response_, headers_, cancellationToken).ConfigureAwait(false);
var objectResponse_ = await ReadObjectResponseAsync<System.Guid>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
Expand Down
5 changes: 3 additions & 2 deletions Frontend/Bones.WebUI/Pages/Project/CreateProjectPage.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Bones.Shared;
using Bones.Shared.Consts;
using Microsoft.AspNetCore.Components;
using MudBlazor;

Expand Down Expand Up @@ -35,13 +36,13 @@ public async Task SendCreateRequestAsync()
{
ApiError = false;

await ApiClient.CreateProjectAsync(new()
Guid projectId = await ApiClient.CreateProjectAsync(new()
{
Name = ProjectName.Text,
OrganizationId = null
});

// TODO: Forward to newly created projects dashboard
NavManager.NavigateTo(FrontEndUrls.Project.DASHBOARD.Replace("{ProjectId:guid}", projectId.ToString()));
}
catch (Exception ex)
{
Expand Down
35 changes: 2 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,5 @@ I will not be accepting any public pull requests to here.

[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=CorruptComputer_Bones)](https://sonarcloud.io/summary/new_code?id=CorruptComputer_Bones)

## Development Environment Setup
### Background Service Setup:
You'll want to install Mailhog and run it, emails from the background service will go here so you can receive those locally.
https://github.com/mailhog/MailHog

### Api Setup:
```bash
cd Backend\Bones.Api
dotnet tool restore
```

### WebUI Setup:
```bash
cd Frontend\Bones.WebUI
sudo dotnet workload install wasm-tools
cd ..
cd Bones.Api.Client
dotnet tool restore
```

### DB Setup:
```bash
cd Backend\Bones.Database
dotnet tool restore
sudo su postgres
initdb -D /var/lib/postgres/data --auth-local=trust --locale=C.UTF-8 --encoding=UTF8
createdb BonesDb
```

When running it you'll want to run them in this order:
- Bones.BackgroundService
- Bones.Api
- Bones.WebUI
## Documentation
All the docs are in an Obsidian Vault in the Docs folder.

0 comments on commit f972d49

Please sign in to comment.