Commit b7b9760
committed
refactor: DRY persistence registration, server-side EF sorting, security hardening
- P0: Replace hardcoded connection string fallback with throw in Program.cs
- P1.1: Extract AddPersistenceModule<TDbContext,TStore,TReader,TImpl>() generic
method in ChengYuanEntityFrameworkCoreServiceCollectionExtensions, simplifying
5 persistence module registrations from 5 lines each to 1 line
- P1.2: Move OrderBy/ThenBy before ToArrayAsync in EfPermissionGrantStore,
EfFeatureValueStore, EfSettingValueStore so sorting runs at database level
- P2: Add UnauthorizedAccessException->403 test for GlobalExceptionMiddleware
and 7 Identity endpoint integration tests (GET/POST/PUT/DELETE users & roles)
- P3.5: Extract JWT claim type magic strings to named constants in
CurrentUserMiddleware
Tests: 373 total (8 new), all passing1 parent ecdd195 commit b7b9760
File tree
21 files changed
+452
-3639
lines changed- src
- Applications
- AuditLogging/ChengYuan.AuditLogging.Persistence
- FeatureManagement/ChengYuan.FeatureManagement.Persistence
- Stores
- PermissionManagement/ChengYuan.PermissionManagement.Persistence
- Stores
- SettingManagement/ChengYuan.SettingManagement.Persistence
- Stores
- TenantManagement/ChengYuan.TenantManagement.Persistence
- Framework/Data
- ChengYuan.Data.Sqlite
- ChengYuan.EntityFrameworkCore
- Hosts/WebHost
- Composition/Http/Security
- tests/ChengYuan.FrameworkKernel.Tests/Hosts/WebHost
21 files changed
+452
-3639
lines changedLines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 12 | + | |
18 | 13 | | |
19 | 14 | | |
20 | 15 | | |
| |||
Lines changed: 29 additions & 529 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 12 | + | |
18 | 13 | | |
19 | 14 | | |
20 | 15 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments