Skip to content

Commit

Permalink
chore: resolve miscellaneous issues in Reminders module
Browse files Browse the repository at this point in the history
  • Loading branch information
HunorTotBagi committed Dec 31, 2024
1 parent 5122afb commit d607c9b
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using BuildingBlocks.Domain.ValueObjects.Ids;
using Reminders.Application.Entities.Reminders.Commands.CreateReminder;

// ReSharper disable ClassNeverInstantiated.Global

namespace Reminders.Api.Endpoints.Reminders;

public class CreateReminder : ICarterModule
Expand All @@ -23,6 +25,7 @@ public void AddRoutes(IEndpointRouteBuilder app)
}
}

// ReSharper disable once NotAccessedPositionalProperty.Global
public record CreateReminderRequest(ReminderDto Reminder);

public record CreateReminderResponse(ReminderId Id);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Reminders.Application.Entities.Reminders.Queries.GetReminderById;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Reminders.Application.Entities.Reminders.Queries.GetReminderById;

namespace Reminders.Api.Endpoints.Reminders;

Expand All @@ -9,18 +9,18 @@ public class GetReminderById : ICarterModule
public void AddRoutes(IEndpointRouteBuilder app)
{
app.MapGet("/Reminders/{reminderId}", async (string reminderId, ISender sender) =>
{
var result = await sender.Send(new GetReminderByIdQuery(reminderId));
var response = result.Adapt<GetReminderByIdResponse>();
{
var result = await sender.Send(new GetReminderByIdQuery(reminderId));
var response = result.Adapt<GetReminderByIdResponse>();

return Results.Ok(response);
})
.WithName("GetReminderById")
.Produces<GetReminderByIdResponse>()
.ProducesProblem(StatusCodes.Status400BadRequest)
.ProducesProblem(StatusCodes.Status404NotFound)
.WithSummary("Get Reminder by Id")
.WithDescription("Get Reminder by Id");
return Results.Ok(response);
})
.WithName("GetReminderById")
.Produces<GetReminderByIdResponse>()
.ProducesProblem(StatusCodes.Status400BadRequest)
.ProducesProblem(StatusCodes.Status404NotFound)
.WithSummary("Get Reminder by Id")
.WithDescription("Get Reminder by Id");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ public class ListReminders : ICarterModule
public void AddRoutes(IEndpointRouteBuilder app)
{
app.MapGet("/Reminders", async ([AsParameters] PaginationRequest query, ISender sender) =>
{
var result = await sender.Send(new ListRemindersQuery(query));
var response = result.Adapt<ListRemindersResponse>();
{
var result = await sender.Send(new ListRemindersQuery(query));
var response = result.Adapt<ListRemindersResponse>();

return Results.Ok(response);
})
.WithName("ListReminders")
.Produces<ListRemindersResponse>()
.ProducesProblem(StatusCodes.Status400BadRequest)
.WithSummary("List Reminders")
.WithDescription("List Reminders");
return Results.Ok(response);
})
.WithName("ListReminders")
.Produces<ListRemindersResponse>()
.ProducesProblem(StatusCodes.Status400BadRequest)
.WithSummary("List Reminders")
.WithDescription("List Reminders");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using FluentValidation;
using Reminders.Application.Entities.Reminders.Dtos;
using Reminders.Application.Entities.Reminders.Dtos;

namespace Reminders.Application.Entities.Reminders.Commands.CreateReminder;

// ReSharper disable once ClassNeverInstantiated.Global
public record CreateReminderCommand(ReminderDto Reminder) : ICommand<CreateReminderResult>;

// ReSharper disable once NotAccessedPositionalProperty.Global
public record CreateReminderResult(ReminderId Id);

public class CreateReminderCommandValidator : AbstractValidator<CreateReminderCommand>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using Reminders.Application.Entities.Reminders.Dtos;
// ReSharper disable ClassNeverInstantiated.Global

using Reminders.Application.Entities.Reminders.Dtos;

namespace Reminders.Application.Entities.Reminders.Queries.GetReminderById;

public record GetReminderByIdQuery(string Id) : IQuery<GetReminderByIdResult>;

// ReSharper disable once NotAccessedPositionalProperty.Global
public record GetReminderByIdResult(ReminderDto ReminderDto);
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using BuildingBlocks.Application.Pagination;
using Reminders.Application.Entities.Reminders.Dtos;

// ReSharper disable ClassNeverInstantiated.Global

namespace Reminders.Application.Entities.Reminders.Queries.ListReminders;

public record ListRemindersQuery(PaginationRequest PaginationRequest) : IQuery<ListRemindersResult>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
global using Microsoft.EntityFrameworkCore;
global using FluentValidation;
global using Microsoft.EntityFrameworkCore;
global using BuildingBlocks.Application.Cqrs;
global using Reminders.Domain.Models;
global using Reminders.Application.Data;
global using BuildingBlocks.Domain.ValueObjects.Ids;
global using BuildingBlocks.Application.Exceptions;
global using BuildingBlocks.Domain.ValueObjects.Ids;
global using Reminders.Application.Data;
global using Reminders.Domain.Models;

0 comments on commit d607c9b

Please sign in to comment.