refactoring
This commit is contained in:
parent
183728647e
commit
1dcb66b08d
@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace HackathonPreparing.ApiService.Auth.EfCore;
|
||||
namespace HackathonPreparing.ApiService.AuthFeature.EfCore;
|
||||
|
||||
public class IdentityRoleEntityTypeConfiguration : IEntityTypeConfiguration<IdentityRole<int>>
|
||||
{
|
@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HackathonPreparing.ApiService.Auth.EfCore;
|
||||
namespace HackathonPreparing.ApiService.AuthFeature.EfCore;
|
||||
|
||||
public class UserContext : IdentityDbContext<Auth.User, IdentityRole<int>, int>
|
||||
public class UserContext : IdentityDbContext<AuthFeature.User, IdentityRole<int>, int>
|
||||
{
|
||||
public UserContext (DbContextOptions<UserContext> options) : base(options) {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace HackathonPreparing.ApiService.Auth;
|
||||
namespace HackathonPreparing.ApiService.AuthFeature;
|
||||
|
||||
public class User : IdentityUser<int>
|
||||
{
|
@ -3,7 +3,7 @@ using Microsoft.OpenApi.Any;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace HackathonPreparing.ApiService.Auth;
|
||||
namespace HackathonPreparing.ApiService.AuthFeature;
|
||||
|
||||
public class UserOpenApiSchemeFilter : ISchemaFilter
|
||||
{
|
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace HackathonPreparing.ApiService.GlobalHelpers;
|
||||
namespace HackathonPreparing.ApiService.DevFeature;
|
||||
|
||||
public static class DbHelpersEndpointsExtensions
|
||||
{
|
||||
@ -53,8 +53,8 @@ public static class DbHelpersEndpointsExtensions
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
group.MapPost("/add-moderator", async ([FromServices]UserManager<Auth.User> userManager) => {
|
||||
var user = new Auth.User{
|
||||
group.MapPost("/add-moderator", async ([FromServices]UserManager<AuthFeature.User> userManager) => {
|
||||
var user = new AuthFeature.User{
|
||||
Email = "m@gmail.com",
|
||||
UserName = "m@gmail.com"
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
||||
namespace HackathonPreparing.ApiService.GlobalHelpers;
|
||||
namespace HackathonPreparing.ApiService.DevFeature;
|
||||
|
||||
public static class ServicesExtensions
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HackathonPreparing.ApiService.WeatherForecast.EfCore;
|
||||
namespace HackathonPreparing.ApiService.WeatherForecastFeature.EfCore;
|
||||
|
||||
public sealed class WeatherForecastContext : DbContext
|
||||
{
|
||||
@ -10,7 +10,7 @@ public sealed class WeatherForecastContext : DbContext
|
||||
|
||||
}
|
||||
|
||||
public DbSet<WeatherForecast> Forecasts => Set<ApiService.WeatherForecast.WeatherForecast>();
|
||||
public DbSet<WeatherForecast> Forecasts => Set<ApiService.WeatherForecastFeature.WeatherForecast>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace HackathonPreparing.ApiService.WeatherForecast.EfCore;
|
||||
namespace HackathonPreparing.ApiService.WeatherForecastFeature.EfCore;
|
||||
|
||||
public class WeatherForecastEntityTypeConfiguration : IEntityTypeConfiguration<WeatherForecast>
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using HackathonPreparing.ApiService.WeatherForecast.EfCore;
|
||||
using HackathonPreparing.ApiService.WeatherForecastFeature.EfCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HackathonPreparing.ApiService.WeatherForecast;
|
||||
namespace HackathonPreparing.ApiService.WeatherForecastFeature;
|
||||
|
||||
public static class WeatherForecastEndpointsExtensions
|
||||
{
|
||||
@ -22,14 +22,14 @@ public static class WeatherForecastEndpointsExtensions
|
||||
|
||||
return Results.NoContent();
|
||||
}).RequireAuthorization("moderator");
|
||||
group.MapPost("/", async (WeatherForecastContext db, ApiService.WeatherForecast.WeatherForecast forecast) =>
|
||||
group.MapPost("/", async (WeatherForecastContext db, ApiService.WeatherForecastFeature.WeatherForecast forecast) =>
|
||||
{
|
||||
db.Forecasts.Add(forecast);
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
return Results.Created($"/weatherforecast/{forecast.Id}", forecast);
|
||||
});
|
||||
group.MapPut("/{id}", async (WeatherForecastContext db, int id, ApiService.WeatherForecast.WeatherForecast forecast) =>
|
||||
group.MapPut("/{id}", async (WeatherForecastContext db, int id, ApiService.WeatherForecastFeature.WeatherForecast forecast) =>
|
||||
{
|
||||
if (id != forecast.Id)
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace HackathonPreparing.ApiService.WeatherForecast;
|
||||
namespace HackathonPreparing.ApiService.WeatherForecastFeature;
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using HackathonPreparing.ApiService.Auth;
|
||||
using HackathonPreparing.ApiService.Auth.EfCore;
|
||||
using HackathonPreparing.ApiService.GlobalHelpers;
|
||||
using HackathonPreparing.ApiService.WeatherForecast;
|
||||
using HackathonPreparing.ApiService.WeatherForecast.EfCore;
|
||||
using HackathonPreparing.ApiService.AuthFeature;
|
||||
using HackathonPreparing.ApiService.AuthFeature.EfCore;
|
||||
using HackathonPreparing.ApiService.DevFeature;
|
||||
using HackathonPreparing.ApiService.WeatherForecastFeature;
|
||||
using HackathonPreparing.ApiService.WeatherForecastFeature.EfCore;
|
||||
using HackathonPreparing.ServiceDefaults;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
Loading…
x
Reference in New Issue
Block a user