Skip to content

Commit

Permalink
feat:【流水线插件】支持历史大版本下的小版本更新 TencentBlueKing#1841
Browse files Browse the repository at this point in the history
  • Loading branch information
carlyin0801 committed Sep 8, 2021
1 parent e1aad31 commit 59bb42b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ interface UserMarketAtomResource {
atomCode: String
): Result<Boolean>

@ApiOperation("根据插件标识获取插件最新版本详情")
@GET
@Path("/atoms/{atomCode}/newest/detail")
fun getNewestAtomInfoByCode(
@ApiParam("userId", required = true)
@HeaderParam(AUTH_HEADER_USER_ID)
userId: String,
@ApiParam("atomCode", required = true)
@PathParam("atomCode")
atomCode: String
): Result<AtomVersion?>

@ApiOperation("查看插件的yml信息")
@GET
@Path("/atoms/{atomCode}/yml/detail")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,18 @@ class UserMarketAtomResourceImpl @Autowired constructor(
return marketAtomService.deleteAtom(userId, atomCode)
}

override fun getNewestAtomInfoByCode(userId: String, atomCode: String): Result<AtomVersion?> {
TODO("Not yet implemented")
}

override fun getAtomYmlInfo(userId: String, atomCode: String, defaultShowFlag: Boolean?): Result<String?> {
return Result(marketAtomService.generateCiYaml(atomCode = atomCode, defaultShowFlag = defaultShowFlag ?: false))
}

override fun getAtomYmlV2Info(userId: String, atomCode: String, defaultShowFlag: Boolean?): Result<String?> {
return Result(marketAtomService.generateCiV2Yaml(atomCode = atomCode, defaultShowFlag = defaultShowFlag ?: false))
return Result(marketAtomService.generateCiV2Yaml(
atomCode = atomCode,
defaultShowFlag = defaultShowFlag ?: false)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@ interface MarketAtomService {
* 查找带post属性的插件
*/
fun getPostAtoms(projectCode: String, atomItems: Set<AtomPostReqItem>): Result<AtomPostResp>

/**
* 根据插件标识获取插件最新版本详情
*/
fun getNewestAtomInfoByCode(userId: String, atomCode: String): Result<AtomVersion?>
}
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,18 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic
return getAtomVersion(atomId, userId)
}

/**
* 根据插件标识获取插件最新版本详情
*/
override fun getNewestAtomInfoByCode(userId: String, atomCode: String): Result<AtomVersion?> {
val record = marketAtomDao.getNewestAtomByCode(dslContext, atomCode)
return (if (null == record) {
Result(data = null)
} else {
getAtomVersion(record.id, userId)
})
}

@Suppress("UNCHECKED_CAST")
private fun getAtomVersion(atomId: String, userId: String): Result<AtomVersion?> {
val record = marketAtomDao.getAtomById(dslContext, atomId)
Expand Down

0 comments on commit 59bb42b

Please sign in to comment.