Skip to content

Commit 271729c

Browse files
authored
Angular upgrade 18 (#13)
* angular upgrade * Angular upgrade and data seed fix * fixing issues * Angular upgrade
1 parent c61e826 commit 271729c

File tree

162 files changed

+8450
-10395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+8450
-10395
lines changed

.DS_Store

6 KB
Binary file not shown.

Api/WebApi/Program.cs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,8 @@ public static async Task Main(string[] args)
2525
.ReadFrom.Configuration(config)
2626
.CreateLogger();
2727
var host = CreateHostBuilder(args).Build();
28-
29-
using (var scope = host.Services.CreateScope())
30-
{
31-
var services = scope.ServiceProvider;
32-
33-
var loggerFactory = services.GetRequiredService<ILoggerFactory>();
34-
try
35-
{
36-
var userManager = services.GetRequiredService<UserManager<ApplicationUser>>();
37-
var roleManager = services.GetRequiredService<RoleManager<IdentityRole>>();
38-
39-
await Infrastructure.Identity.Seeds.DefaultRoles.SeedAsync(userManager, roleManager);
40-
await Infrastructure.Identity.Seeds.DefaultSuperAdmin.SeedAsync(userManager, roleManager);
41-
await Infrastructure.Identity.Seeds.DefaultBasicUser.SeedAsync(userManager, roleManager);
42-
Log.Information("Finished Seeding Default Data");
43-
Log.Information("Application Starting");
44-
host.Run();
45-
}
46-
catch (Exception ex)
47-
{
48-
Log.Warning(ex, "An error occurred seeding the DB");
49-
}
50-
finally
51-
{
52-
Log.CloseAndFlush();
53-
}
54-
}
28+
host.Run();
29+
5530
}
5631

5732
public static IHostBuilder CreateHostBuilder(string[] args) =>

Api/WebApi/Startup.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
using System;
12
using Application;
23
using Application.Interfaces;
34
using Infrastructure.Identity;
45
using Infrastructure.Identity.Contexts;
6+
using Infrastructure.Identity.Models;
57
using Infrastructure.Persistence;
68
using Infrastructure.Persistence.Contexts;
79
using Infrastructure.Shared;
810
using Microsoft.AspNetCore.Builder;
911
using Microsoft.AspNetCore.Hosting;
12+
using Microsoft.AspNetCore.Identity;
1013
using Microsoft.EntityFrameworkCore;
1114
using Microsoft.Extensions.Configuration;
1215
using Microsoft.Extensions.DependencyInjection;
1316
using Microsoft.Extensions.Hosting;
17+
using Microsoft.Extensions.Logging;
1418
using WebApi.Extensions;
1519
using WebApi.Services;
1620

@@ -36,7 +40,7 @@ public void ConfigureServices(IServiceCollection services)
3640
services.AddScoped<IAuthenticatedUserService, AuthenticatedUserService>();
3741
}
3842

39-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
43+
public async void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4044
{
4145
if (env.IsDevelopment())
4246
{
@@ -71,5 +75,30 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
7175
var context = serviceScope.ServiceProvider.GetService<IdentityContext>();
7276
context.Database.Migrate();
7377
}
78+
79+
using (var scope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope())
80+
{
81+
var services = scope.ServiceProvider;
82+
83+
var loggerFactory = services.GetRequiredService<ILoggerFactory>();
84+
try
85+
{
86+
var userManager = services.GetRequiredService<UserManager<ApplicationUser>>();
87+
var roleManager = services.GetRequiredService<RoleManager<IdentityRole>>();
88+
89+
await Infrastructure.Identity.Seeds.DefaultRoles.SeedAsync(userManager, roleManager);
90+
await Infrastructure.Identity.Seeds.DefaultSuperAdmin.SeedAsync(userManager, roleManager);
91+
await Infrastructure.Identity.Seeds.DefaultBasicUser.SeedAsync(userManager, roleManager);
92+
93+
}
94+
catch (Exception ex)
95+
{
96+
97+
}
98+
finally
99+
{
100+
101+
}
102+
}
74103
}
75104
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Full Stack (dotnet, angular and postgres) boilerplate with Docker
22
### About (Dotnet - Angular - PostgresSQL)
3-
This project is intended to provide a starting point for building full-stack web applicatioin. The stack is made of Dotnet(7) WebApi, Angular (17.0.3), PostgresSQL. The focus of this project to show case the possible way to run a real application (Dotnet, Angular and PostgresSQL) using docker for development enviornment and produciton mode.
3+
This project is intended to provide a starting point for building full-stack web applicatioin. The stack is made of Dotnet(7) WebApi, Angular (18.1.0), PostgresSQL. The focus of this project to show case the possible way to run a real application (Dotnet, Angular and PostgresSQL) using docker for development enviornment and produciton mode.
44

