22using Microsoft . EntityFrameworkCore ;
33using Microsoft . Extensions . Logging ;
44using NHS . MESH . Client . Contracts . Services ;
5+ using ServiceLayer . Mesh . Configuration ;
56using ServiceLayer . Mesh . Data ;
67using ServiceLayer . Mesh . Messaging ;
78using ServiceLayer . Mesh . Models ;
1011namespace ServiceLayer . Mesh . Functions ;
1112
1213public class FileExtractFunction (
13- ILogger logger ,
14+ ILogger < FileExtractFunction > logger ,
15+ IFileExtractFunctionConfiguration configuration ,
1416 IMeshInboxService meshInboxService ,
1517 ServiceLayerDbContext serviceLayerDbContext ,
1618 IFileTransformQueueClient fileTransformQueueClient ,
@@ -53,10 +55,7 @@ public async Task Run([QueueTrigger("file-extract")] FileExtractQueueMessage mes
5355
5456 try
5557 {
56- var mailboxId = Environment . GetEnvironmentVariable ( "NBSSMailBoxId" )
57- ?? throw new InvalidOperationException ( $ "Environment variable 'NBSSMailBoxId' is not set or is empty.") ;
58-
59- var meshResponse = await meshInboxService . GetMessageByIdAsync ( mailboxId , file . FileId ) ;
58+ var meshResponse = await meshInboxService . GetMessageByIdAsync ( configuration . NbssMeshMailboxId , file . FileId ) ;
6059 if ( ! meshResponse . IsSuccessful )
6160 {
6261 // TODO - what to do if unsuccessful?
@@ -65,7 +64,7 @@ public async Task Run([QueueTrigger("file-extract")] FileExtractQueueMessage mes
6564
6665 var blobPath = await meshFileBlobStore . UploadAsync ( file , meshResponse . Response . FileAttachment . Content ) ;
6766
68- var meshAcknowledgementResponse = await meshInboxService . AcknowledgeMessageByIdAsync ( mailboxId , message . FileId ) ;
67+ var meshAcknowledgementResponse = await meshInboxService . AcknowledgeMessageByIdAsync ( configuration . NbssMeshMailboxId , message . FileId ) ;
6968 if ( ! meshResponse . IsSuccessful )
7069 {
7170 // TODO - what to do if unsuccessful?
0 commit comments