Skip to content

Commit c65d452

Browse files
author
rn-h
committed
CheckBundle add hash
1 parent 5fc6623 commit c65d452

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

request/app.go

+10
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ func (App) LsApp(ctx *gin.Context) {
318318
type checkBundleReq struct {
319319
AppName *string `json:"appName" binding:"required"`
320320
Deployment *string `json:"deployment" binding:"required"`
321+
Version *string `json:"version" binding:"required"`
321322
}
322323

323324
func (App) CheckBundle(ctx *gin.Context) {
@@ -333,10 +334,19 @@ func (App) CheckBundle(ctx *gin.Context) {
333334
if deployment == nil {
334335
log.Panic("Deployment " + *checkBundleReq.Deployment + " not found")
335336
}
337+
var hash *string
338+
if deployment.VersionId != nil {
339+
deployment := model.DeploymentVersion{}.GetByKeyDeploymentIdAndVersion(*deployment.Id, *checkBundleReq.Version)
340+
if deployment != nil {
341+
pack := model.GetOne[model.Package]("id", deployment.CurrentPackage)
342+
hash = pack.Hash
343+
}
344+
}
336345

337346
ctx.JSON(http.StatusOK, gin.H{
338347
"appName": app.AppName,
339348
"os": app.OS,
349+
"hash": hash,
340350
})
341351
} else {
342352
log.Panic(err.Error())

0 commit comments

Comments
 (0)