backend phase 0: foundation, cross-cutting seams & starter cleanup

Remove the Order demo (entity/feature/repo/config/gRPC/proto) and the three
pre-marketplace migrations; regenerate a fresh InitialBaseline migration.

Stand up the REST surface (PingController + System/Ping CQRS) proving the
Mediator -> behaviors -> OperationResult -> ApiResult envelope end to end.

Close wiring gaps: register LoggingBehavior (outermost) and add the built-in
rate limiter (per-IP global + otp/auth/sensitive policies), placed before
authentication.

Add current-user + audit plumbing: ICurrentUser (HttpContext + null impls),
rename BaseEntity audit fields to CreatedAt/ModifiedAt (DateTimeOffset) +
CreatedById/ModifiedById, stamped by a new AuditFieldInterceptor.

Introduce five cross-cutting seams (IDateTimeProvider, IFieldEncryptor,
ICacheService, IObjectStorage, INotificationDispatcher) with in-memory/local
mocks registered via AddCrossCuttingSeams.

Add Baya.Test.Foundation (encryptor, audit interceptor, ping handler) and
update docs, contracts (swagger.v1.json), handoff, report, and mocks registry.
This commit is contained in:
hamid
2026-06-30 22:48:41 +03:30
parent 53a40dc51d
commit 765cc632d5
75 changed files with 1539 additions and 1418 deletions
@@ -18,7 +18,6 @@ public class ApplicationDbContext: IdentityDbContext<User, Role, int, UserClaim,
private void OnSavingChanges(object sender, SavingChangesEventArgs e)
{
_cleanString();
ConfigureEntityDates();
}
private void _cleanString()
@@ -62,30 +61,4 @@ public class ApplicationDbContext: IdentityDbContext<User, Role, int, UserClaim,
}
private void ConfigureEntityDates()
{
var updatedEntities = ChangeTracker.Entries().Where(x =>
x.Entity is ITimeModification && x.State == EntityState.Modified).Select(x => x.Entity as ITimeModification);
var addedEntities = ChangeTracker.Entries().Where(x =>
x.Entity is ITimeModification && x.State == EntityState.Added).Select(x => x.Entity as ITimeModification);
foreach (var entity in updatedEntities)
{
if (entity != null)
{
entity.ModifiedDate = DateTime.Now;
}
}
foreach (var entity in addedEntities)
{
if (entity != null)
{
entity.CreatedTime = DateTime.Now;
entity.ModifiedDate = DateTime.Now;
}
}
}
}