Harden workstation UX and seed placeholder scans after Playwright QA.
Fix mobile queue navigation, draft/loading states, and Intake overflow; seed MinIO demo PDFs so document viewing does not 500; add e2e smoke coverage.
This commit is contained in:
@@ -67,6 +67,7 @@ public class CoverSheetService : ICoverSheetService
|
||||
return await _db.CoverSheets
|
||||
.Include(c => c.Patient)
|
||||
.Include(c => c.AssignToUser)
|
||||
.Include(c => c.Batch)
|
||||
.FirstOrDefaultAsync(c => c.Code == code.ToUpperInvariant().Trim());
|
||||
}
|
||||
|
||||
@@ -75,6 +76,7 @@ public class CoverSheetService : ICoverSheetService
|
||||
return await _db.CoverSheets
|
||||
.Include(c => c.Patient)
|
||||
.Include(c => c.AssignToUser)
|
||||
.Include(c => c.Batch)
|
||||
.FirstOrDefaultAsync(c => c.Id == id);
|
||||
}
|
||||
|
||||
@@ -122,6 +124,7 @@ public class CoverSheetService : ICoverSheetService
|
||||
.AsNoTracking()
|
||||
.Include(c => c.Patient)
|
||||
.Include(c => c.AssignToUser)
|
||||
.Include(c => c.Batch)
|
||||
.AsQueryable();
|
||||
|
||||
if (isUsed.HasValue)
|
||||
|
||||
@@ -70,6 +70,36 @@ public class DocumentStorageService : IDocumentStorageService
|
||||
return memStream;
|
||||
}
|
||||
|
||||
public async Task<bool> ObjectExistsAsync(string objectKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _minio.StatObjectAsync(new StatObjectArgs()
|
||||
.WithBucket(_options.BucketName)
|
||||
.WithObject(objectKey));
|
||||
return true;
|
||||
}
|
||||
catch (Minio.Exceptions.ObjectNotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task EnsureObjectAsync(string objectKey, byte[] content, string contentType)
|
||||
{
|
||||
await EnsureBucketAsync();
|
||||
if (await ObjectExistsAsync(objectKey))
|
||||
return;
|
||||
|
||||
using var stream = new MemoryStream(content);
|
||||
await _minio.PutObjectAsync(new PutObjectArgs()
|
||||
.WithBucket(_options.BucketName)
|
||||
.WithObject(objectKey)
|
||||
.WithStreamData(stream)
|
||||
.WithObjectSize(stream.Length)
|
||||
.WithContentType(contentType));
|
||||
}
|
||||
|
||||
private async Task EnsureBucketAsync()
|
||||
{
|
||||
var exists = await _minio.BucketExistsAsync(new BucketExistsArgs().WithBucket(_options.BucketName));
|
||||
|
||||
@@ -3,4 +3,8 @@ public interface IDocumentStorageService
|
||||
Task<(string objectKey, string sha256, long fileSize)> UploadAsync(Stream fileStream, string contentType, Guid batchId);
|
||||
Task<string> GetPresignedUrlAsync(string objectKey);
|
||||
Task<Stream> DownloadAsync(string objectKey);
|
||||
/// <summary>Returns false when the object is missing from the bucket.</summary>
|
||||
Task<bool> ObjectExistsAsync(string objectKey);
|
||||
/// <summary>Uploads bytes only when the object key is not already present.</summary>
|
||||
Task EnsureObjectAsync(string objectKey, byte[] content, string contentType);
|
||||
}
|
||||
Reference in New Issue
Block a user