55
This is a simple web application. It has working user registration, login page and there is a complete example of CRUD which contains example for Angular Routing and dotnet rest api samples. Also, rest services are secure using JWT.
66

@@ -27,7 +27,7 @@ The apps written in the following JavaScript frameworks/libraries:
2727
| **WebApi** | [Rest Api using **dotnet**](https://github.com/nitin27may/angular-dotnet-core-docker/tree/master/WebApi) |
2828

2929
### Built With
30-
#### Angular (17.0.3)
30+
#### Angular (18.1.0)
3131

3232
The fronend of this project is developed in Angular. As we are using Server Side Rendering (SSR) we have used Nodejs alpine image in place of other lightweight docker image like nginx to run Angular app.
3333

frontend/.browserslistrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

frontend/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ insert_final_newline = true
99
trim_trailing_whitespace = true
1010

1111
[*.ts]
12-
quote_type = double
12+
quote_type = single
1313

1414
[*.md]
1515
max_line_length = off

frontend/.gitignore

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
1-
# See http://help.github.com/ignore-files/ for more about ignoring files.
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
22

3-
# compiled output
3+
# Compiled output
44
/dist
55
/tmp
66
/out-tsc
7-
# Only exists if Bazel was run
87
/bazel-out
9-
*/cache/
10-
# dependencies
11-
/node_modules
128

13-
# profiling files
14-
chrome-profiler-events*.json
15-
speed-measure-plugin*.json
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
1613

1714
# IDEs and editors
18-
/.idea
15+
.idea/
1916
.project
2017
.classpath
2118
.c9/
2219
*.launch
2320
.settings/
2421
*.sublime-workspace
2522

26-
# IDE - VSCode
23+
# Visual Studio Code
2724
.vscode/*
2825
!.vscode/settings.json
2926
!.vscode/tasks.json
3027
!.vscode/launch.json
3128
!.vscode/extensions.json
3229
.history/*
3330

34-
# misc
31+
# Miscellaneous
3532
/.angular/cache
36-
/.sass-cache
33+
.sass-cache/
3734
/connect.lock
3835
/coverage
3936
/libpeerconnection.log
40-
npm-debug.log
41-
yarn-error.log
4237
testem.log
4338
/typings
4439

45-
# System Files
40+
# System files
4641
.DS_Store
4742
Thumbs.db

frontend/.prettierignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

frontend/.prettierrc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"useTabs": false,
3-
"printWidth": 140,
4-
"tabWidth": 2,
5-
"singleQuote": false,
6-
"trailingComma": "none",
7-
"semi": true
2+
"printWidth": 80,
3+
"semi": true,
4+
"bracketSameLine": false,
5+
"trailingComma": "es5",
6+
"tabWidth": 4,
7+
"singleQuote": true,
8+
"bracketSpacing": true,
9+
"arrowParens": "always",
10+
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-tailwindcss"]
811
}

frontend/.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3+
"recommendations": ["angular.ng-template"]
4+
}

0 commit comments

Comments
 (0)