Add create tool api

This commit is contained in:
2024-01-26 14:54:40 +08:00
parent 6e73f8212b
commit a66c5caa60
33 changed files with 945 additions and 302 deletions

View File

@@ -1,44 +0,0 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotEmpty
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
data class ToolAddParam(
@field: NotBlank(message = "Name can not be blank")
val name: String?,
@field: NotBlank(message = "ToolId can not be blank")
@field: Pattern(
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
message = "Ver can only match '^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$'"
)
val toolId: String?,
val description: String?,
@field: NotNull(message = "BaseId can not be null")
val baseId: Long?,
@field: NotNull(message = "AuthorId can not be null")
val authorId: Long?,
@field: NotBlank(message = "Ver can not be blank")
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
val ver: String?,
val privately: Boolean = false,
@field: NotEmpty(message = "Keywords can not be empty")
val keywords: List<String>,
@field: NotEmpty(message = "Categories can not be empty")
val categories: List<Long>,
@field: NotNull(message = "Source can not be null")
val source: String?,
@field:NotNull(message = "Dist can not be null")
val dist: String?
)

View File

@@ -18,14 +18,5 @@ data class ToolBaseAddParam(
*/
@Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank")
val name: String?,
/**
* Enable
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "启用", allowableValues = ["true", "false"], defaultValue = "true")
val enable: Boolean = true
val name: String?
)

View File

@@ -45,14 +45,5 @@ data class ToolBaseUpdateParam(
* @since 1.0.0
*/
@Schema(description = "产物")
val dist: String?,
/**
* Enable
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "启用", allowableValues = ["true", "false"])
val enable: Boolean?
val dist: String?
)

View File

@@ -0,0 +1,99 @@
package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotEmpty
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
/**
* Create tool parameters
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "创建工具请求参数")
data class ToolCreateParam(
/**
* Name
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank")
val name: String?,
/**
* Tool ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "工具唯一 ID", required = true, example = "tool_a")
@field: NotBlank(message = "ToolId can not be blank")
@field: Pattern(
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
message = "Ver can only match '^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$'"
)
val toolId: String?,
/**
* Description
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "简介")
val description: String?,
/**
* Version
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "版本", required = true, example = "1.0.3")
@field: NotBlank(message = "Ver can not be blank")
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
val ver: String?,
/**
* Template ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "模板 ID", required = true)
@field: NotNull(message = "TemplateId can not be null")
val templateId: Long?,
/**
* Privately
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "私有", allowableValues = ["true", "false"], defaultValue = "false")
val privately: Boolean = false,
/**
* Keywords
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "关键词", required = true)
@field: NotEmpty(message = "Keywords can not be empty")
val keywords: List<String>,
/**
* Categories
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "类别", required = true)
@field: NotEmpty(message = "Categories can not be empty")
val categories: List<Long>
)

View File

@@ -31,6 +31,16 @@ data class ToolTemplateAddParam(
@field: NotNull(message = "BaseId can not be null")
val baseId: Long? = null,
/**
* Entry point
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "入口文件", required = true)
@field:NotBlank(message = "EntryPoint can not be null")
val entryPoint: String? = null,
/**
* Enable
*

View File

@@ -47,6 +47,15 @@ data class ToolTemplateUpdateParam(
@Schema(description = "源码")
val source: String?,
/**
* Entry point
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "入口文件")
val entryPoint: String?,
/**
* Enable
*

View File

@@ -1,34 +1,118 @@
package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
/**
* Update tool parameters
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
data class ToolUpdateParam(
/**
* ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "ID", required = true)
@field: NotNull(message = "ID can not be null")
val id: Long?,
/**
* Name
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "名称")
val name: String?,
/**
* Tool ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "工具唯一 ID", example = "tool_a")
@field: Pattern(
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
message = "Ver can only match '^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$'"
)
val toolId: String?,
/**
* Description
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "简介")
val description: String?,
/**
* Author ID
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "作者 ID")
val authorId: Long?,
/**
* Version
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "版本", example = "1.0.3")
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
val ver: String?,
/**
* Privately
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "私有", allowableValues = ["true", "false"])
val privately: Boolean?,
/**
* Keywords
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "关键词")
val keywords: List<String>,
/**
* Categories
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "类别")
val categories: List<Long>,
/**
* Source
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "源码")
val source: String?,
/**
* Dist
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "产物")
val dist: String?
)