Skip to content

Commit

Permalink
Merge pull request #686 from mixcore/feature/refactor
Browse files Browse the repository at this point in the history
Restructure solution folders
  • Loading branch information
nhathoang989 authored Aug 10, 2023
2 parents a39d5a9 + c815ec8 commit cfedcf7
Show file tree
Hide file tree
Showing 8 changed files with 425 additions and 70 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "feature/refactor" ]
pull_request:
branches: [ "feature/refactor" ]

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: 'develop'
submodules: recursive
- name: Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
submodules: recursive
- name: Restore
run: dotnet restore develop/Mixcore.sln
- name: Build
run: dotnet build develop/Mixcore.sln --no-restore
309 changes: 309 additions & 0 deletions Mixcore.sln

Large diffs are not rendered by default.

97 changes: 59 additions & 38 deletions src/Mixcore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{5B29B975-B0AC-46B3-8398-4C8A22EAE355}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{38F30F45-7DB6-4097-BA85-788ACCCBC5F2}"
ProjectSection(SolutionItems) = preProject
CodeMap.dgml = CodeMap.dgml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "applications", "applications", "{4E880812-C336-4EB2-9FED-2E437957F50A}"
EndProject
Expand Down Expand Up @@ -64,13 +61,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.repodb", "platform\mix.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.service", "platform\mix.service\mix.service.csproj", "{728EBD5B-266E-4476-9BDC-37D12194AFE2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{2D4838F0-251E-4383-9DAD-7FF91B0E0606}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "codemaps", "codemaps", "{7CEDC89A-61AF-48D8-91EF-EBE2689901CC}"
ProjectSection(SolutionItems) = preProject
CodeMap.dgml = CodeMap.dgml
codemaps\CodeMap_Platform.dgml = codemaps\CodeMap_Platform.dgml
EndProjectSection
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_6", "level_6", "{2D4838F0-251E-4383-9DAD-7FF91B0E0606}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "services", "services", "{C0A05428-767E-46C5-A31F-0D220E41F7C5}"
EndProject
Expand Down Expand Up @@ -98,6 +89,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.mixdb.event", "platform
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore.gateway", "applications\mixcore.gateway\mixcore.gateway.csproj", "{B57EEC99-85CF-4C4E-BB10-929CCD1D3723}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_0", "level_0", "{147A1144-45E8-448A-9FD7-511C999E5727}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_1", "level_1", "{0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_2", "level_2", "{92F3CAD3-DBF4-4587-A14D-8DECE4077D0C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_3", "level_3", "{69169108-92D3-411D-87EB-DF2DD026FE64}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_4", "level_4", "{175276C1-45BB-4C30-BB93-4CB2C2D4A60C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_5", "level_5", "{84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_7", "level_7", "{98FE9DF6-4B31-4A0D-A4F9-74196114CD9D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_0", "level_0", "{7C9FFA1B-D992-4E3F-B2B1-74D86E81512D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_0", "level_0", "{6F925183-31E6-4DEB-BAB1-80F330B9E199}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_1", "level_1", "{B4C40E02-E06A-4359-BDC5-349E103366AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -244,45 +255,55 @@ Global
{45077DFB-D35A-4491-993C-2AC4C8AC838E} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{5B29B975-B0AC-46B3-8398-4C8A22EAE355} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{4E880812-C336-4EB2-9FED-2E437957F50A} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{5CC5900C-50FE-4D78-9E4F-7CE267355622} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{5CC5900C-50FE-4D78-9E4F-7CE267355622} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{928B382F-48A0-4639-9EC0-0C9BE980C5C6} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{E6801B38-0264-456C-B8E6-A73262B6CBA7} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{3716FB3C-CDC3-45E7-9809-CF7F2DD30388} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{4B1A6E00-C5E7-4DA7-B234-36EA35CC9B44} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{19560515-92A4-4955-BDD9-E1CDA7E8A3BC} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{C56B8C71-AEFB-4B4C-9545-03F6A646A998} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{8401BAD4-7658-4357-859C-19F40E731848} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{681C6E43-9F8E-4A9B-AD03-12702CF47720} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{A92D009D-2C5B-46BC-893A-7AE995EE8814} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{C7AF2FD1-8490-4238-B40D-7245872FCFEC} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{F8E82C2E-0F24-4CD1-981D-436D08F73587} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{E6801B38-0264-456C-B8E6-A73262B6CBA7} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{3716FB3C-CDC3-45E7-9809-CF7F2DD30388} = {0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}
{4B1A6E00-C5E7-4DA7-B234-36EA35CC9B44} = {0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}
{19560515-92A4-4955-BDD9-E1CDA7E8A3BC} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{C56B8C71-AEFB-4B4C-9545-03F6A646A998} = {B4C40E02-E06A-4359-BDC5-349E103366AD}
{8401BAD4-7658-4357-859C-19F40E731848} = {92F3CAD3-DBF4-4587-A14D-8DECE4077D0C}
{681C6E43-9F8E-4A9B-AD03-12702CF47720} = {0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}
{A92D009D-2C5B-46BC-893A-7AE995EE8814} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{C7AF2FD1-8490-4238-B40D-7245872FCFEC} = {69169108-92D3-411D-87EB-DF2DD026FE64}
{F8E82C2E-0F24-4CD1-981D-436D08F73587} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{8D3FF4E3-4C56-4FA6-81CC-686DE037FF59} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{CD0F866F-FF61-456B-AAEA-9960B17107E3} = {8D3FF4E3-4C56-4FA6-81CC-686DE037FF59}
{80A478DE-09AD-4C60-B446-73946D8B0E51} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{2E843175-B948-4D90-A11B-415EE67D9E1A} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{D4938E22-22C3-4364-A710-557B63954B5E} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{2D254550-CE54-43A2-8AE9-FAA72F2C0FD6} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{94790DB1-AC71-48BF-8665-D04C86064231} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{34A92D4D-B94A-4674-BBA4-8D2F80BECCB6} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{081A8E1E-B431-4044-B4B7-203BD1E00589} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{E974EBC1-B6C9-4BC0-AFA5-33EB182CB6A6} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{5486F6D4-6144-470A-BEB5-270C4D02486B} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{C6B46863-6A6E-4BC0-84F6-EF9DCBCA77D1} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{728EBD5B-266E-4476-9BDC-37D12194AFE2} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{80A478DE-09AD-4C60-B446-73946D8B0E51} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{2E843175-B948-4D90-A11B-415EE67D9E1A} = {92F3CAD3-DBF4-4587-A14D-8DECE4077D0C}
{D4938E22-22C3-4364-A710-557B63954B5E} = {147A1144-45E8-448A-9FD7-511C999E5727}
{2D254550-CE54-43A2-8AE9-FAA72F2C0FD6} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{94790DB1-AC71-48BF-8665-D04C86064231} = {175276C1-45BB-4C30-BB93-4CB2C2D4A60C}
{34A92D4D-B94A-4674-BBA4-8D2F80BECCB6} = {147A1144-45E8-448A-9FD7-511C999E5727}
{081A8E1E-B431-4044-B4B7-203BD1E00589} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7}
{E974EBC1-B6C9-4BC0-AFA5-33EB182CB6A6} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{5486F6D4-6144-470A-BEB5-270C4D02486B} = {98FE9DF6-4B31-4A0D-A4F9-74196114CD9D}
{C6B46863-6A6E-4BC0-84F6-EF9DCBCA77D1} = {69169108-92D3-411D-87EB-DF2DD026FE64}
{728EBD5B-266E-4476-9BDC-37D12194AFE2} = {175276C1-45BB-4C30-BB93-4CB2C2D4A60C}
{2D4838F0-251E-4383-9DAD-7FF91B0E0606} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{7CEDC89A-61AF-48D8-91EF-EBE2689901CC} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{C0A05428-767E-46C5-A31F-0D220E41F7C5} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{362A9E6F-A253-4D17-B164-C037609DD67B} = {C0A05428-767E-46C5-A31F-0D220E41F7C5}
{362A9E6F-A253-4D17-B164-C037609DD67B} = {7C9FFA1B-D992-4E3F-B2B1-74D86E81512D}
{9ADA8E1F-F444-472C-914C-9AF2386B2D0D} = {362A9E6F-A253-4D17-B164-C037609DD67B}
{9052327F-0A55-43C2-808A-B315D12A1EB1} = {C0A05428-767E-46C5-A31F-0D220E41F7C5}
{9052327F-0A55-43C2-808A-B315D12A1EB1} = {7C9FFA1B-D992-4E3F-B2B1-74D86E81512D}
{973AC418-7E56-44F0-83B8-C316565BB0E5} = {9052327F-0A55-43C2-808A-B315D12A1EB1}
{309813E4-D6E9-4B25-949F-49B808F4DFF7} = {362A9E6F-A253-4D17-B164-C037609DD67B}
{53FDEAC2-ADEB-4E02-AF44-DC986672A02E} = {9052327F-0A55-43C2-808A-B315D12A1EB1}
{356FB416-1C32-4B59-91B4-62F62CBE394E} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{7212EE31-82F0-4741-B55F-7BCE0A3DFC5A} = {C0A05428-767E-46C5-A31F-0D220E41F7C5}
{356FB416-1C32-4B59-91B4-62F62CBE394E} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7}
{7212EE31-82F0-4741-B55F-7BCE0A3DFC5A} = {7C9FFA1B-D992-4E3F-B2B1-74D86E81512D}
{4C1341A9-F5E2-4AB1-A504-5D815CAEEAF3} = {7212EE31-82F0-4741-B55F-7BCE0A3DFC5A}
{4C7CFA3D-355B-434F-8442-2B0970BF02C5} = {7212EE31-82F0-4741-B55F-7BCE0A3DFC5A}
{9508136B-0879-4BF2-B694-3B6242715BE7} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{9508136B-0879-4BF2-B694-3B6242715BE7} = {175276C1-45BB-4C30-BB93-4CB2C2D4A60C}
{B57EEC99-85CF-4C4E-BB10-929CCD1D3723} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{147A1144-45E8-448A-9FD7-511C999E5727} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{0027B7D2-664D-4872-AE99-BA2A2BCA6B2E} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{92F3CAD3-DBF4-4587-A14D-8DECE4077D0C} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{69169108-92D3-411D-87EB-DF2DD026FE64} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{175276C1-45BB-4C30-BB93-4CB2C2D4A60C} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{98FE9DF6-4B31-4A0D-A4F9-74196114CD9D} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{7C9FFA1B-D992-4E3F-B2B1-74D86E81512D} = {C0A05428-767E-46C5-A31F-0D220E41F7C5}
{6F925183-31E6-4DEB-BAB1-80F330B9E199} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
{B4C40E02-E06A-4359-BDC5-349E103366AD} = {5B29B975-B0AC-46B3-8398-4C8A22EAE355}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0143C230-7F40-44B2-8BA3-EF5B92D55848}
Expand Down
40 changes: 15 additions & 25 deletions src/applications/Mixcore/Domain/Extensions/ServiceExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,29 @@ public static void AddMixRoutes(this IServiceCollection services)
options.SerializerSettings.Converters.Add(new StringEnumConverter());
});

services.AddSingleton<MixSEORouteTransformer>();
//services.AddSingleton<MixSEORouteTransformer>();
}

public static IApplicationBuilder UseMixRoutes(this IApplicationBuilder app)
public static IApplicationBuilder UseMixEndpoints(this IApplicationBuilder app)
{
string notStartWithPattern = "regex(^(?!(graph|app|init|page|post|security|portal|api|vue|error|swagger|graphql|ReDoc|OpenAPI|.+Hub))(.+)$)";
//string notStartWithPattern = "regex(^(?!(graph|app|init|page|post|security|portal|api|vue|error|swagger|graphql|ReDoc|OpenAPI|.+Hub))(.+)$)";
//string urlPathPattern = @"regex((([A-z0-9\-\%]+\/)*[A-z0-9\-\%]+$)?)";
app.UseRouting();

app.UseEndpoints(routes =>
{
//routes.MapDefaultControllerRoute();
routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
pattern: "{seoName:" + notStartWithPattern + "}");
routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
pattern: "{culture:" + notStartWithPattern + "}/{seoName}");
routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
pattern: "{controller:" + notStartWithPattern + "}/{id}/{seoName}");
routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
pattern: "{culture:" + notStartWithPattern + "}/{controller}/{id}/{seoName}");
//routes.MapDynamicControllerRoute<MixPortalRouteTransformer>(
// pattern: "portal-apps/{appFolder:" + urlPathPattern + "}/{param1?}/{param2?}/{param3?}/{param4?}");
routes.MapDefaultControllerRoute();
//routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
// pattern: "{seoName:" + notStartWithPattern + "}");
//routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
// pattern: "{culture:" + notStartWithPattern + "}/{seoName}");
//routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
// pattern: "{controller:" + notStartWithPattern + "}/{id}/{seoName}");
//routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
// pattern: "{culture:" + notStartWithPattern + "}/{controller}/{id}/{seoName}");
////routes.MapDynamicControllerRoute<MixPortalRouteTransformer>(
//// pattern: "portal-apps/{appFolder:" + urlPathPattern + "}/{param1?}/{param2?}/{param3?}/{param4?}");
routes.MapFallbackToFile("/index.html");
});
//app.MapWhen(
// context =>
// {
// var path = context.Request.Path.Value.ToLower();
// return
// path.StartsWith("/mix-app") ||
// path.StartsWith("/mix-content");
// },
// config => config.UseStaticFiles());

