Optimize tools api

This commit is contained in:
2024-02-18 17:39:12 +08:00
parent c5dcb432ef
commit 0baccbd0e5
4 changed files with 21 additions and 13 deletions

View File

@@ -79,7 +79,7 @@ class SecurityConfig(
"/forget",
"/retrieve"
).anonymous()
.requestMatchers("/tool/detail/**").permitAll()
.requestMatchers("/tool/detail/**", "/tool/store").permitAll()
// Authentication required
.anyRequest().authenticated()
}

View File

@@ -223,7 +223,7 @@ class EditServiceImpl(
if (tool.review == Tool.ReviewType.PROCESSING) {
throw ToolUnderReviewException()
}
if (tool.review == Tool.ReviewType.PASS || tool.publish != 0L) {
if (tool.review == Tool.ReviewType.PASS && tool.publish != 0L) {
throw ToolHasBeenPublishedException()
}
@@ -232,7 +232,7 @@ class EditServiceImpl(
override fun cancel(id: Long): Boolean {
val tool = getById(id)
if (tool.review == Tool.ReviewType.PASS || tool.publish != 0L) {
if (tool.review == Tool.ReviewType.PASS && tool.publish != 0L) {
throw ToolHasBeenPublishedException()
}
if (tool.review != Tool.ReviewType.PROCESSING) {

View File

@@ -111,7 +111,6 @@ class ManagementServiceImpl(
KtUpdateWrapper(Tool())
.eq(Tool::id, id)
.set(Tool::review, Tool.ReviewType.REJECT)
.set(Tool::publish, 0)
)
return this.getOne(id)