Implement owned Profile schema and atomic authorized lifecycle
This commit is contained in:
1 parent
523cfbf42e
commit
bfe6ebf5af
24 files changed
+3056
-3
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
[assembly:InternalsVisibleTo("HealthApp")]
|
||||
namespace HealthApp.Contracts;
|
||||
// Only the API/access assembly issues this request-local capability after policy checks.
|
||||
public sealed class AuthorizedPatientContext
|
||||
{
|
||||
internal AuthorizedPatientContext(Guid patientId, bool canWrite){PatientId=patientId;CanWrite=canWrite;}
|
||||
public Guid PatientId {get;}
|
||||
public bool CanWrite {get;}
|
||||
public void RequireWrite(){if(!CanWrite)throw new UnauthorizedAccessException("Read-only scope.");}
|
||||
}
|
||||
public interface ProfileQueries
|
||||
{
|
||||
Task<Guid?> ResolveAccountAsync(string accountId,CancellationToken ct);
|
||||
Task<PatientDto?> GetAsync(AuthorizedPatientContext scope,CancellationToken ct);
|
||||
}
|
||||
public interface ProfileCommands
|
||||
{
|
||||
Task<PatientDto> CreateAsync(string trustedAccountId,CreatePatientRequest request,CancellationToken ct);
|
||||
Task<PatientDto?> UpdateAsync(AuthorizedPatientContext scope,UpdatePatientRequest request,CancellationToken ct);
|
||||
}
|
||||
public sealed class ProfileAlreadyExistsException : Exception;
|
||||
Reference in new issue
Block a user