Add auto publish to tool management api

This commit is contained in:
2024-02-04 01:58:55 +08:00
parent 9692550198
commit c751b0984c
5 changed files with 46 additions and 15 deletions

View File

@@ -1,16 +1,13 @@
package top.fatweb.oxygen.api.controller.tool
import io.swagger.v3.oas.annotations.Operation
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
import top.fatweb.oxygen.api.param.tool.ToolManagementPassParam
import top.fatweb.oxygen.api.service.tool.IManagementService
import top.fatweb.oxygen.api.vo.PageVo
import top.fatweb.oxygen.api.vo.tool.ToolVo
@@ -40,7 +37,7 @@ class ManagementController(
@GetMapping
fun get(toolManagementGetParam: ToolManagementGetParam): ResponseResult<PageVo<ToolVo>> =
ResponseResult.databaseSuccess(data = managementService.getPage(toolManagementGetParam))
/**
* Pass tool review
*
@@ -49,8 +46,14 @@ class ManagementController(
*/
@Operation(summary = "通过审核")
@PostMapping("/{id}")
fun pass(@PathVariable id: Long): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(ResponseCode.DATABASE_UPDATE_SUCCESS, data = managementService.pass(id))
fun pass(
@PathVariable id: Long,
@RequestBody @Valid toolManagementPassParam: ToolManagementPassParam
): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(
ResponseCode.DATABASE_UPDATE_SUCCESS,
data = managementService.pass(id, toolManagementPassParam)
)
/**
* Reject tool review
@@ -71,7 +74,7 @@ class ManagementController(
*/
@Operation(summary = "下架")
@PatchMapping("/{id}")
fun offShelve(@PathVariable id: Long):ResponseResult<ToolVo> =
fun offShelve(@PathVariable id: Long): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(ResponseCode.DATABASE_UPDATE_SUCCESS, data = managementService.offShelve(id))
/**