config.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. package model
  2. import "time"
  3. // CommonResp ...
  4. type CommonResp struct {
  5. Code int `json:"code"`
  6. Message string `json:"message"`
  7. Ttl int `json:"ttl"`
  8. }
  9. // BuildNewFile ...
  10. type BuildNewFile struct {
  11. ID int `json:"id"`
  12. AppID int `json:"app_id"`
  13. Name string `json:"name"`
  14. Comment string `json:"comment"`
  15. From int `json:"from"`
  16. State int `json:"state"`
  17. Mark string `json:"mark"`
  18. Operator string `json:"operator"`
  19. IsDelete int `json:"is_delete"`
  20. NewCommon int `json:"new_common"`
  21. Ctime int `json:"ctime"`
  22. Mtime int `json:"mtime"`
  23. }
  24. // BuildFile ...
  25. type BuildFile struct {
  26. *BuildNewFile
  27. LastConf *BuildNewFile `json:"last_conf"`
  28. }
  29. // ConfigData ...
  30. type ConfigData struct {
  31. Files []*BuildFile `json:"files"`
  32. BuildFiles []*BuildFile `json:"build_files"`
  33. BuildNewFile []*BuildNewFile `json:"build_new_file"`
  34. }
  35. // ConfigsParam ...
  36. type ConfigsParam struct {
  37. AppName string
  38. TreeID int
  39. Env string
  40. Zone string
  41. BuildId int
  42. Build string
  43. Token string
  44. FilenameGo string
  45. FilenameRunnerJava string
  46. FilenameTokenJava string
  47. FilenameRunnerCommon string
  48. Increment int
  49. Force int
  50. AutoRequiredParams []string
  51. RequiredParams []string
  52. Comment *ConfigComment
  53. }
  54. // SagaConfigsParam ...
  55. type SagaConfigsParam struct {
  56. FileName string
  57. AppName string
  58. TreeID int
  59. Env string
  60. Zone string
  61. BuildId int
  62. Build string
  63. Token string
  64. Increment int
  65. Force int
  66. UserList []string
  67. }
  68. // ConfigComment ...
  69. type ConfigComment struct {
  70. CommentURL string
  71. }
  72. // TagUpdate ...
  73. type TagUpdate struct {
  74. Mark string `form:"mark"`
  75. Names string `form:"names"`
  76. }
  77. // SvenResp ...
  78. type SvenResp struct {
  79. CommonResp
  80. Data *ConfigData `json:"data"`
  81. }
  82. // ConfigValueResp ...
  83. type ConfigValueResp struct {
  84. CommonResp
  85. Data *BuildNewFile `json:"data"`
  86. }
  87. // Config ...
  88. type Config struct {
  89. Property *Property
  90. }
  91. // Property ...
  92. type Property struct {
  93. Repos []*RepoConfig
  94. }
  95. // ConfigList ...
  96. type ConfigList struct {
  97. ProjectID int `json:"project_id" validate:"required"`
  98. Configs []ConfigSagaItem `json:"configs"`
  99. }
  100. // ConfigSagaItem ...
  101. type ConfigSagaItem struct {
  102. Name string `json:"name" validate:"required"`
  103. Value interface{} `json:"value"`
  104. }
  105. // SagaConfigLogResp ...
  106. type SagaConfigLogResp struct {
  107. Id int `form:"id" gorm:"column:id"`
  108. Username string `form:"username" json:"username" gorm:"column:username"`
  109. ProjectId int `form:"project_id" json:"project_id" gorm:"column:project_id"`
  110. Content string `form:"content" json:"content" gorm:"column:content"`
  111. Ctime time.Time `form:"ctime" json:"ctime" gorm:"column:ctime"`
  112. Mtime time.Time `form:"mtime" json:"mtime" gorm:"column:mtime"`
  113. UpdateUser string `form:"update_user" json:"update_user" gorm:"column:update_user"`
  114. Status int `form:"status" json:"status" gorm:"column:status"` //1创建 2修改 3同步中 4同步完成 5同步失败
  115. }
  116. // UpdateConfigReq ...
  117. type UpdateConfigReq struct {
  118. Ids []int `json:"ids" validate:"required"`
  119. ConfigID string `json:"config_id" validate:"required"`
  120. ConfigName string `json:"config_name" validate:"required"`
  121. Mark string `json:"mark" validate:"required"`
  122. }
  123. // OptionSagaItem ...
  124. type OptionSagaItem struct {
  125. ConfigSagaItem
  126. CNName string `json:"cn_name"`
  127. Remark string `json:"remark"`
  128. Type string `json:"type"`
  129. Require bool `json:"require"`
  130. }
  131. // RepoConfig ...
  132. type RepoConfig struct {
  133. URL string
  134. Group string
  135. Name string
  136. GName string // gitlab仓库别名
  137. Language string
  138. AuthBranches []string // 鉴权分支
  139. TargetBranches []string // 分支白名单
  140. LockTimeout int32
  141. MinReviewer int
  142. RelatePipeline bool
  143. DelayMerge bool
  144. LimitAuth bool
  145. AllowLabel string
  146. SuperAuthUsers []string
  147. }