Automatically remove spaces on both sides of parameters #11

Merged
FatttSnake merged 3 commits from FatttSnake into dev 2024-02-27 18:28:35 +08:00
49 changed files with 320 additions and 55 deletions

View File

@@ -0,0 +1,15 @@
package top.fatweb.oxygen.api.annotation
import java.lang.annotation.Inherited
/**
* Trim string annotation
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY)
@Retention(AnnotationRetention.RUNTIME)
@Inherited
annotation class Trim

View File

@@ -13,7 +13,7 @@ import top.fatweb.oxygen.api.vo.permission.LoginVo
import top.fatweb.oxygen.api.vo.permission.RegisterVo
/**
* Event log record aspect
* Event log record interceptor
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
@@ -21,7 +21,7 @@ import top.fatweb.oxygen.api.vo.permission.RegisterVo
*/
@Aspect
@Component
class EventLogAspect(
class EventLogInterceptor(
private val eventLogService: IEventLogService
) {
/**

View File

@@ -1,4 +1,4 @@
package top.fatweb.oxygen.api.interceptor
package top.fatweb.oxygen.api.aop
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
@@ -31,6 +31,8 @@ import java.util.concurrent.Executor
* @since 1.0.0
* @see Executor
* @see ISysLogService
* @see HandlerInterceptor
* @see ResponseBodyAdvice
*/
@ControllerAdvice
class SysLogInterceptor(

View File

@@ -0,0 +1,87 @@
package top.fatweb.oxygen.api.aop
import org.aspectj.lang.JoinPoint
import org.aspectj.lang.annotation.Aspect
import org.aspectj.lang.annotation.Before
import org.aspectj.lang.annotation.Pointcut
import org.springframework.stereotype.Component
import org.springframework.web.servlet.HandlerInterceptor
import top.fatweb.oxygen.api.annotation.Trim
import kotlin.reflect.KMutableProperty
import kotlin.reflect.full.*
import kotlin.reflect.jvm.isAccessible
/**
* Trim string interceptor
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see HandlerInterceptor
*/
@Component
@Aspect
class TrimInterceptor : HandlerInterceptor {
/**
* Trim pointcut
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Pointcut("@annotation(top.fatweb.oxygen.api.annotation.Trim)")
fun trimPointcut() {
}
/**
* Do before trim pointcut
*
* @param joinPoint Join point
* @return Arguments
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see JoinPoint
*/
@Before("trimPointcut()")
fun doBefore(joinPoint: JoinPoint): Any {
val args = joinPoint.args
args?.forEachIndexed { index, any ->
if (args[index]::class.hasAnnotation<Trim>()) args[index] = trim(any)
}
return args
}
private fun trim(any: Any?): Any? {
any ?: return null
when (any) {
is Boolean, Short, Int, Long, Float, Double -> {
return any
}
is String -> {
return any.trim()
}
else -> {
val members = any::class.declaredMemberProperties
if (members.isEmpty()) {
return any
}
members.forEach {
if (!it.returnType.isSupertypeOf(String::class.starProjectedType)
|| it !is KMutableProperty<*>
|| !it.hasAnnotation<Trim>()
) {
return@forEach
}
it.isAccessible = true
if (it.call(any) != null) {
it.setter.call(any, (it.call(any) as String).trim())
}
}
return any
}
}
}
}

View File

@@ -3,7 +3,7 @@ package top.fatweb.oxygen.api.config
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
import top.fatweb.oxygen.api.interceptor.SysLogInterceptor
import top.fatweb.oxygen.api.aop.SysLogInterceptor
/**
* System log configuration

View File

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.*
@@ -38,6 +39,7 @@ class AuthenticationController(
* @see ResponseResult
* @see RegisterVo
*/
@Trim
@Operation(summary = "注册")
@PostMapping("/register")
fun register(
@@ -75,6 +77,7 @@ class AuthenticationController(
* @see VerifyParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "验证邮箱")
@PostMapping("/verify")
fun verify(@Valid @RequestBody verifyParam: VerifyParam): ResponseResult<Nothing> {
@@ -95,6 +98,7 @@ class AuthenticationController(
* @see ForgetParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "忘记密码")
@PostMapping("/forget")
fun forget(request: HttpServletRequest, @Valid @RequestBody forgetParam: ForgetParam): ResponseResult<Nothing> {
@@ -139,6 +143,7 @@ class AuthenticationController(
* @see ResponseResult
* @see LoginVo
*/
@Trim
@Operation(summary = "登录")
@PostMapping("/login")
fun login(request: HttpServletRequest, @Valid @RequestBody loginParam: LoginParam): ResponseResult<LoginVo> =

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.group.*
@@ -52,6 +53,7 @@ class GroupController(
* @see PageVo
* @see GroupWithRoleVo
*/
@Trim
@Operation(summary = "获取用户组")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:group:query:all')")
@@ -88,6 +90,7 @@ class GroupController(
* @see ResponseResult
* @see GroupVo
*/
@Trim
@Operation(summary = "添加用户组")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:group:add:one')")
@@ -107,6 +110,7 @@ class GroupController(
* @see ResponseResult
* @see GroupVo
*/
@Trim
@Operation(summary = "修改用户组")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:group:modify:one')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.role.*
@@ -51,6 +52,7 @@ class RoleController(
* @see ResponseResult
* @see RoleWithPowerVo
*/
@Trim
@Operation(summary = "获取角色")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:role:query:all')")
@@ -88,6 +90,7 @@ class RoleController(
* @see ResponseResult
* @see RoleVo
*/
@Trim
@Operation(summary = "添加角色")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:role:add:one')")
@@ -107,6 +110,7 @@ class RoleController(
* @see ResponseResult
* @see RoleVo
*/
@Trim
@Operation(summary = "修改角色")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:role:modify:one')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.user.*
@@ -50,10 +51,11 @@ class UserController(
* @see ResponseResult
* @see UserWithPowerInfoVo
*/
@Trim
@Operation(summary = "获取指定用户基本信息")
@GetMapping("/info/{username}")
fun getBasicInfo(@PathVariable username: String): ResponseResult<UserWithInfoVo> =
ResponseResult.databaseSuccess(data = userService.getBasicInfo(username))
ResponseResult.databaseSuccess(data = userService.getBasicInfo(username.trim()))
/**
* Update current user information
@@ -65,6 +67,7 @@ class UserController(
* @see UserInfoUpdateParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "更新当前用户信息")
@PatchMapping("info")
fun updateInfo(@RequestBody @Valid userInfoUpdateParam: UserInfoUpdateParam): ResponseResult<Nothing> =
@@ -116,6 +119,7 @@ class UserController(
* @see ResponseResult
* @see UserWithRoleInfoVo
*/
@Trim
@Operation(summary = "获取用户")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:user:query:all')")
@@ -135,6 +139,7 @@ class UserController(
* @see ResponseResult
* @see UserWithPasswordRoleInfoVo
*/
@Trim
@Operation(summary = "添加用户")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:user:add:one')")
@@ -154,6 +159,7 @@ class UserController(
* @see ResponseResult
* @see UserWithRoleInfoVo
*/
@Trim
@Operation(summary = "修改用户")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:user:modify:one')")

View File

@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.system.*
@@ -56,6 +57,7 @@ class SettingsController(
* @see BaseSettingsParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "更新基础设置")
@PutMapping("/base")
@PreAuthorize("hasAnyAuthority('system:settings:modify:base')")
@@ -88,6 +90,7 @@ class SettingsController(
* @see MailSettingsParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "更新邮件设置")
@PutMapping("/mail")
@PreAuthorize("hasAnyAuthority('system:settings:modify:mail')")
@@ -106,6 +109,7 @@ class SettingsController(
* @see MailSendParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "邮件发送测试")
@PostMapping("/mail")
@PreAuthorize("hasAnyAuthority('system:settings:modify:mail')")
@@ -139,6 +143,7 @@ class SettingsController(
* @see SensitiveWordAddParam
* @see ResponseResult
*/
@Trim
@Operation(summary = "添加敏感词")
@PostMapping("/sensitive")
@PreAuthorize("hasAnyAuthority('system:settings:modify:sensitive')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.GetMapping
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.system.SysLogGetParam
@@ -34,6 +35,7 @@ class SysLogController(
* @see ResponseResult
* @see SysLogVo
*/
@Trim
@Operation(summary = "获取")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:log:query:all')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
@@ -65,6 +66,7 @@ class BaseController(
* @see ResponseResult
* @see ToolBaseVo
*/
@Trim
@Operation(summary = "新增基板")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:base')")
@@ -85,6 +87,7 @@ class BaseController(
* @see ResponseResult
* @see ToolBaseVo
*/
@Trim
@Operation(summary = "更新基板")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:base')")

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam
@@ -65,6 +66,7 @@ class CategoryController(
* @see ResponseResult
* @see ToolCategoryVo
*/
@Trim
@Operation(summary = "新增类别")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:category')")
@@ -85,6 +87,7 @@ class CategoryController(
* @see ResponseResult
* @see ToolCategoryVo
*/
@Trim
@Operation(summary = "更新类别")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:category')")

View File

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolCreateParam
@@ -79,6 +80,7 @@ class EditController(
* @see ResponseResult
* @see ToolVo
*/
@Trim
@Operation(summary = "创建工具")
@PostMapping
fun create(@RequestBody @Valid toolCreateParam: ToolCreateParam): ResponseResult<ToolVo> =
@@ -95,6 +97,7 @@ class EditController(
* @see ResponseResult
* @see ToolVo
*/
@Trim
@Operation(summary = "升级工具")
@PatchMapping
fun upgrade(@RequestBody @Valid toolUpgradeParam: ToolUpgradeParam): ResponseResult<ToolVo> =
@@ -138,7 +141,7 @@ class EditController(
): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess(
ResponseCode.DATABASE_SELECT_SUCCESS,
data = editService.detail(username, toolId, ver)
data = editService.detail(username.trim(), toolId.trim(), ver.trim())
)
/**
@@ -152,6 +155,7 @@ class EditController(
* @see ResponseResult
* @see ToolVo
*/
@Trim
@Operation(summary = "更新工具")
@PutMapping
fun update(@RequestBody @Valid toolUpdateParam: ToolUpdateParam): ResponseResult<ToolVo> =

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
@@ -52,6 +53,7 @@ class ManagementController(
* @see PageVo
* @see ToolVo
*/
@Trim
@Operation(summary = "获取工具")
@GetMapping
@PreAuthorize("hasAnyAuthority('system:tool:query:tool')")

View File

@@ -1,9 +1,11 @@
package top.fatweb.oxygen.api.controller.tool
import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.PageSortParam
import top.fatweb.oxygen.api.param.tool.ToolStoreGetParam
@@ -34,6 +36,8 @@ class StoreController(
* @see PageVo
* @see ToolVo
*/
@Trim
@Operation(description = "获取商店工具")
@GetMapping
fun get(@Valid toolStoreGetParam: ToolStoreGetParam): ResponseResult<PageVo<ToolVo>> =
ResponseResult.databaseSuccess(data = storeService.getPage(toolStoreGetParam))
@@ -51,7 +55,9 @@ class StoreController(
* @see PageVo
* @see ToolVo
*/
@Trim
@Operation(description = "获取商店指定用户工具")
@GetMapping("/{username}")
fun get(@PathVariable username: String, @Valid pageSortParam: PageSortParam): ResponseResult<PageVo<ToolVo>> =
ResponseResult.databaseSuccess(data = storeService.getPage(pageSortParam, username))
ResponseResult.databaseSuccess(data = storeService.getPage(pageSortParam, username.trim()))
}

View File

@@ -5,6 +5,7 @@ import jakarta.validation.Valid
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.common.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolTemplateAddParam
@@ -65,6 +66,7 @@ class TemplateController(
* @see ResponseResult
* @see ToolTemplateVo
*/
@Trim
@Operation(summary = "添加模板")
@PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:template')")
@@ -85,6 +87,7 @@ class TemplateController(
* @see ResponseResult
* @see ToolTemplateVo
*/
@Trim
@Operation(summary = "更新模板")
@PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:template')")

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/**
* Captcha code parameter
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
open class CaptchaCodeParam {
/**
* Captcha code
@@ -16,6 +18,7 @@ open class CaptchaCodeParam {
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "验证码", required = true)
@field:NotBlank(message = "Captcha code can not be blank")
var captchaCode: String? = null

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.CaptchaCodeParam
/**
@@ -12,6 +13,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
* @since 1.0.0
* @see CaptchaCodeParam
*/
@Trim
@Schema(description = "忘记密码请求参数")
data class ForgetParam(
/**
@@ -20,8 +22,9 @@ data class ForgetParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "邮箱", required = true, example = "user@email.com")
@field:NotBlank(message = "Email can not be blank")
@field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
val email: String?
var email: String?
) : CaptchaCodeParam()

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.permission
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.CaptchaCodeParam
/**
@@ -11,6 +12,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
* @since 1.0.0
* @see CaptchaCodeParam
*/
@Trim
@Schema(description = "登录请求参数")
data class LoginParam(
/**
@@ -19,9 +21,10 @@ data class LoginParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "账户", required = true, example = "test")
@field:NotBlank(message = "Account can not be blank")
val account: String?,
var account: String?,
/**
* Password

View File

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.CaptchaCodeParam
/**
@@ -13,6 +14,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
* @since 1.0.0
* @see CaptchaCodeParam
*/
@Trim
@Schema(description = "注册请求参数")
data class RegisterParam(
/**
@@ -21,10 +23,11 @@ data class RegisterParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户名", required = true, example = "abc")
@field:NotBlank(message = "Username can not be blank")
@field:Pattern(regexp = "[a-zA-Z-_][0-9a-zA-Z-_]{2,38}", message = "Illegal username")
val username: String?,
var username: String?,
/**
* Email
@@ -32,10 +35,11 @@ data class RegisterParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "邮箱", required = true, example = "user@email.com")
@field:NotBlank(message = "Email can not be blank")
@field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
val email: String?,
var email: String?,
/**
* Password

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/**
* Verify email parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.Pattern
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "验证邮箱请求参数")
data class VerifyParam(
/**
@@ -28,9 +30,10 @@ data class VerifyParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "昵称", example = "QwQ")
@field:Pattern(regexp = "^.{3,20}$", message = "Nickname must be 3-20 characters")
val nickname: String?,
var nickname: String?,
/**
* Avatar

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.permission.group
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/**
* Add group parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户组添加请求参数")
data class GroupAddParam(
/**
@@ -17,9 +19,10 @@ data class GroupAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户组名称", required = true, example = "Group_1")
@field:NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Enable

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.permission.group
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam
/**
@@ -10,6 +11,7 @@ import top.fatweb.oxygen.api.param.PageSortParam
* @since 1.0.0
* @see PageSortParam
*/
@Trim
@Schema(description = "用户组查询请求参数")
data class GroupGetParam(
/**
@@ -18,8 +20,9 @@ data class GroupGetParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "查询用户组名称", example = "Group_1")
val searchName: String?,
var searchName: String?,
/**
* Use regex

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission.group
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update group parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户组更新请求参数")
data class GroupUpdateParam(
/**
@@ -28,9 +30,10 @@ data class GroupUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户组名称", required = true, example = "Group_1")
@field:NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Enable

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.permission.role
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/**
* Add role parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "角色添加请求参数")
data class RoleAddParam(
/**
@@ -17,9 +19,10 @@ data class RoleAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "角色名称", required = true, example = "Role_1")
@field:NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Enable

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.permission.role
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam
/**
@@ -10,6 +11,7 @@ import top.fatweb.oxygen.api.param.PageSortParam
* @since 1.0.0
* @see PageSortParam
*/
@Trim
@Schema(description = "角色查询请求参数")
data class RoleGetParam(
/**
@@ -18,8 +20,9 @@ data class RoleGetParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "查询角色名称", example = "Role_1")
val searchName: String?,
var searchName: String?,
/**
* Use regex

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission.role
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update role parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "角色更新请求参数")
data class RoleUpdateParam(
/**
@@ -28,9 +30,10 @@ data class RoleUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "角色名称", required = true, example = "Role_1")
@field:NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Enable

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission.user
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
import java.time.LocalDateTime
/**
@@ -11,6 +12,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "添加用户请求参数")
data class UserAddParam(
/**
@@ -19,9 +21,10 @@ data class UserAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户名", required = true, example = "User_1")
@field:NotBlank(message = "Username can not be blank")
val username: String?,
var username: String?,
/**
* Password
@@ -85,9 +88,10 @@ data class UserAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "昵称", required = true, example = "Nickname_1")
@field:NotBlank(message = "Nickname can not be blank")
val nickname: String?,
var nickname: String?,
/**
* Avatar base63
@@ -104,10 +108,11 @@ data class UserAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "邮箱", required = true, example = "user@email.com")
@NotBlank(message = "Email can not be blank")
@Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
val email: String?,
var email: String?,
/**
* List of role IDs

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.permission.user
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam
/**
@@ -10,6 +11,7 @@ import top.fatweb.oxygen.api.param.PageSortParam
* @since 1.0.0
* @see PageSortParam
*/
@Trim
@Schema(description = "查询用户请求参数")
data class UserGetParam(
/**
@@ -32,8 +34,9 @@ data class UserGetParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "查询内容", example = "User_1")
val searchValue: String?,
var searchValue: String?,
/**
* Use regex

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.permission.user
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Size
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update user information parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.Size
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "更新用户信息请求参数")
data class UserInfoUpdateParam(
/**
@@ -27,8 +29,9 @@ data class UserInfoUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "昵称", example = "QwQ")
@field:NotBlank(message = "Nickname can not be blank")
@field:Size(min = 3, max = 30, message = "Nickname must be 3-20 characters")
val nickname: String?
var nickname: String?
)

View File

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
import java.time.LocalDateTime
/**
@@ -12,6 +13,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "更新用户请求参数")
data class UserUpdateParam(
/**
@@ -30,9 +32,10 @@ data class UserUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户名", required = true, example = "User_1")
@field:NotBlank(message = "Username can not be blank")
val username: String?,
var username: String?,
/**
* Verified
@@ -87,9 +90,10 @@ data class UserUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "昵称", required = true, example = "Nickname_1")
@field:NotBlank(message = "Nickname can not be blank")
val nickname: String?,
var nickname: String?,
/**
* Avatar base64
@@ -106,10 +110,11 @@ data class UserUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "邮箱", required = true, example = "user@email.com")
@NotBlank(message = "Email can not be blank")
@Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
val email: String?,
var email: String?,
/**
* List of role IDs

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
/**
* Base settings parameters
@@ -8,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "基础设置请求参数")
data class BaseSettingsParam(
/**
@@ -16,8 +18,9 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "应用名称")
val appName: String?,
var appName: String?,
/**
* Application URL
@@ -25,8 +28,9 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "应用 URL")
val appUrl: String?,
var appUrl: String?,
/**
* Verify URL
@@ -34,8 +38,9 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "验证邮箱 URL")
val verifyUrl: String?,
var verifyUrl: String?,
/**
* Retrieve URL
@@ -43,6 +48,7 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "找回密码 URL")
val retrieveUrl: String?
var retrieveUrl: String?
)

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/**
* Mail send parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "邮件发送请求参数")
data class MailSendParam(
/**
@@ -17,7 +19,8 @@ data class MailSendParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "接收者", required = true, example = "user@email.com")
@field:NotBlank
val to: String?
var to: String?
)

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.settings.MailSecurityType
/**
@@ -9,6 +10,7 @@ import top.fatweb.oxygen.api.settings.MailSecurityType
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "邮件设置请求参数")
data class MailSettingsParam(
/**
@@ -17,8 +19,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "SMTP 服务器")
val host: String?,
var host: String?,
/**
* Port
@@ -26,8 +29,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "端口号")
val port: Int?,
var port: Int?,
/**
* Security type
@@ -44,8 +48,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "用户名")
val username: String?,
var username: String?,
/**
* Password
@@ -62,8 +67,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "发送者")
val from: String?,
var from: String?,
/**
* Sender name
@@ -71,6 +77,7 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "发送者名称")
val fromName: String?
var fromName: String?
)

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.system.SensitiveWord
/**
@@ -10,6 +11,7 @@ import top.fatweb.oxygen.api.entity.system.SensitiveWord
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(defaultValue = "敏感词添加请求参数")
data class SensitiveWordAddParam(
/**
@@ -18,9 +20,10 @@ data class SensitiveWordAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "", required = true)
@field:NotBlank(message = "Word can not be blank")
val word: String?,
var word: String?,
/**
* Use for

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema
import org.springframework.format.annotation.DateTimeFormat
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam
import java.time.LocalDateTime
@@ -12,6 +13,7 @@ import java.time.LocalDateTime
* @since 1.0.0
* @see PageSortParam
*/
@Trim
@Schema(description = "获取系统日志请求参数")
data class SysLogGetParam(
/**
@@ -46,8 +48,9 @@ data class SysLogGetParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "查询请求 Url")
val searchRequestUrl: String?,
var searchRequestUrl: String?,
/**
* Use regex

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/**
* Add tool base parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
data class ToolBaseAddParam(
/**
* Name
@@ -16,7 +18,8 @@ data class ToolBaseAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank")
val name: String?
var name: String?
)

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update tool base parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
data class ToolBaseUpdateParam(
/**
* ID
@@ -26,8 +28,9 @@ data class ToolBaseUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称")
val name: String?,
var name: String?,
/**
* Source

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/**
* Add tool category parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
data class ToolCategoryAddParam(
/**
* Name
@@ -16,9 +18,10 @@ data class ToolCategoryAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Enable

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update tool category parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
data class ToolCategoryUpdateParam(
/**
* ID
@@ -26,8 +28,9 @@ data class ToolCategoryUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称")
val name: String?,
var name: String?,
/**
* Enable

View File

@@ -5,6 +5,7 @@ import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotEmpty
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/**
* Create tool parameters
@@ -12,6 +13,7 @@ import jakarta.validation.constraints.Pattern
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "创建工具请求参数")
data class ToolCreateParam(
/**
@@ -20,9 +22,10 @@ data class ToolCreateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Tool ID
@@ -30,13 +33,14 @@ data class ToolCreateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@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?,
var toolId: String?,
/**
* Icon

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam
/**
@@ -10,6 +11,7 @@ import top.fatweb.oxygen.api.param.PageSortParam
* @since 1.0.0
* @see PageSortParam
*/
@Trim
data class ToolManagementGetParam(
/**
* Type of search
@@ -31,8 +33,9 @@ data class ToolManagementGetParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "查询内容", example = "ToolName")
val searchValue: String?,
var searchValue: String?,
/**
* Use regex

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam
/**
@@ -10,7 +11,15 @@ import top.fatweb.oxygen.api.param.PageSortParam
* @since 1.0.0
* @see PageSortParam
*/
@Trim
data class ToolStoreGetParam(
/**
* Value to search for
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "查询内容", example = "ToolName")
val searchValue: String?
var searchValue: String?
) : PageSortParam()

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Add tool template parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
data class ToolTemplateAddParam(
/**
* Name
@@ -17,9 +19,10 @@ data class ToolTemplateAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank")
val name: String?,
var name: String?,
/**
* Base ID
@@ -37,9 +40,10 @@ data class ToolTemplateAddParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "入口文件", required = true)
@field:NotBlank(message = "EntryPoint can not be null")
val entryPoint: String? = null,
var entryPoint: String? = null,
/**
* Enable

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update tool template parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
data class ToolTemplateUpdateParam(
/**
* ID
@@ -26,8 +28,9 @@ data class ToolTemplateUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称")
val name: String?,
var name: String?,
/**
* Base ID
@@ -53,8 +56,9 @@ data class ToolTemplateUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "入口文件")
val entryPoint: String?,
var entryPoint: String?,
/**
* Enable

View File

@@ -2,6 +2,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotNull
import top.fatweb.oxygen.api.annotation.Trim
/**
* Update tool parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotNull
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "更新工具请求参数")
data class ToolUpdateParam(
/**
@@ -27,8 +29,9 @@ data class ToolUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "名称")
val name: String?,
var name: String?,
/**
* Icon

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/**
* Upgrade tool parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.Pattern
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@Schema(description = "升级工具请求参数")
data class ToolUpgradeParam(
/**
@@ -18,13 +20,14 @@ data class ToolUpgradeParam(
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Trim
@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?,
var toolId: String?,
/**
* Version

View File

@@ -92,7 +92,7 @@ class AuthenticationServiceImpl(
sendVerifyMail(user.username!!, user.verify!!, registerParam.email!!)
val loginVo = this.login(request, registerParam.username, registerParam.password!!)
val loginVo = this.login(request, registerParam.username!!, registerParam.password!!)
return RegisterVo(token = loginVo.token, userId = loginVo.userId)
}
@@ -135,7 +135,7 @@ class AuthenticationServiceImpl(
if (verifyParam.nickname.isNullOrBlank() || verifyParam.avatar.isNullOrBlank()) {
throw AccountNeedInitException()
}
sensitiveWordService.checkSensitiveWord(verifyParam.nickname)
sensitiveWordService.checkSensitiveWord(verifyParam.nickname!!)
userService.update(
KtUpdateWrapper(User()).eq(User::id, user.id).set(User::verify, null)
@@ -166,7 +166,7 @@ class AuthenticationServiceImpl(
LocalDateTime.now(ZoneOffset.UTC).toInstant(ZoneOffset.UTC).toEpochMilli()
}-${UUID.randomUUID()}-${UUID.randomUUID()}-${UUID.randomUUID()}"
userService.update(KtUpdateWrapper(User()).eq(User::id, user.id).set(User::forget, code))
sendRetrieveMail(user.username!!, request.remoteAddr, code, forgetParam.email)
sendRetrieveMail(user.username!!, request.remoteAddr, code, forgetParam.email!!)
}
@Transactional