return app;
}

Expand Down
8 changes: 7 additions & 1 deletion src/applications/Mixcore/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseMixTenant();

app.UseMiddleware<AuditlogMiddleware>();

app.UseRouting();

// must go between app.UseRouting() and app.UseEndpoints.
app.UseMixAuth();

app.UseMixApps(Assembly.GetExecutingAssembly(), Configuration, env.ContentRootPath, env.IsDevelopment());
app.UseMixEndpoints();

app.UseResponseCompression();
app.UseMixResponseCaching();
Expand All @@ -68,7 +74,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseHttpsRedirection();
}

app.UseMixRoutes();

}
}
}
2 changes: 1 addition & 1 deletion src/applications/mixcore.gateway/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
}
//app.UseResponseCompression();
app.UseRouting();
app.UseMixAuthorize();
app.UseMixAuth();
app.UseMixSwaggerApps(env.IsDevelopment(), Assembly.GetExecutingAssembly());
app.UseOcelot().Wait();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ public static IServiceCollection AddMixAuthorize<TDbContext>(this IServiceCollec
return services;
}

public static IApplicationBuilder UseMixAuthorize(this IApplicationBuilder app)
public static IApplicationBuilder UseMixAuth(this IApplicationBuilder app)
{
// If there are calls to app.UseRouting() and app.UseEndpoints(...), the call to app.UseAuthorization() must go between them.
app.UseAuthentication();
app.UseAuthorization();
return app;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ public static IApplicationBuilder UseMixApps(
bool isDevelop)
{
app.UseHttpLogging();

app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseUoWs();
app.UseMixModuleApps(configuration, isDevelop);
app.UseMixSwaggerApps(isDevelop, executingAssembly);
Expand Down

0 comments on commit cfedcf7

Please sign in to comment.