Add tool api

This commit is contained in:
2024-01-18 14:14:36 +08:00
parent 0512bab3ca
commit d559fc53dd
52 changed files with 1738 additions and 64 deletions

View File

@@ -0,0 +1,44 @@
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

@@ -0,0 +1,15 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
data class ToolBaseAddParam(
@field: NotBlank(message = "Name can not be blank")
val name: String?,
@field: NotNull(message = "Source can not be null")
val source: String?,
@field:NotNull(message = "Dist can not be null")
val dist: String?
)

View File

@@ -0,0 +1,14 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotNull
data class ToolBaseUpdateParam(
@field: NotNull(message = "ID can not be null")
val id: Long?,
val name: String?,
val source: String?,
val dist: String?
)

View File

@@ -0,0 +1,10 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotBlank
data class ToolCategoryAddParam(
@field: NotBlank(message = "Name can not be blank")
val name: String?,
val enable: Boolean = true
)

View File

@@ -0,0 +1,14 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
data class ToolCategoryUpdateParam(
@field: NotNull(message = "ID can not be null")
val id: Long?,
@field: NotBlank(message = "Name can not be blank")
val name: String?,
val enable: Boolean?
)

View File

@@ -0,0 +1,23 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
data class ToolTemplateAddParam(
@field: NotBlank(message = "Name can not be blank")
val name: String?,
@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?,
@field: NotNull(message = "BaseId can not be null")
val baseId: Long? = null,
@field: NotNull(message = "Source can not be null")
val source: String?,
@field:NotNull(message = "Dist can not be null")
val dist: String?
)

View File

@@ -0,0 +1,20 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
data class ToolTemplateUpdateParam(
@field: NotNull(message = "ID can not be null")
val id: Long?,
val name: String?,
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
val ver: String?,
val baseId: Long?,
val source: String?,
val dist: String?
)

View File

@@ -0,0 +1,34 @@
package top.fatweb.oxygen.api.param.tool
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
data class ToolUpdateParam(
@field: NotNull(message = "ID can not be null")
val id: Long?,
val name: String?,
@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?,
val authorId: Long?,
@field: Pattern(regexp = "^\\d+\\.\\d+\\.\\d+\$", message = "Ver can only match '<number>.<number>.<number>'")
val ver: String?,
val privately: Boolean?,
val keywords: List<String>,
val categories: List<Long>,
val source: String?,
val dist: String?
)