Skip to content

Commit

Permalink
Merge branch 'i11' of github.com:migueloliveiradev/living into i11
Browse files Browse the repository at this point in the history
  • Loading branch information
migueloliveiradev committed Sep 16, 2024
2 parents f54a715 + 018e346 commit 80bc3f9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 108 deletions.
11 changes: 11 additions & 0 deletions Living.Domain/Base/Paginated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Living.Domain.Base;
public class Paginated<T>(IEnumerable<T> items, int pageIndex, int pageSize, long totalCount)
{
public IEnumerable<T> Items { get; } = items;
public int PageIndex { get; } = pageIndex;
public int PageSize { get; } = pageSize;
public long TotalCount { get; } = totalCount;
public int TotalPages => (int)Math.Ceiling(TotalCount / (double)PageSize);
public bool HasPreviousPage => PageIndex > 1;
public bool HasNextPage => PageIndex < TotalPages;
}
2 changes: 1 addition & 1 deletion Living.Tests.Unit/Helpers/ProjectsAssemblies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public static class ProjectsAssemblies
public static Assembly Domain => typeof(Domain.Base.BaseResponse).Assembly;
public static Assembly Application => typeof(Application.UseCases.Users.Login.LoginUserCommand).Assembly;
public static Assembly Infrastructure => typeof(Infraestructure.Context.DatabaseContext).Assembly;
public static Assembly WebApi => typeof(WebAPI.Attributes.NotificationProducesResponseTypeAttributeTests).Assembly;
public static Assembly WebApi => typeof(WebAPI.Program).Assembly;
public static Assembly Shared => typeof(Living.Shared.Handlers.Handler).Assembly;
}

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions Living.WebAPI/Controllers/ContentsController.cs

This file was deleted.

17 changes: 17 additions & 0 deletions Living.WebAPI/Controllers/FeedController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Living.Domain.Base;
using Living.Domain.Features.Posts.Models;

namespace Living.WebAPI.Controllers;

[ApiController]
[Route("api/feed")]
[Authorize]
public class FeedController : ControllerAPI
{
[HttpGet]
[ProducesResponseType<Paginated<PostItem>>(200)]
public async Task<IActionResult> Index()
{
throw new NotImplementedException();
}
}
4 changes: 3 additions & 1 deletion Living.WebAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Living.Infraestructure.Extensions;
using Living.WebAPI.ExceptionsHandler;
using Living.WebAPI.Extensions;
using System.Text.Json.Serialization;

namespace Living.WebAPI;
public abstract class Program
Expand All @@ -17,7 +18,8 @@ public static void Main(string[] args)
builder.Services.AddMessaging();

builder.Services.AddControllers()
.AddInvalidModelStateConfiguration();
.AddInvalidModelStateConfiguration()
.AddJsonOptions(p => p.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));

builder.Services.AddIdentityConfiguration();

Expand Down

0 comments on commit 80bc3f9

Please sign in to comment.