netcore-blueprint 0.0.44 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-module.js +1 -1
- package/package.json +1 -1
- package/Modules/__MODULE__/__ITEM__Module.API/Controllers/Public/__ITEM__Controller.cs +0 -65
- package/Modules/__MODULE__/__ITEM__Module.API/Mappers/Dto__ITEM__MappingProfile.cs +0 -26
- package/Modules/__MODULE__/__ITEM__Module.API/__ITEM__Module.API.csproj +0 -27
- package/Modules/__MODULE__/__ITEM__Module.API/__ITEM__Module.cs +0 -24
- package/Modules/__MODULE__/__ITEM__Module.Core/Dtos/Admin/__ITEM__RequestDto.cs +0 -8
- package/Modules/__MODULE__/__ITEM__Module.Core/Dtos/Admin/__ITEM__ResponseDto.cs +0 -8
- package/Modules/__MODULE__/__ITEM__Module.Core/Entities/__ITEM__.cs +0 -8
- package/Modules/__MODULE__/__ITEM__Module.Core/Interfaces/API/I__ITEM__Service.cs +0 -9
- package/Modules/__MODULE__/__ITEM__Module.Core/Interfaces/SPI/I__ITEM__Infra.cs +0 -9
- package/Modules/__MODULE__/__ITEM__Module.Core/Services/__ITEM__Service.cs +0 -20
- package/Modules/__MODULE__/__ITEM__Module.Core/__ITEM__CoreDependencyInjection.cs +0 -19
- package/Modules/__MODULE__/__ITEM__Module.Core/__ITEM__Module.Core.csproj +0 -18
- package/Modules/__MODULE__/__ITEM__Module.Infrastructure/Database/Seeder.cs +0 -21
- package/Modules/__MODULE__/__ITEM__Module.Infrastructure/Database/__ITEM__Configuration.cs +0 -22
- package/Modules/__MODULE__/__ITEM__Module.Infrastructure/Services/MySQL__ITEM__Infra.cs +0 -16
- package/Modules/__MODULE__/__ITEM__Module.Infrastructure/__ITEM__InfraDependencyInjection.cs +0 -21
- package/Modules/__MODULE__/__ITEM__Module.Infrastructure/__ITEM__Module.Infrastructure.csproj +0 -14
package/bin/create-module.js
CHANGED
|
@@ -34,7 +34,7 @@ const sourceModulePath = path.join(modulesTemplateRoot, `${sourceModuleName}Modu
|
|
|
34
34
|
// =======================
|
|
35
35
|
|
|
36
36
|
const destinationRoot = process.cwd();
|
|
37
|
-
const destinationModulePath = path.join(destinationRoot, newModuleName);
|
|
37
|
+
const destinationModulePath = path.join(destinationRoot, `${newModuleName}Module`);
|
|
38
38
|
|
|
39
39
|
// =======================
|
|
40
40
|
// Guards
|
package/package.json
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
using AutoMapper;
|
|
2
|
-
using __ITEM__Module.Core.Dtos.Admin;
|
|
3
|
-
using __ITEM__Module.Core.Entities;
|
|
4
|
-
using __ITEM__Module.Core.Interfaces.API;
|
|
5
|
-
using Microsoft.AspNetCore.Http;
|
|
6
|
-
using Microsoft.AspNetCore.Mvc;
|
|
7
|
-
using Microsoft.Extensions.Logging;
|
|
8
|
-
using Shared.Core.Shared.Models;
|
|
9
|
-
using System.Diagnostics;
|
|
10
|
-
|
|
11
|
-
namespace __ITEM__Module.API.Controllers.Public
|
|
12
|
-
{
|
|
13
|
-
/// <summary>
|
|
14
|
-
/// __ITEM__ Controller
|
|
15
|
-
/// </summary>
|
|
16
|
-
[Route("rest/v{version:apiVersion}/__item__s")]
|
|
17
|
-
[Produces("application/json")]
|
|
18
|
-
[ApiController]
|
|
19
|
-
public class __ITEM__Controller : Controller
|
|
20
|
-
{
|
|
21
|
-
private readonly IMapper _mapper;
|
|
22
|
-
private ILogger _logger;
|
|
23
|
-
private readonly I__ITEM__Service ___item__Service;
|
|
24
|
-
|
|
25
|
-
/// <summary>
|
|
26
|
-
/// Constructor
|
|
27
|
-
/// </summary>
|
|
28
|
-
/// <param name="logger"></param>
|
|
29
|
-
/// <param name="mapper"></param>
|
|
30
|
-
/// <param name="__item__Service"></param>
|
|
31
|
-
public __ITEM__Controller(
|
|
32
|
-
ILogger<__ITEM__Controller> logger,
|
|
33
|
-
IMapper mapper,
|
|
34
|
-
I__ITEM__Service __item__Service)
|
|
35
|
-
{
|
|
36
|
-
_mapper = mapper;
|
|
37
|
-
_logger = logger;
|
|
38
|
-
___item__Service = __item__Service;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
/// Get __item__s
|
|
43
|
-
/// </summary>
|
|
44
|
-
/// <param name="pagingParams"></param>
|
|
45
|
-
/// <returns></returns>
|
|
46
|
-
[HttpGet]
|
|
47
|
-
[ProducesResponseType(typeof(PagerData<__ITEM__ResponseDto>), StatusCodes.Status200OK)]
|
|
48
|
-
public async Task<IActionResult> Get__ITEM__s([FromQuery] PagingParams pagingParams)
|
|
49
|
-
{
|
|
50
|
-
_logger.LogInformation($"Start getting __item__s");
|
|
51
|
-
var stopwatch = Stopwatch.StartNew();
|
|
52
|
-
|
|
53
|
-
PagerData<__ITEM__> __item__s = await ___item__Service.Get__ITEM__sAsync(pagingParams);
|
|
54
|
-
PagerData<__ITEM__ResponseDto> __item__Response = _mapper.Map<PagerData<__ITEM__ResponseDto>>(__item__s);
|
|
55
|
-
|
|
56
|
-
// Add custom headers
|
|
57
|
-
Response.Headers.Append("X-WP-Total", __item__s.TotalRecords.ToString());
|
|
58
|
-
|
|
59
|
-
stopwatch.Stop();
|
|
60
|
-
_logger.LogInformation($"Getting __item__s done in {stopwatch.ElapsedMilliseconds}");
|
|
61
|
-
|
|
62
|
-
return Ok(__item__Response.__ITEM__s);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
using AutoMapper;
|
|
2
|
-
using __ITEM__Module.Core.Dtos.Admin;
|
|
3
|
-
using __ITEM__Module.Core.Entities;
|
|
4
|
-
using Shared.Core.Shared.Models;
|
|
5
|
-
|
|
6
|
-
namespace __ITEM__Module.API.Mappers
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
/// Dto__ITEM__MappingProfile
|
|
10
|
-
/// </summary>
|
|
11
|
-
public class Dto__ITEM__MappingProfile : Profile
|
|
12
|
-
{
|
|
13
|
-
/// <summary>
|
|
14
|
-
/// Constructor
|
|
15
|
-
/// </summary>
|
|
16
|
-
public Dto__ITEM__MappingProfile()
|
|
17
|
-
{
|
|
18
|
-
CreateMap<__ITEM__, __ITEM__RequestDto>().ReverseMap();
|
|
19
|
-
|
|
20
|
-
CreateMap<PagerData<__ITEM__>, PagerData<__ITEM__ResponseDto>>().ReverseMap();
|
|
21
|
-
|
|
22
|
-
CreateMap<__ITEM__, __ITEM__ResponseDto>()
|
|
23
|
-
.ReverseMap();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
-
|
|
3
|
-
<PropertyGroup>
|
|
4
|
-
<TargetFramework>net10.0</TargetFramework>
|
|
5
|
-
<ImplicitUsings>enable</ImplicitUsings>
|
|
6
|
-
<Nullable>enable</Nullable>
|
|
7
|
-
</PropertyGroup>
|
|
8
|
-
|
|
9
|
-
<__ITEM__Group>
|
|
10
|
-
<Folder Include="Controllers\Admin\" />
|
|
11
|
-
</__ITEM__Group>
|
|
12
|
-
|
|
13
|
-
<__ITEM__Group>
|
|
14
|
-
<PackageReference Include="Asp.Versioning.Mvc" Version="8.1.1" />
|
|
15
|
-
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.1" />
|
|
16
|
-
<PackageReference Include="AutoMapper" Version="16.0.0" />
|
|
17
|
-
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="10.0.2" />
|
|
18
|
-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.3.9" />
|
|
19
|
-
</__ITEM__Group>
|
|
20
|
-
|
|
21
|
-
<__ITEM__Group>
|
|
22
|
-
<ProjectReference Include="..\__ITEM__Module.Core\__ITEM__Module.Core.csproj" />
|
|
23
|
-
<ProjectReference Include="..\__ITEM__Module.Infrastructure\__ITEM__Module.Infrastructure.csproj" />
|
|
24
|
-
<ProjectReference Include="..\Shared.Core\Shared.Core.csproj" />
|
|
25
|
-
</__ITEM__Group>
|
|
26
|
-
|
|
27
|
-
</Project>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.API.Controllers.Public;
|
|
2
|
-
using __ITEM__Module.API.Mappers;
|
|
3
|
-
using __ITEM__Module.Core;
|
|
4
|
-
using __ITEM__Module.Infrastructure;
|
|
5
|
-
using Microsoft.Extensions.Configuration;
|
|
6
|
-
using Microsoft.Extensions.DependencyInjection;
|
|
7
|
-
using Shared.Core.Interfaces.Modules;
|
|
8
|
-
using System.Reflection;
|
|
9
|
-
|
|
10
|
-
namespace __ITEM__Module.API
|
|
11
|
-
{
|
|
12
|
-
public class __ITEM__Module : IModule
|
|
13
|
-
{
|
|
14
|
-
public string Name => "__ITEM__";
|
|
15
|
-
public void Register(IServiceCollection services, IConfiguration config)
|
|
16
|
-
{
|
|
17
|
-
__ITEM__CoreDependencyInjection.AddModule(services);
|
|
18
|
-
__ITEM__InfraDependencyInjection.AddModule(services);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public Assembly ApiAssembly => typeof(__ITEM__Controller).Assembly;
|
|
22
|
-
public Assembly MappingAssembly => typeof(Dto__ITEM__MappingProfile).Assembly;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.Core.Entities;
|
|
2
|
-
using __ITEM__Module.Core.Interfaces.API;
|
|
3
|
-
using __ITEM__Module.Core.Interfaces.SPI;
|
|
4
|
-
using Microsoft.Extensions.Logging;
|
|
5
|
-
using Shared.Core.Interfaces.SPI;
|
|
6
|
-
using Shared.Core.Services;
|
|
7
|
-
|
|
8
|
-
namespace __ITEM__Module.Core.Services
|
|
9
|
-
{
|
|
10
|
-
public class __ITEM__Service : __ITEM__Service<__ITEM__>, I__ITEM__Service
|
|
11
|
-
{
|
|
12
|
-
private readonly I__ITEM__Infra _userInfra;
|
|
13
|
-
public __ITEM__Service(ILogger<__ITEM__Service> logger,
|
|
14
|
-
IRepositoryFactory<__ITEM__> repositoryFactory,
|
|
15
|
-
I__ITEM__Infra userInfra) : base(logger, repositoryFactory)
|
|
16
|
-
{
|
|
17
|
-
_userInfra = userInfra;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.Core.Interfaces.API;
|
|
2
|
-
using __ITEM__Module.Core.Services;
|
|
3
|
-
using Microsoft.Extensions.DependencyInjection;
|
|
4
|
-
using Shared.Core.Interfaces.API;
|
|
5
|
-
using Shared.Core.Services;
|
|
6
|
-
|
|
7
|
-
namespace __ITEM__Module.Core
|
|
8
|
-
{
|
|
9
|
-
public static class __ITEM__CoreDependencyInjection
|
|
10
|
-
{
|
|
11
|
-
public static IServiceCollection AddModule(
|
|
12
|
-
this IServiceCollection services)
|
|
13
|
-
{
|
|
14
|
-
services.AddScoped(typeof(I__ITEM__Service<>), typeof(__ITEM__Service<>));
|
|
15
|
-
services.AddScoped<I__ITEM__Service, __ITEM__Service>();
|
|
16
|
-
return services;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
-
|
|
3
|
-
<PropertyGroup>
|
|
4
|
-
<TargetFramework>net10.0</TargetFramework>
|
|
5
|
-
<ImplicitUsings>enable</ImplicitUsings>
|
|
6
|
-
<Nullable>enable</Nullable>
|
|
7
|
-
</PropertyGroup>
|
|
8
|
-
|
|
9
|
-
<__ITEM__Group>
|
|
10
|
-
<ProjectReference Include="..\Shared.Core\Shared.Core.csproj" />
|
|
11
|
-
</__ITEM__Group>
|
|
12
|
-
|
|
13
|
-
<__ITEM__Group>
|
|
14
|
-
<Folder Include="Dtos\Public\" />
|
|
15
|
-
<Folder Include="Enums\" />
|
|
16
|
-
</__ITEM__Group>
|
|
17
|
-
|
|
18
|
-
</Project>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.Core.Entities;
|
|
2
|
-
using Microsoft.EntityFrameworkCore;
|
|
3
|
-
using Shared.Core.Enums;
|
|
4
|
-
using Shared.Core.Interfaces.SPI;
|
|
5
|
-
|
|
6
|
-
namespace __ITEM__Module.Infrastructure.Database
|
|
7
|
-
{
|
|
8
|
-
public class Seeder : IModuleSeeder
|
|
9
|
-
{
|
|
10
|
-
public void Seed(ModelBuilder modelBuilder)
|
|
11
|
-
{
|
|
12
|
-
modelBuilder.Entity<__ITEM__>().HasData(
|
|
13
|
-
new __ITEM__
|
|
14
|
-
{
|
|
15
|
-
Id = Guid.Parse("11111111-1111-1111-1111-111111111111"),
|
|
16
|
-
Status = EntityStatus.Active,
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.Core.Entities;
|
|
2
|
-
using Microsoft.EntityFrameworkCore;
|
|
3
|
-
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
4
|
-
|
|
5
|
-
namespace __ITEM__Module.Infrastructure.Database
|
|
6
|
-
{
|
|
7
|
-
internal class __ITEM__Configuration : IEntityTypeConfiguration<__ITEM__>
|
|
8
|
-
{
|
|
9
|
-
public void Configure(EntityTypeBuilder<__ITEM__> builder)
|
|
10
|
-
{
|
|
11
|
-
// Table
|
|
12
|
-
builder.ToTable("__ITEM__s");
|
|
13
|
-
|
|
14
|
-
// Primary key
|
|
15
|
-
builder.HasKey(x => x.Id);
|
|
16
|
-
|
|
17
|
-
// BaseEntity (nếu có)
|
|
18
|
-
builder.Property(x => x.Id)
|
|
19
|
-
.IsRequired();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.Core.Entities;
|
|
2
|
-
using __ITEM__Module.Core.Interfaces.SPI;
|
|
3
|
-
using Microsoft.Extensions.Logging;
|
|
4
|
-
using Shared.Infrastructure.Database;
|
|
5
|
-
using Shared.Infrastructure.Services.MySQL;
|
|
6
|
-
|
|
7
|
-
namespace __ITEM__Module.Infrastructure.Services
|
|
8
|
-
{
|
|
9
|
-
public class MySQL__ITEM__Infra : MySQL__ITEM__Infra<__ITEM__>, I__ITEM__Infra
|
|
10
|
-
{
|
|
11
|
-
public MySQL__ITEM__Infra(MyDbContext dbContext, ILogger<MySQL__ITEM__Infra> logger)
|
|
12
|
-
: base(dbContext, logger)
|
|
13
|
-
{
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
package/Modules/__MODULE__/__ITEM__Module.Infrastructure/__ITEM__InfraDependencyInjection.cs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
using __ITEM__Module.Core.Interfaces.SPI;
|
|
2
|
-
using __ITEM__Module.Infrastructure.Database;
|
|
3
|
-
using __ITEM__Module.Infrastructure.Services;
|
|
4
|
-
using Microsoft.Extensions.DependencyInjection;
|
|
5
|
-
using Shared.Core.Interfaces.SPI;
|
|
6
|
-
using Shared.Infrastructure.Services.MySQL;
|
|
7
|
-
|
|
8
|
-
namespace __ITEM__Module.Infrastructure
|
|
9
|
-
{
|
|
10
|
-
public static class __ITEM__InfraDependencyInjection
|
|
11
|
-
{
|
|
12
|
-
public static IServiceCollection AddModule(
|
|
13
|
-
this IServiceCollection services)
|
|
14
|
-
{
|
|
15
|
-
services.AddScoped<IModuleSeeder, Seeder>();
|
|
16
|
-
services.AddScoped<I__ITEM__Infra, MySQL__ITEM__Infra>();
|
|
17
|
-
services.AddScoped(typeof(I__ITEM__Infra<>), typeof(MySQL__ITEM__Infra<>));
|
|
18
|
-
return services;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
package/Modules/__MODULE__/__ITEM__Module.Infrastructure/__ITEM__Module.Infrastructure.csproj
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
-
|
|
3
|
-
<PropertyGroup>
|
|
4
|
-
<TargetFramework>net10.0</TargetFramework>
|
|
5
|
-
<ImplicitUsings>enable</ImplicitUsings>
|
|
6
|
-
<Nullable>enable</Nullable>
|
|
7
|
-
</PropertyGroup>
|
|
8
|
-
|
|
9
|
-
<__ITEM__Group>
|
|
10
|
-
<ProjectReference Include="..\__ITEM__Module.Core\__ITEM__Module.Core.csproj" />
|
|
11
|
-
<ProjectReference Include="..\Shared.Infrastructure\Shared.Infrastructure.csproj" />
|
|
12
|
-
</__ITEM__Group>
|
|
13
|
-
|
|
14
|
-
</Project>
|