Skip to content

Commit be9f911

Browse files
committed
Add optional description for packages
1 parent a282da6 commit be9f911

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

code-push.sql

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ CREATE TABLE `package` (
111111
`deployment_id` int DEFAULT NULL,
112112
`size` bigint DEFAULT NULL,
113113
`hash` varchar(256) DEFAULT NULL,
114+
`description` TEXT DEFAULT NULL,
114115
`download` varchar(256) DEFAULT NULL,
115116
`active` int DEFAULT '0',
116117
`failed` int DEFAULT '0',
@@ -120,6 +121,9 @@ CREATE TABLE `package` (
120121
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
121122
/*!40101 SET character_set_client = @saved_cs_client */;
122123

124+
-- `description` is not part of v1.0.1, it can be added by
125+
-- ALTER TABLE `package` ADD `description` TEXT DEFAULT NULL;
126+
123127
--
124128
-- Dumping data for table `package`
125129
--

model/package.go

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type Package struct {
1010
Failed *int `json:"failed"`
1111
Installed *int `json:"installed"`
1212
CreateTime *int64 `json:"create_time"`
13+
Description *string `json:"description"`
1314
}
1415

1516
func (Package) TableName() string {

request/app.go

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type createBundleReq struct {
6060
AppName *string `json:"appName" binding:"required"`
6161
Deployment *string `json:"deployment" binding:"required"`
6262
DownloadUrl *string `json:"downloadUrl" binding:"required"`
63+
Description *string `json:"description" binding:"required"`
6364
Version *string `json:"version" binding:"required"`
6465
Size *int64 `json:"size" binding:"required"`
6566
Hash *string `json:"hash" binding:"required"`
@@ -114,6 +115,7 @@ func (App) CreateBundle(ctx *gin.Context) {
114115
Size: createBundleReq.Size,
115116
Hash: createBundleReq.Hash,
116117
Download: createBundleReq.DownloadUrl,
118+
Description: createBundleReq.Description,
117119
Active: utils.CreateInt(0),
118120
Installed: utils.CreateInt(0),
119121
Failed: utils.CreateInt(0),

request/client.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
type Client struct{}
1717
type updateInfo struct {
1818
DownloadUrl string `json:"download_url"`
19-
// Description string `json:"description"`
19+
Description string `json:"description"`
2020
IsAvailable bool `json:"is_available"`
2121
IsDisabled bool `json:"is_disabled"`
2222
TargetBinaryRange string `json:"target_binary_range"`
@@ -62,6 +62,7 @@ func (Client) CheckUpdate(ctx *gin.Context) {
6262
label := strconv.Itoa(*packag.Id)
6363
updateInfoRedis.Label = label
6464
updateInfoRedis.DownloadUrl = config.ResourceUrl + *packag.Download
65+
updateInfoRedis.Description = *packag.Description
6566
}
6667
}
6768
deploymentVersionNew := model.DeploymentVersion{}.GetNewVersionByKeyDeploymentId(*deployment.Id)
@@ -79,6 +80,7 @@ func (Client) CheckUpdate(ctx *gin.Context) {
7980
updateInfo.IsMandatory = true
8081
updateInfo.Label = updateInfoRedis.Label
8182
updateInfo.DownloadUrl = updateInfoRedis.DownloadUrl
83+
updateInfo.Description = updateInfoRedis.Description
8284
} else if updateInfoRedis.NewVersion != "" && appVersion != updateInfoRedis.NewVersion && utils.FormatVersionStr(appVersion) < utils.FormatVersionStr(updateInfoRedis.NewVersion) {
8385
updateInfo.TargetBinaryRange = updateInfoRedis.NewVersion
8486
updateInfo.UpdateAppVersion = true

0 commit comments

Comments
 (0)