Moves the six backend projects on disk into Core/ and Hosts/ subfolders, matching the solution folders already defined in Musify.slnx, so the file explorer reflects the same layout as the solution: backend/Core/Musify.Domain backend/Core/Musify.Application backend/Core/Musify.Infrastructure backend/Hosts/Musify.Api backend/Hosts/Musify.Worker backend/Hosts/Musify.StreamingGateway Updates every reference to the old paths: ProjectReference entries in Musify.Api.csproj and Musify.Worker.csproj, the three Dockerfiles, deploy/scripts/migrate.ps1|sh, deploy/zitadel/provision.ps1, deploy/up.ps1, deploy/README.md and docs/development.md. Also fixes a stale Dockerfile comment pointing at a compose file that no longer exists. Verified with `dotnet build Musify.slnx` against the new layout.
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using Mediator;
|
|
using Musify.Api.Authentication;
|
|
using Musify.Api.Extensions;
|
|
using Musify.Application.Mixes;
|
|
using Musify.Application.Mixes.Responses;
|
|
|
|
namespace Musify.Api.Endpoints;
|
|
|
|
public static class MixEndpoints
|
|
{
|
|
public static IEndpointRouteBuilder MapMixEndpoints(this IEndpointRouteBuilder app)
|
|
{
|
|
var group = app.MapGroup("/mixes")
|
|
.WithTags("Mixes")
|
|
.RequireAuthorization();
|
|
|
|
group.MapGet("/", GetMixes)
|
|
.WithName("GetMixes")
|
|
.WithSummary("Get The Server-Generated Mixes Of The Current User.")
|
|
.Produces<IReadOnlyList<MixApplicationResponse>>()
|
|
.Produces(StatusCodes.Status401Unauthorized);
|
|
|
|
group.MapGet("/{id}", GetMixById)
|
|
.WithName("GetMixById")
|
|
.WithSummary("Get A Mix With All Of Its Songs.")
|
|
.Produces<MixApplicationResponse>()
|
|
.Produces(StatusCodes.Status401Unauthorized)
|
|
.Produces(StatusCodes.Status404NotFound);
|
|
|
|
return app;
|
|
}
|
|
|
|
private static async Task<IResult> GetMixes(
|
|
IMediator mediator,
|
|
CurrentUser currentUser,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var result = await mediator.Send(new GetMixesByUserIdQuery(currentUser.RequiredId), cancellationToken);
|
|
return result.ToHttpResult();
|
|
}
|
|
|
|
private static async Task<IResult> GetMixById(
|
|
IMediator mediator,
|
|
CurrentUser currentUser,
|
|
Guid id,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var result = await mediator.Send(new GetMixByIdQuery(currentUser.RequiredId, id), cancellationToken);
|
|
return result.ToHttpResult();
|
|
}
|
|
}
|