Automatically remove spaces on both sides of parameters

This commit is contained in:
2024-02-26 15:33:37 +08:00
parent 1edfeffbf4
commit 3e612af044
46 changed files with 285 additions and 51 deletions

View File

@@ -0,0 +1,8 @@
package top.fatweb.oxygen.api.annotation
import java.lang.annotation.Inherited
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY)
@Retention(AnnotationRetention.RUNTIME)
@Inherited
annotation class Trim

View File

@@ -0,0 +1,65 @@
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
@Component
@Aspect
class TrimInterceptor : HandlerInterceptor {
@Pointcut("@annotation(top.fatweb.oxygen.api.annotation.Trim)")
fun trimPointcut() {
}
@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

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestBody
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.* import top.fatweb.oxygen.api.param.permission.*
@@ -38,6 +39,7 @@ class AuthenticationController(
* @see ResponseResult * @see ResponseResult
* @see RegisterVo * @see RegisterVo
*/ */
@Trim
@Operation(summary = "注册") @Operation(summary = "注册")
@PostMapping("/register") @PostMapping("/register")
fun register( fun register(
@@ -75,6 +77,7 @@ class AuthenticationController(
* @see VerifyParam * @see VerifyParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "验证邮箱") @Operation(summary = "验证邮箱")
@PostMapping("/verify") @PostMapping("/verify")
fun verify(@Valid @RequestBody verifyParam: VerifyParam): ResponseResult<Nothing> { fun verify(@Valid @RequestBody verifyParam: VerifyParam): ResponseResult<Nothing> {
@@ -95,6 +98,7 @@ class AuthenticationController(
* @see ForgetParam * @see ForgetParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "忘记密码") @Operation(summary = "忘记密码")
@PostMapping("/forget") @PostMapping("/forget")
fun forget(request: HttpServletRequest, @Valid @RequestBody forgetParam: ForgetParam): ResponseResult<Nothing> { fun forget(request: HttpServletRequest, @Valid @RequestBody forgetParam: ForgetParam): ResponseResult<Nothing> {
@@ -139,6 +143,7 @@ class AuthenticationController(
* @see ResponseResult * @see ResponseResult
* @see LoginVo * @see LoginVo
*/ */
@Trim
@Operation(summary = "登录") @Operation(summary = "登录")
@PostMapping("/login") @PostMapping("/login")
fun login(request: HttpServletRequest, @Valid @RequestBody loginParam: LoginParam): ResponseResult<LoginVo> = 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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.group.* import top.fatweb.oxygen.api.param.permission.group.*
@@ -52,6 +53,7 @@ class GroupController(
* @see PageVo * @see PageVo
* @see GroupWithRoleVo * @see GroupWithRoleVo
*/ */
@Trim
@Operation(summary = "获取用户组") @Operation(summary = "获取用户组")
@GetMapping @GetMapping
@PreAuthorize("hasAnyAuthority('system:group:query:all')") @PreAuthorize("hasAnyAuthority('system:group:query:all')")
@@ -88,6 +90,7 @@ class GroupController(
* @see ResponseResult * @see ResponseResult
* @see GroupVo * @see GroupVo
*/ */
@Trim
@Operation(summary = "添加用户组") @Operation(summary = "添加用户组")
@PostMapping @PostMapping
@PreAuthorize("hasAnyAuthority('system:group:add:one')") @PreAuthorize("hasAnyAuthority('system:group:add:one')")
@@ -107,6 +110,7 @@ class GroupController(
* @see ResponseResult * @see ResponseResult
* @see GroupVo * @see GroupVo
*/ */
@Trim
@Operation(summary = "修改用户组") @Operation(summary = "修改用户组")
@PutMapping @PutMapping
@PreAuthorize("hasAnyAuthority('system:group:modify:one')") @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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.role.* import top.fatweb.oxygen.api.param.permission.role.*
@@ -51,6 +52,7 @@ class RoleController(
* @see ResponseResult * @see ResponseResult
* @see RoleWithPowerVo * @see RoleWithPowerVo
*/ */
@Trim
@Operation(summary = "获取角色") @Operation(summary = "获取角色")
@GetMapping @GetMapping
@PreAuthorize("hasAnyAuthority('system:role:query:all')") @PreAuthorize("hasAnyAuthority('system:role:query:all')")
@@ -88,6 +90,7 @@ class RoleController(
* @see ResponseResult * @see ResponseResult
* @see RoleVo * @see RoleVo
*/ */
@Trim
@Operation(summary = "添加角色") @Operation(summary = "添加角色")
@PostMapping @PostMapping
@PreAuthorize("hasAnyAuthority('system:role:add:one')") @PreAuthorize("hasAnyAuthority('system:role:add:one')")
@@ -107,6 +110,7 @@ class RoleController(
* @see ResponseResult * @see ResponseResult
* @see RoleVo * @see RoleVo
*/ */
@Trim
@Operation(summary = "修改角色") @Operation(summary = "修改角色")
@PutMapping @PutMapping
@PreAuthorize("hasAnyAuthority('system:role:modify:one')") @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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.permission.user.* import top.fatweb.oxygen.api.param.permission.user.*
@@ -50,10 +51,11 @@ class UserController(
* @see ResponseResult * @see ResponseResult
* @see UserWithPowerInfoVo * @see UserWithPowerInfoVo
*/ */
@Trim
@Operation(summary = "获取指定用户基本信息") @Operation(summary = "获取指定用户基本信息")
@GetMapping("/info/{username}") @GetMapping("/info/{username}")
fun getBasicInfo(@PathVariable username: String): ResponseResult<UserWithInfoVo> = fun getBasicInfo(@PathVariable username: String): ResponseResult<UserWithInfoVo> =
ResponseResult.databaseSuccess(data = userService.getBasicInfo(username)) ResponseResult.databaseSuccess(data = userService.getBasicInfo(username.trim()))
/** /**
* Update current user information * Update current user information
@@ -65,6 +67,7 @@ class UserController(
* @see UserInfoUpdateParam * @see UserInfoUpdateParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "更新当前用户信息") @Operation(summary = "更新当前用户信息")
@PatchMapping("info") @PatchMapping("info")
fun updateInfo(@RequestBody @Valid userInfoUpdateParam: UserInfoUpdateParam): ResponseResult<Nothing> = fun updateInfo(@RequestBody @Valid userInfoUpdateParam: UserInfoUpdateParam): ResponseResult<Nothing> =
@@ -116,6 +119,7 @@ class UserController(
* @see ResponseResult * @see ResponseResult
* @see UserWithRoleInfoVo * @see UserWithRoleInfoVo
*/ */
@Trim
@Operation(summary = "获取用户") @Operation(summary = "获取用户")
@GetMapping @GetMapping
@PreAuthorize("hasAnyAuthority('system:user:query:all')") @PreAuthorize("hasAnyAuthority('system:user:query:all')")
@@ -135,6 +139,7 @@ class UserController(
* @see ResponseResult * @see ResponseResult
* @see UserWithPasswordRoleInfoVo * @see UserWithPasswordRoleInfoVo
*/ */
@Trim
@Operation(summary = "添加用户") @Operation(summary = "添加用户")
@PostMapping @PostMapping
@PreAuthorize("hasAnyAuthority('system:user:add:one')") @PreAuthorize("hasAnyAuthority('system:user:add:one')")
@@ -154,6 +159,7 @@ class UserController(
* @see ResponseResult * @see ResponseResult
* @see UserWithRoleInfoVo * @see UserWithRoleInfoVo
*/ */
@Trim
@Operation(summary = "修改用户") @Operation(summary = "修改用户")
@PutMapping @PutMapping
@PreAuthorize("hasAnyAuthority('system:user:modify:one')") @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.PutMapping
import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestBody
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.system.* import top.fatweb.oxygen.api.param.system.*
@@ -56,6 +57,7 @@ class SettingsController(
* @see BaseSettingsParam * @see BaseSettingsParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "更新基础设置") @Operation(summary = "更新基础设置")
@PutMapping("/base") @PutMapping("/base")
@PreAuthorize("hasAnyAuthority('system:settings:modify:base')") @PreAuthorize("hasAnyAuthority('system:settings:modify:base')")
@@ -88,6 +90,7 @@ class SettingsController(
* @see MailSettingsParam * @see MailSettingsParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "更新邮件设置") @Operation(summary = "更新邮件设置")
@PutMapping("/mail") @PutMapping("/mail")
@PreAuthorize("hasAnyAuthority('system:settings:modify:mail')") @PreAuthorize("hasAnyAuthority('system:settings:modify:mail')")
@@ -106,6 +109,7 @@ class SettingsController(
* @see MailSendParam * @see MailSendParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "邮件发送测试") @Operation(summary = "邮件发送测试")
@PostMapping("/mail") @PostMapping("/mail")
@PreAuthorize("hasAnyAuthority('system:settings:modify:mail')") @PreAuthorize("hasAnyAuthority('system:settings:modify:mail')")
@@ -139,6 +143,7 @@ class SettingsController(
* @see SensitiveWordAddParam * @see SensitiveWordAddParam
* @see ResponseResult * @see ResponseResult
*/ */
@Trim
@Operation(summary = "添加敏感词") @Operation(summary = "添加敏感词")
@PostMapping("/sensitive") @PostMapping("/sensitive")
@PreAuthorize("hasAnyAuthority('system:settings:modify: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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.GetMapping
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.system.SysLogGetParam import top.fatweb.oxygen.api.param.system.SysLogGetParam
@@ -34,6 +35,7 @@ class SysLogController(
* @see ResponseResult * @see ResponseResult
* @see SysLogVo * @see SysLogVo
*/ */
@Trim
@Operation(summary = "获取") @Operation(summary = "获取")
@GetMapping @GetMapping
@PreAuthorize("hasAnyAuthority('system:log:query:all')") @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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam import top.fatweb.oxygen.api.param.tool.ToolBaseAddParam
@@ -65,6 +66,7 @@ class BaseController(
* @see ResponseResult * @see ResponseResult
* @see ToolBaseVo * @see ToolBaseVo
*/ */
@Trim
@Operation(summary = "新增基板") @Operation(summary = "新增基板")
@PostMapping @PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:base')") @PreAuthorize("hasAnyAuthority('system:tool:add:base')")
@@ -85,6 +87,7 @@ class BaseController(
* @see ResponseResult * @see ResponseResult
* @see ToolBaseVo * @see ToolBaseVo
*/ */
@Trim
@Operation(summary = "更新基板") @Operation(summary = "更新基板")
@PutMapping @PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:base')") @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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam import top.fatweb.oxygen.api.param.tool.ToolCategoryAddParam
@@ -65,6 +66,7 @@ class CategoryController(
* @see ResponseResult * @see ResponseResult
* @see ToolCategoryVo * @see ToolCategoryVo
*/ */
@Trim
@Operation(summary = "新增类别") @Operation(summary = "新增类别")
@PostMapping @PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:category')") @PreAuthorize("hasAnyAuthority('system:tool:add:category')")
@@ -85,6 +87,7 @@ class CategoryController(
* @see ResponseResult * @see ResponseResult
* @see ToolCategoryVo * @see ToolCategoryVo
*/ */
@Trim
@Operation(summary = "更新类别") @Operation(summary = "更新类别")
@PutMapping @PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:category')") @PreAuthorize("hasAnyAuthority('system:tool:modify:category')")

View File

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid import jakarta.validation.Valid
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolCreateParam import top.fatweb.oxygen.api.param.tool.ToolCreateParam
@@ -79,6 +80,7 @@ class EditController(
* @see ResponseResult * @see ResponseResult
* @see ToolVo * @see ToolVo
*/ */
@Trim
@Operation(summary = "创建工具") @Operation(summary = "创建工具")
@PostMapping @PostMapping
fun create(@RequestBody @Valid toolCreateParam: ToolCreateParam): ResponseResult<ToolVo> = fun create(@RequestBody @Valid toolCreateParam: ToolCreateParam): ResponseResult<ToolVo> =
@@ -95,6 +97,7 @@ class EditController(
* @see ResponseResult * @see ResponseResult
* @see ToolVo * @see ToolVo
*/ */
@Trim
@Operation(summary = "升级工具") @Operation(summary = "升级工具")
@PatchMapping @PatchMapping
fun upgrade(@RequestBody @Valid toolUpgradeParam: ToolUpgradeParam): ResponseResult<ToolVo> = fun upgrade(@RequestBody @Valid toolUpgradeParam: ToolUpgradeParam): ResponseResult<ToolVo> =
@@ -138,7 +141,7 @@ class EditController(
): ResponseResult<ToolVo> = ): ResponseResult<ToolVo> =
ResponseResult.databaseSuccess( ResponseResult.databaseSuccess(
ResponseCode.DATABASE_SELECT_SUCCESS, 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 ResponseResult
* @see ToolVo * @see ToolVo
*/ */
@Trim
@Operation(summary = "更新工具") @Operation(summary = "更新工具")
@PutMapping @PutMapping
fun update(@RequestBody @Valid toolUpdateParam: ToolUpdateParam): ResponseResult<ToolVo> = 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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam import top.fatweb.oxygen.api.param.tool.ToolManagementGetParam
@@ -52,6 +53,7 @@ class ManagementController(
* @see PageVo * @see PageVo
* @see ToolVo * @see ToolVo
*/ */
@Trim
@Operation(summary = "获取工具") @Operation(summary = "获取工具")
@GetMapping @GetMapping
@PreAuthorize("hasAnyAuthority('system:tool:query:tool')") @PreAuthorize("hasAnyAuthority('system:tool:query:tool')")

View File

@@ -1,9 +1,11 @@
package top.fatweb.oxygen.api.controller.tool package top.fatweb.oxygen.api.controller.tool
import io.swagger.v3.oas.annotations.Operation
import jakarta.validation.Valid import jakarta.validation.Valid
import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.PathVariable
import top.fatweb.oxygen.api.annotation.BaseController 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.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.PageSortParam import top.fatweb.oxygen.api.param.PageSortParam
import top.fatweb.oxygen.api.param.tool.ToolStoreGetParam import top.fatweb.oxygen.api.param.tool.ToolStoreGetParam
@@ -34,6 +36,8 @@ class StoreController(
* @see PageVo * @see PageVo
* @see ToolVo * @see ToolVo
*/ */
@Trim
@Operation(description = "获取商店工具")
@GetMapping @GetMapping
fun get(@Valid toolStoreGetParam: ToolStoreGetParam): ResponseResult<PageVo<ToolVo>> = fun get(@Valid toolStoreGetParam: ToolStoreGetParam): ResponseResult<PageVo<ToolVo>> =
ResponseResult.databaseSuccess(data = storeService.getPage(toolStoreGetParam)) ResponseResult.databaseSuccess(data = storeService.getPage(toolStoreGetParam))
@@ -51,7 +55,9 @@ class StoreController(
* @see PageVo * @see PageVo
* @see ToolVo * @see ToolVo
*/ */
@Trim
@Operation(description = "获取商店指定用户工具")
@GetMapping("/{username}") @GetMapping("/{username}")
fun get(@PathVariable username: String, @Valid pageSortParam: PageSortParam): ResponseResult<PageVo<ToolVo>> = 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.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.* import org.springframework.web.bind.annotation.*
import top.fatweb.oxygen.api.annotation.BaseController 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.ResponseCode
import top.fatweb.oxygen.api.entity.common.ResponseResult import top.fatweb.oxygen.api.entity.common.ResponseResult
import top.fatweb.oxygen.api.param.tool.ToolTemplateAddParam import top.fatweb.oxygen.api.param.tool.ToolTemplateAddParam
@@ -65,6 +66,7 @@ class TemplateController(
* @see ResponseResult * @see ResponseResult
* @see ToolTemplateVo * @see ToolTemplateVo
*/ */
@Trim
@Operation(summary = "添加模板") @Operation(summary = "添加模板")
@PostMapping @PostMapping
@PreAuthorize("hasAnyAuthority('system:tool:add:template')") @PreAuthorize("hasAnyAuthority('system:tool:add:template')")
@@ -85,6 +87,7 @@ class TemplateController(
* @see ResponseResult * @see ResponseResult
* @see ToolTemplateVo * @see ToolTemplateVo
*/ */
@Trim
@Operation(summary = "更新模板") @Operation(summary = "更新模板")
@PutMapping @PutMapping
@PreAuthorize("hasAnyAuthority('system:tool:modify:template')") @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 io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/** /**
* Captcha code parameter * Captcha code parameter
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
open class CaptchaCodeParam { open class CaptchaCodeParam {
/** /**
* Captcha code * Captcha code
@@ -16,6 +18,7 @@ open class CaptchaCodeParam {
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "验证码", required = true) @Schema(description = "验证码", required = true)
@field:NotBlank(message = "Captcha code can not be blank") @field:NotBlank(message = "Captcha code can not be blank")
var captchaCode: String? = null 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 io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.CaptchaCodeParam import top.fatweb.oxygen.api.param.CaptchaCodeParam
/** /**
@@ -12,6 +13,7 @@ import top.fatweb.oxygen.api.param.CaptchaCodeParam
* @since 1.0.0 * @since 1.0.0
* @see CaptchaCodeParam * @see CaptchaCodeParam
*/ */
@Trim
@Schema(description = "忘记密码请求参数") @Schema(description = "忘记密码请求参数")
data class ForgetParam( data class ForgetParam(
/** /**
@@ -20,8 +22,9 @@ data class ForgetParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "邮箱", required = true, example = "user@email.com") @Schema(description = "邮箱", required = true, example = "user@email.com")
@field:NotBlank(message = "Email can not be blank") @field:NotBlank(message = "Email can not be blank")
@field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address") @field:Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
val email: String? var email: String?
) : CaptchaCodeParam() ) : CaptchaCodeParam()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.permission.user package top.fatweb.oxygen.api.param.permission.user
import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.param.PageSortParam import top.fatweb.oxygen.api.param.PageSortParam
/** /**
@@ -10,6 +11,7 @@ import top.fatweb.oxygen.api.param.PageSortParam
* @since 1.0.0 * @since 1.0.0
* @see PageSortParam * @see PageSortParam
*/ */
@Trim
@Schema(description = "查询用户请求参数") @Schema(description = "查询用户请求参数")
data class UserGetParam( data class UserGetParam(
/** /**
@@ -32,8 +34,9 @@ data class UserGetParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "查询内容", example = "User_1") @Schema(description = "查询内容", example = "User_1")
val searchValue: String?, var searchValue: String?,
/** /**
* Use regex * 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 io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Size import jakarta.validation.constraints.Size
import top.fatweb.oxygen.api.annotation.Trim
/** /**
* Update user information parameters * Update user information parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.Size
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "更新用户信息请求参数") @Schema(description = "更新用户信息请求参数")
data class UserInfoUpdateParam( data class UserInfoUpdateParam(
/** /**
@@ -27,8 +29,9 @@ data class UserInfoUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "昵称", example = "QwQ") @Schema(description = "昵称", example = "QwQ")
@field:NotBlank(message = "Nickname can not be blank") @field:NotBlank(message = "Nickname can not be blank")
@field:Size(min = 3, max = 30, message = "Nickname must be 3-20 characters") @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.NotBlank
import jakarta.validation.constraints.NotNull import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
import java.time.LocalDateTime import java.time.LocalDateTime
/** /**
@@ -12,6 +13,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "更新用户请求参数") @Schema(description = "更新用户请求参数")
data class UserUpdateParam( data class UserUpdateParam(
/** /**
@@ -30,9 +32,10 @@ data class UserUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "用户名", required = true, example = "User_1") @Schema(description = "用户名", required = true, example = "User_1")
@field:NotBlank(message = "Username can not be blank") @field:NotBlank(message = "Username can not be blank")
val username: String?, var username: String?,
/** /**
* Verified * Verified
@@ -87,9 +90,10 @@ data class UserUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "昵称", required = true, example = "Nickname_1") @Schema(description = "昵称", required = true, example = "Nickname_1")
@field:NotBlank(message = "Nickname can not be blank") @field:NotBlank(message = "Nickname can not be blank")
val nickname: String?, var nickname: String?,
/** /**
* Avatar base64 * Avatar base64
@@ -106,10 +110,11 @@ data class UserUpdateParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "邮箱", required = true, example = "user@email.com") @Schema(description = "邮箱", required = true, example = "user@email.com")
@NotBlank(message = "Email can not be blank") @NotBlank(message = "Email can not be blank")
@Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address") @Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$", message = "Illegal email address")
val email: String?, var email: String?,
/** /**
* List of role IDs * List of role IDs

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.system package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
/** /**
* Base settings parameters * Base settings parameters
@@ -8,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "基础设置请求参数") @Schema(description = "基础设置请求参数")
data class BaseSettingsParam( data class BaseSettingsParam(
/** /**
@@ -16,8 +18,9 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "应用名称") @Schema(description = "应用名称")
val appName: String?, var appName: String?,
/** /**
* Application URL * Application URL
@@ -25,8 +28,9 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "应用 URL") @Schema(description = "应用 URL")
val appUrl: String?, var appUrl: String?,
/** /**
* Verify URL * Verify URL
@@ -34,8 +38,9 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "验证邮箱 URL") @Schema(description = "验证邮箱 URL")
val verifyUrl: String?, var verifyUrl: String?,
/** /**
* Retrieve URL * Retrieve URL
@@ -43,6 +48,7 @@ data class BaseSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "找回密码 URL") @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 io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
/** /**
* Mail send parameters * Mail send parameters
@@ -9,6 +10,7 @@ import jakarta.validation.constraints.NotBlank
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "邮件发送请求参数") @Schema(description = "邮件发送请求参数")
data class MailSendParam( data class MailSendParam(
/** /**
@@ -17,7 +19,8 @@ data class MailSendParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "接收者", required = true, example = "user@email.com") @Schema(description = "接收者", required = true, example = "user@email.com")
@field:NotBlank @field:NotBlank
val to: String? var to: String?
) )

View File

@@ -1,6 +1,7 @@
package top.fatweb.oxygen.api.param.system package top.fatweb.oxygen.api.param.system
import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.media.Schema
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.settings.MailSecurityType import top.fatweb.oxygen.api.settings.MailSecurityType
/** /**
@@ -9,6 +10,7 @@ import top.fatweb.oxygen.api.settings.MailSecurityType
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "邮件设置请求参数") @Schema(description = "邮件设置请求参数")
data class MailSettingsParam( data class MailSettingsParam(
/** /**
@@ -17,8 +19,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "SMTP 服务器") @Schema(description = "SMTP 服务器")
val host: String?, var host: String?,
/** /**
* Port * Port
@@ -26,8 +29,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "端口号") @Schema(description = "端口号")
val port: Int?, var port: Int?,
/** /**
* Security type * Security type
@@ -44,8 +48,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "用户名") @Schema(description = "用户名")
val username: String?, var username: String?,
/** /**
* Password * Password
@@ -62,8 +67,9 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "发送者") @Schema(description = "发送者")
val from: String?, var from: String?,
/** /**
* Sender name * Sender name
@@ -71,6 +77,7 @@ data class MailSettingsParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "发送者名称") @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 io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank
import top.fatweb.oxygen.api.annotation.Trim
import top.fatweb.oxygen.api.entity.system.SensitiveWord 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 * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(defaultValue = "敏感词添加请求参数") @Schema(defaultValue = "敏感词添加请求参数")
data class SensitiveWordAddParam( data class SensitiveWordAddParam(
/** /**
@@ -18,9 +20,10 @@ data class SensitiveWordAddParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "", required = true) @Schema(description = "", required = true)
@field:NotBlank(message = "Word can not be blank") @field:NotBlank(message = "Word can not be blank")
val word: String?, var word: String?,
/** /**
* Use for * Use for

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,6 +5,7 @@ import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotEmpty import jakarta.validation.constraints.NotEmpty
import jakarta.validation.constraints.NotNull import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/** /**
* Create tool parameters * Create tool parameters
@@ -12,6 +13,7 @@ import jakarta.validation.constraints.Pattern
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "创建工具请求参数") @Schema(description = "创建工具请求参数")
data class ToolCreateParam( data class ToolCreateParam(
/** /**
@@ -20,9 +22,10 @@ data class ToolCreateParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "名称", required = true) @Schema(description = "名称", required = true)
@field: NotBlank(message = "Name can not be blank") @field: NotBlank(message = "Name can not be blank")
val name: String?, var name: String?,
/** /**
* Tool ID * Tool ID
@@ -30,13 +33,14 @@ data class ToolCreateParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "工具唯一 ID", required = true, example = "tool_a") @Schema(description = "工具唯一 ID", required = true, example = "tool_a")
@field: NotBlank(message = "ToolId can not be blank") @field: NotBlank(message = "ToolId can not be blank")
@field: Pattern( @field: Pattern(
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$", regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
message = "Ver can only match '^[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 * Icon

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,6 +3,7 @@ package top.fatweb.oxygen.api.param.tool
import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern import jakarta.validation.constraints.Pattern
import top.fatweb.oxygen.api.annotation.Trim
/** /**
* Upgrade tool parameters * Upgrade tool parameters
@@ -10,6 +11,7 @@ import jakarta.validation.constraints.Pattern
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "升级工具请求参数") @Schema(description = "升级工具请求参数")
data class ToolUpgradeParam( data class ToolUpgradeParam(
/** /**
@@ -18,13 +20,14 @@ data class ToolUpgradeParam(
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@Trim
@Schema(description = "工具唯一 ID", required = true, example = "tool_a") @Schema(description = "工具唯一 ID", required = true, example = "tool_a")
@field: NotBlank(message = "ToolId can not be blank") @field: NotBlank(message = "ToolId can not be blank")
@field: Pattern( @field: Pattern(
regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$", regexp = "^[a-zA-Z-_][0-9a-zA-Z-_]{2,19}\$",
message = "Ver can only match '^[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 * Version

View File

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