Created
August 17, 2020 02:00
-
-
Save xximjasonxx/8dae9d601981abd3bb35532079780241 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("ApproveFileUpload")] | |
public static async Task<IActionResult> Run( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "approve/{fileId}")] HttpRequest req, | |
[Table("metadata", "{fileId}", "{fileId}", Connection = "TableConnectionString")] FileMetadata fileMetadata, | |
[Table("metadata", Connection = "TableConnectionString")] CloudTable metadataTable, | |
[DurableClient] IDurableOrchestrationClient client, | |
ILogger log) | |
{ | |
var instanceId = fileMetadata.WorkflowId; | |
fileMetadata.ApprovedForAnalysis = true; | |
var replaceOperation = TableOperation.Replace(fileMetadata); | |
await metadataTable.ExecuteAsync(replaceOperation); | |
await client.RaiseEventAsync(instanceId, "UploadApproved", fileMetadata.ApprovedForAnalysis); | |
return new AcceptedResult(string.Empty, fileMetadata.RowKey); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment