@@ -35,7 +35,7 @@ public AutoReviewController(IAuthorizationService authorizationService, ICodeFil
3535 }
3636
3737 [ HttpPost ]
38- public async Task < ActionResult > UploadAutoReview ( [ FromForm ] IFormFile file , string label , bool compareAllRevisions = false )
38+ public async Task < ActionResult > UploadAutoReview ( [ FromForm ] IFormFile file , string label , bool compareAllRevisions = false , string packageVersion = null )
3939 {
4040 if ( file != null )
4141 {
@@ -46,9 +46,9 @@ public async Task<ActionResult> UploadAutoReview([FromForm] IFormFile file, stri
4646 runAnalysis : false , memoryStream : memoryStream ) ;
4747
4848 var apiRevision = await CreateAutomaticRevisionAsync ( codeFile : codeFile , label : label , originalName : file . FileName , memoryStream : memoryStream , compareAllRevisions ) ;
49-
5049 if ( apiRevision != null )
5150 {
51+ apiRevision = await _apiRevisionsManager . UpdateRevisionMetadataAsync ( apiRevision , packageVersion ?? codeFile . PackageVersion , label ) ;
5252 var reviewUrl = $ "{ this . Request . Scheme } ://{ this . Request . Host } /Assemblies/Review/{ apiRevision . ReviewId } ?revisionId={ apiRevision . Id } ";
5353 return apiRevision . IsApproved ? Ok ( reviewUrl ) : StatusCode ( statusCode : StatusCodes . Status201Created , reviewUrl ) ;
5454 }
@@ -100,7 +100,8 @@ public async Task<ActionResult> CreateApiReview(
100100 string repoName ,
101101 string packageName ,
102102 bool compareAllRevisions ,
103- string project
103+ string project ,
104+ string packageVersion = null
104105 )
105106 {
106107 using var memoryStream = new MemoryStream ( ) ;
@@ -115,6 +116,7 @@ string project
115116 var apiRevision = await CreateAutomaticRevisionAsync ( codeFile : codeFile , label : label , originalName : originalFilePath , memoryStream : memoryStream , compareAllRevisions ) ;
116117 if ( apiRevision != null )
117118 {
119+ apiRevision = await _apiRevisionsManager . UpdateRevisionMetadataAsync ( apiRevision , packageVersion ?? codeFile . PackageVersion , label ) ;
118120 var reviewUrl = $ "{ this . Request . Scheme } ://{ this . Request . Host } /Assemblies/Review/{ apiRevision . ReviewId } ?revisionId={ apiRevision . Id } ";
119121 return apiRevision . IsApproved ? Ok ( reviewUrl ) : StatusCode ( statusCode : StatusCodes . Status201Created , reviewUrl ) ;
120122 }
@@ -198,8 +200,8 @@ private async Task<APIRevisionListItemModel> CreateAutomaticRevisionAsync(CodeFi
198200 if ( apiRev . IsApproved && await _apiRevisionsManager . AreAPIRevisionsTheSame ( apiRev , renderedCodeFile ) )
199201 {
200202 await _apiRevisionsManager . ToggleAPIRevisionApprovalAsync ( user : User , id : review . Id , apiRevision : apiRevision , notes : $ "Approval Copied over from Revision with Id : { apiRev . Id } ", approver : apiRev . Approvers . LastOrDefault ( ) ) ;
201- }
202- break ;
203+ break ;
204+ }
203205 }
204206 }
205207 }
0 commit comments