-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62dfde9
commit 428e46e
Showing
8 changed files
with
22 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
using MBS_COMMAND.Contract.Abstractions.Messages; | ||
|
||
namespace MBS_COMMAND.Contract.Services.Slots; | ||
public static class Command | ||
{ | ||
public record CreateSlot(Guid MentorId, List<SlotModel> SlotModels) : ICommand; | ||
public record CreateSlot(List<SlotModel> SlotModels) : ICommand; | ||
|
||
public record GenerateSlotForSemester: ICommand; | ||
} | ||
public record GenerateSlotForSemester : ICommand; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
using MBS_COMMAND.Contract.Services.Slots; | ||
using MBS_COMMAND.Presentation.Abstractions; | ||
|
||
namespace MBS_COMMAND.Presentation.APIs.Slots; | ||
public class SlotApi : ApiEndpoint,ICarterModule | ||
public class SlotApi : ApiEndpoint, ICarterModule | ||
{ | ||
private const string BaseUrl = "/api/v{version:apiVersion}/slots"; | ||
|
||
public void AddRoutes(IEndpointRouteBuilder app) | ||
{ | ||
var gr1 = app.NewVersionedApi("Slots").MapGroup(BaseUrl).HasApiVersion(1); | ||
gr1.MapPost(string.Empty, CreateSlot).WithSummary("mm/dd/yyyy"); | ||
gr1.MapPost(string.Empty, CreateSlot).WithSummary("mm/dd/yyyy").RequireAuthorization(); | ||
gr1.MapPost("generate", GenerateSlotForSemester); | ||
} | ||
|
||
private static async Task<IResult> CreateSlot(ISender sender,[FromBody] Command.CreateSlot command) | ||
private static async Task<IResult> CreateSlot(ISender sender, [FromBody] Command.CreateSlot command) | ||
{ | ||
var result = await sender.Send(command); | ||
return result.IsFailure ? HandlerFailure(result) : Results.Ok(result); | ||
} | ||
|
||
private static async Task<IResult> GenerateSlotForSemester(ISender sender) | ||
{ | ||
var result = await sender.Send(new Command.GenerateSlotForSemester()); | ||
return result.IsFailure ? HandlerFailure(result) : Results.Ok(result); | ||
} | ||
} | ||
} |