Skip to content

Commit

Permalink
Merge pull request #65 from Macro-Deck-App/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
manuelmayer-dev authored Aug 11, 2023
2 parents 82dcfe9 + 7c5bee2 commit c2790ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ExtensionStoreAPI.Core/DataTypes/Response/PagedList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ private PagedList(List<T> items, int page, int pageSize, int totalItems)

public static async ValueTask<PagedList<T>> CreatePagedListAsync(IQueryable<T> query, int page, int pageSize)
{
query = query.Skip((page - 1) * pageSize).Take(pageSize);

var items = await query.ToListAsync();
var totalItems = await query.CountAsync();
var items = await query.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();

return new PagedList<T>(items, page, pageSize, totalItems);
}
Expand Down
10 changes: 10 additions & 0 deletions src/ExtensionStoreAPI/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped<IGitHubRepositoryService, GitHubRepositoryService>();
services.AddEndpointsApiExplorer();
services.AddSwagger();
services.AddCors(options =>
{
options.AddPolicy("AllowAny",
builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
services.AddControllers()
.AddJsonOptions(opt =>
{
Expand Down

0 comments on commit c2790ae

Please sign in to comment.