Add icon and publish time to tool

This commit is contained in:
2024-01-26 17:31:26 +08:00
parent a66c5caa60
commit 3dc935a98a
7 changed files with 121 additions and 63 deletions

View File

@@ -25,6 +25,7 @@ object ToolConverter {
id = tool.id, id = tool.id,
name = tool.name, name = tool.name,
toolId = tool.toolId, toolId = tool.toolId,
icon = tool.icon,
description = tool.description, description = tool.description,
baseId = tool.baseId, baseId = tool.baseId,
author = tool.author?.let(UserConverter::userToUserWithInfoVo), author = tool.author?.let(UserConverter::userToUserWithInfoVo),
@@ -37,6 +38,7 @@ object ToolConverter {
entryPoint = tool.entryPoint, entryPoint = tool.entryPoint,
publish = tool.publish == 1, publish = tool.publish == 1,
review = tool.review, review = tool.review,
publishTime = tool.publishTime,
createTime = tool.createTime, createTime = tool.createTime,
updateTime = tool.updateTime updateTime = tool.updateTime
) )

View File

@@ -51,6 +51,15 @@ class Tool {
@TableField("tool_id") @TableField("tool_id")
var toolId: String? = null var toolId: String? = null
/**
* Icon
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@TableField("icon")
var icon: String? = null
/** /**
* Description * Description
* *
@@ -146,10 +155,21 @@ class Tool {
* *
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
* @see ReviewType
*/ */
@TableField("review") @TableField("review")
var review: ReviewType? = null var review: ReviewType? = null
/**
* Publish time
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see LocalDateTime
*/
@TableField("publish_time")
var publishTime: LocalDateTime? = null
/** /**
* Create time * Create time
* *
@@ -236,6 +256,6 @@ class Tool {
var dist: ToolData? = null var dist: ToolData? = null
override fun toString(): String { override fun toString(): String {
return "Tool(id=$id, name=$name, toolId=$toolId, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, privately=$privately, keywords=$keywords, sourceId=$sourceId, distId=$distId, entryPoint=$entryPoint, publish=$publish, review=$review, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, categories=$categories, source=$source, dist=$dist)" return "Tool(id=$id, name=$name, toolId=$toolId, icon=$icon, description=$description, baseId=$baseId, authorId=$authorId, ver=$ver, privately=$privately, keywords=$keywords, sourceId=$sourceId, distId=$distId, entryPoint=$entryPoint, publish=$publish, review=$review, publishTime=$publishTime, createTime=$createTime, updateTime=$updateTime, deleted=$deleted, version=$version, author=$author, base=$base, categories=$categories, source=$source, dist=$dist)"
} }
} }

View File

@@ -38,6 +38,16 @@ data class ToolCreateParam(
) )
val toolId: String?, val toolId: String?,
/**
* Icon
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "图标", required = true)
@field: NotBlank(message = "Icon can not be blank")
val icon: String?,
/** /**
* Description * Description
* *

View File

@@ -62,6 +62,7 @@ class EditServiceImpl(
val tool = Tool().apply { val tool = Tool().apply {
name = toolCreateParam.name!!.trim() name = toolCreateParam.name!!.trim()
toolId = toolCreateParam.toolId toolId = toolCreateParam.toolId
icon = toolCreateParam.icon
description = toolCreateParam.description description = toolCreateParam.description
baseId = template.base!!.id baseId = template.base!!.id
authorId = WebUtil.getLoginUserId() ?: throw UserNotFoundException() authorId = WebUtil.getLoginUserId() ?: throw UserNotFoundException()

View File

@@ -41,6 +41,15 @@ data class ToolVo(
@Schema(description = "工具 ID") @Schema(description = "工具 ID")
val toolId: String?, val toolId: String?,
/**
* Icon
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
*/
@Schema(description = "图标")
val icon: String?,
/** /**
* Description * Description
* *
@@ -155,6 +164,16 @@ data class ToolVo(
@Schema(description = "审核") @Schema(description = "审核")
val review: Tool.ReviewType?, val review: Tool.ReviewType?,
/**
* Publish time
*
* @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0
* @see LocalDateTime
*/
@Schema(description = "发布时间", example = "1900-01-01T00:00:00.000Z")
val publishTime: LocalDateTime?,
/** /**
* Create time * Create time
* *

View File

@@ -5,6 +5,7 @@ create table if not exists t_b_tool_main
id bigint not null primary key, id bigint not null primary key,
name varchar(50) not null comment '工具名', name varchar(50) not null comment '工具名',
tool_id varchar(50) not null comment '工具 ID', tool_id varchar(50) not null comment '工具 ID',
icon text not null comment '图标',
description varchar(500) null comment '简介', description varchar(500) null comment '简介',
base_id bigint not null comment '基板 ID', base_id bigint not null comment '基板 ID',
author_id bigint not null comment '作者 ID', author_id bigint not null comment '作者 ID',
@@ -16,6 +17,7 @@ create table if not exists t_b_tool_main
entry_point varchar(64) not null default 'main.tsx' comment '入口文件', entry_point varchar(64) not null default 'main.tsx' comment '入口文件',
publish int not null default 0 comment '发布', publish int not null default 0 comment '发布',
review varchar(10) not null default 'NONE' comment '审核', review varchar(10) not null default 'NONE' comment '审核',
publish_time datetime null comment '发布时间',
create_time datetime not null default (utc_timestamp()) comment '创建时间', create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间', update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0, deleted bigint not null default 0,

View File

@@ -34,6 +34,7 @@
select t_b_tool_main.id as tool_id, select t_b_tool_main.id as tool_id,
t_b_tool_main.name as tool_name, t_b_tool_main.name as tool_name,
t_b_tool_main.tool_id as tool_tool_id, t_b_tool_main.tool_id as tool_tool_id,
t_b_tool_main.icon as tool_icon,
t_b_tool_main.description as tool_description, t_b_tool_main.description as tool_description,
t_b_tool_main.base_id as tool_base_id, t_b_tool_main.base_id as tool_base_id,
t_b_tool_main.author_id as tool_author_id, t_b_tool_main.author_id as tool_author_id,
@@ -45,6 +46,7 @@
t_b_tool_main.entry_point as tool_entry_point, t_b_tool_main.entry_point as tool_entry_point,
t_b_tool_main.publish as tool_publish, t_b_tool_main.publish as tool_publish,
t_b_tool_main.review as tool_review, t_b_tool_main.review as tool_review,
t_b_tool_main.publish_time as tool_publish_time,
t_b_tool_main.create_time as tool_create_time, t_b_tool_main.create_time as tool_create_time,
t_b_tool_main.update_time as tool_update_time, t_b_tool_main.update_time as tool_update_time,
t_b_tool_main.deleted as tool_deleted, t_b_tool_main.deleted as tool_deleted,
@@ -104,6 +106,7 @@
<id property="id" column="tool_id"/> <id property="id" column="tool_id"/>
<result property="name" column="tool_name"/> <result property="name" column="tool_name"/>
<result property="toolId" column="tool_tool_id"/> <result property="toolId" column="tool_tool_id"/>
<result property="icon" column="tool_icon"/>
<result property="description" column="tool_description"/> <result property="description" column="tool_description"/>
<result property="baseId" column="tool_base_id"/> <result property="baseId" column="tool_base_id"/>
<result property="authorId" column="tool_author_id"/> <result property="authorId" column="tool_author_id"/>
@@ -114,6 +117,7 @@
<result property="entryPoint" column="tool_entry_point"/> <result property="entryPoint" column="tool_entry_point"/>
<result property="publish" column="tool_publish"/> <result property="publish" column="tool_publish"/>
<result property="review" column="tool_review"/> <result property="review" column="tool_review"/>
<result property="publishTime" column="tool_publish_time"/>
<result property="updateTime" column="tool_update_time"/> <result property="updateTime" column="tool_update_time"/>
<result property="createTime" column="tool_create_time"/> <result property="createTime" column="tool_create_time"/>
<result property="deleted" column="tool_deleted"/> <result property="deleted" column="tool_deleted"/>