完善注释

pull/137/head
ruibaby 2019-03-28 14:39:36 +08:00
parent 68b78b9267
commit 5846d5abb9
27 changed files with 102 additions and 93 deletions

View File

@ -6,9 +6,8 @@
<artifactId>halo</artifactId>
<version>latest</version>
<name>halo</name>
<!-- 虽然Halo使用了宽松的GPL协议但开发不易希望您可以保留一下版权声明。笔芯~ -->
<description>
Halo,一个基于 SpringBoot 的博客系统,最求轻快,易用,以内容为中心。
Halo,Personal blog system developed using Java.
</description>
<organization>

View File

@ -13,9 +13,7 @@ import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
/**
* <pre>
* FreeMarker
* </pre>
* FreeMarker configuration.
*
* @author : RYAN0UP
* @date : 2018/4/26
@ -61,7 +59,7 @@ public class FreeMarkerAutoConfiguration {
public void setSharedVariable() {
try {
configuration.setSharedVariable("options", optionsService.listOptions());
//自定义标签
//Freemarker custom tags
configuration.setSharedVariable("categoryTag", categoryTagDirective);
configuration.setSharedVariable("commentTag", commentTagDirective);
configuration.setSharedVariable("linkTag", linkTagDirective);

View File

@ -9,8 +9,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.lang.NonNull;
@ -23,7 +21,6 @@ import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.spring.web.plugins.JacksonSerializerConvention;
import springfox.documentation.swagger.web.SecurityConfiguration;
import springfox.documentation.swagger.web.SecurityConfigurationBuilder;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@ -137,7 +134,7 @@ public class SwaggerConfiguration {
.title("Halo API Documentation")
.description("Documentation for Halo API")
.version(HALO_VERSION)
.termsOfServiceUrl("https://ryanc.cc/")
.termsOfServiceUrl("https://github.com/halo-dev")
.contact(new Contact("RYAN0UP", "https://ryanc.cc/", "i#ryanc.cc"))
.build();
}

View File

@ -29,9 +29,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
import java.util.List;
/**
* <pre>
*
* </pre>
* Mvc configuration.
*
* @author : RYAN0UP
* @date : 2018/1/2
@ -66,7 +64,7 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
}
/**
*
* Configuring static resource path
*
* @param registry registry
*/
@ -100,6 +98,11 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
registry.addConverterFactory(new StringToEnumConverterFactory());
}
/**
* Configuring freemarker template file path.
*
* @return new FreeMarkerConfigurer
*/
@Bean
public FreeMarkerConfigurer freemarkerConfig() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
@ -108,6 +111,11 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
return configurer;
}
/**
* Configuring view resolver
*
* @param registry registry
*/
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();

View File

@ -32,9 +32,7 @@ import java.util.Map;
import static cc.ryanc.halo.model.support.HaloConst.DEFAULT_THEME_NAME;
/**
* <pre>
*
* </pre>
* The method executed after the application is started.
*
* @author : RYAN0UP
* @date : 2018/12/5

View File

@ -30,13 +30,13 @@ public class Attachment extends BaseEntity {
private Integer id;
/**
*
* Attachment name.
*/
@Column(name = "name", columnDefinition = "varchar(255) not null")
private String name;
/**
*
* Attachment access path.
*/
@Column(name = "path", columnDefinition = "varchar(1023) not null")
private String path;
@ -48,19 +48,19 @@ public class Attachment extends BaseEntity {
private String fileKey;
/**
*
* Thumbnail access path.
*/
@Column(name = "thumb_path", columnDefinition = "varchar(1023) default ''")
private String thumbPath;
/**
*
* Attachment media type.
*/
@Column(name = "media_type", columnDefinition = "varchar(50) not null")
private String mediaType;
/**
*
* Attachment suffix,such as .png,.jpg
*/
@Column(name = "suffix", columnDefinition = "varchar(50) default ''")
private String suffix;
@ -78,13 +78,13 @@ public class Attachment extends BaseEntity {
private Integer height;
/**
*
* Attachment size.
*/
@Column(name = "size", columnDefinition = "bigint not null")
private Long size;
/**
*
* Attachment upload type,LOCAL,UPYUN or QNYUN.
*/
@Column(name = "type", columnDefinition = "int default 0")
private AttachmentType type;

View File

@ -21,21 +21,21 @@ import java.util.Date;
public class BaseEntity {
/**
*
* Create time.
*/
@Column(name = "create_time", columnDefinition = "timestamp default CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;
/**
*
* Update time.
*/
@Column(name = "update_time", columnDefinition = "timestamp default CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date updateTime;
/**
*
* Delete flag.
*/
@Column(name = "deleted", columnDefinition = "TINYINT default 0")
private Boolean deleted = false;

View File

@ -27,7 +27,7 @@ public class BasePost extends BaseEntity {
private Integer id;
/**
*
* Post title.
*/
@Column(name = "title", columnDefinition = "varchar(100) not null")
private String title;
@ -45,67 +45,69 @@ public class BasePost extends BaseEntity {
private String url;
/**
*
* Original content,not format.
*/
@Column(name = "original_content", columnDefinition = "text not null")
private String originalContent;
/**
*
* Rendered content.
*
* @see cc.ryanc.halo.utils.MarkdownUtils#renderMarkdown(String)
*/
@Column(name = "format_content", columnDefinition = "text not null")
private String formatContent;
/**
*
* Post summary.
*/
@Column(name = "summary", columnDefinition = "varchar(500) default ''")
private String summary;
/**
*
* Cover thumbnail of the post.
*/
@Column(name = "thumbnail", columnDefinition = "varchar(1023) default ''")
private String thumbnail;
/**
*
* Post visits.
*/
@Column(name = "visits", columnDefinition = "bigint default 0")
private Long visits;
/**
*
* Whether to allow comments.
*/
@Column(name = "disallow_comment", columnDefinition = "int default 0")
private Boolean disallowComment;
/**
*
* Post password.
*/
@Column(name = "password", columnDefinition = "varchar(255) default ''")
private String password;
/**
*
* Custom template.
*/
@Column(name = "template", columnDefinition = "varchar(255) default ''")
private String template;
/**
*
* Whether to top the post.
*/
@Column(name = "top_priority", columnDefinition = "int default 0")
private Integer topPriority;
/**
*
* Create from,server or WeChat.
*/
@Column(name = "create_from", columnDefinition = "int default 0")
private PostCreateFrom createFrom;
/**
* /
* Likes
*/
@Column(name = "likes", columnDefinition = "bigint default 0")
private Long likes;

View File

@ -27,25 +27,25 @@ public class Category extends BaseEntity {
private Integer id;
/**
*
* Category name.
*/
@Column(name = "name", columnDefinition = "varchar(50) not null")
private String name;
/**
*
* Category slug name.
*/
@Column(name = "slug_name", columnDefinition = "varchar(50) not null")
private String slugName;
/**
*
* Description,can be display on category page.
*/
@Column(name = "description", columnDefinition = "varchar(100) default ''")
private String description;
/**
*
* Parent category.
*/
@Column(name = "parent_id", columnDefinition = "int default 0")
private Integer parentId;

View File

@ -28,25 +28,25 @@ public class Comment extends BaseEntity {
private Long id;
/**
*
* Commentator's name.
*/
@Column(name = "author", columnDefinition = "varchar(50) not null")
private String author;
/**
*
* Commentator's email.
*/
@Column(name = "email", columnDefinition = "varchar(255) default ''")
private String email;
/**
* ip
* Commentator's ip address.
*/
@Column(name = "ip_address", columnDefinition = "varchar(127) default ''")
private String ipAddress;
/**
*
* Commentator's website.
*/
@Column(name = "author_url", columnDefinition = "varchar(512) default ''")
private String authorUrl;
@ -58,7 +58,7 @@ public class Comment extends BaseEntity {
private String gavatarMd5;
/**
*
* Comment content.
*/
@Column(name = "content", columnDefinition = "varchar(1023) not null")
private String content;
@ -70,13 +70,13 @@ public class Comment extends BaseEntity {
private CommentStatus status;
/**
* UA
* Commentator's userAgent.
*/
@Column(name = "user_agent", columnDefinition = "varchar(512) default ''")
private String userAgent;
/**
*
* Is admin's comment.
*/
@Column(name = "is_admin", columnDefinition = "tinyint default 0")
private Boolean isAdmin;
@ -88,13 +88,13 @@ public class Comment extends BaseEntity {
private Integer postId;
/**
*
* Whether to top the comment.
*/
@Column(name = "top_priority", columnDefinition = "int default 0")
private Integer topPriority;
/**
*
* Parent comment.
*/
@Column(name = "parent_id", columnDefinition = "bigint default 0")
private Long parentId;

View File

@ -30,38 +30,38 @@ public class Gallery extends BaseEntity {
private Integer id;
/**
*
* Picture name.
*/
@Column(name = "name", columnDefinition = "varchar(255) not null")
private String name;
/**
*
* Picture description.
*/
@Column(name = "description", columnDefinition = "varchar(255) default ''")
private String description;
/**
* /
* Shooting time / creation time.
*/
@Column(name = "take_time", columnDefinition = "timestamp not null")
@Temporal(TemporalType.TIMESTAMP)
private Date takeTime;
/**
*
* Picture location.
*/
@Column(name = "location", columnDefinition = "varchar(255) default ''")
private String location;
/**
*
* Thumbnail
*/
@Column(name = "thumbnail", columnDefinition = "varchar(1023) default ''")
private String thumbnail;
/**
*
* Picture access path.
*/
@Column(name = "url", columnDefinition = "varchar(1023) not null")
private String url;

View File

@ -29,31 +29,31 @@ public class Link extends BaseEntity {
private Integer id;
/**
*
* Link name.
*/
@Column(name = "name", columnDefinition = "varchar(255) not null")
private String name;
/**
*
* Link website address.
*/
@Column(name = "url", columnDefinition = "varchar(255) not null")
private String url;
/**
* Logo
* Website logo.
*/
@Column(name = "logo", columnDefinition = "varchar(255) default ''")
private String logo;
/**
*
* Website description.
*/
@Column(name = "description", columnDefinition = "varchar(255) default ''")
private String description;
/**
*
* Link group name.
*/
@Column(name = "team", columnDefinition = "varchar(255) default ''")
private String team;

View File

@ -29,25 +29,25 @@ public class Log extends BaseEntity {
private Long id;
/**
*
* Log key.
*/
@Column(name = "log_key", columnDefinition = "varchar(1023) default ''")
private String logKey;
/**
*
* Log type.
*/
@Column(name = "type", columnDefinition = "int not null")
private LogType type;
/**
*
* Log content.
*/
@Column(name = "content", columnDefinition = "varchar(1023) not null")
private String content;
/**
* IP
* Operator's ip address.
*/
@Column(name = "ip_address", columnDefinition = "varchar(127) default ''")
private String ipAddress;

View File

@ -29,31 +29,31 @@ public class Menu extends BaseEntity {
private Integer id;
/**
*
* Menu name.
*/
@Column(name = "name", columnDefinition = "varchar(255) not null")
private String name;
/**
*
* Menu access url.
*/
@Column(name = "url", columnDefinition = "varchar(255) not null")
private String url;
/**
*
* Sort.
*/
@Column(name = "sort", columnDefinition = "int default 0")
private Integer sort;
/**
*
* Page opening method
*/
@Column(name = "target", columnDefinition = "varchar(20) default '_self'")
private String target;
/**
*
* Menu icon,Template support required.
*/
@Column(name = "icon", columnDefinition = "varchar(50) default ''")
private String icon;

View File

@ -26,13 +26,13 @@ public class PostCategory extends BaseEntity {
private Integer id;
/**
*
* Category id.
*/
@Column(name = "category_id")
private Integer categoryId;
/**
*
* Post id.
*/
@Column(name = "post_id")
private Integer postId;

View File

@ -28,13 +28,13 @@ public class PostTag extends BaseEntity {
private Integer id;
/**
*
* Post id.
*/
@Column(name = "post_id", columnDefinition = "int not null")
private Integer postId;
/**
*
* Tag id.
*/
@Column(name = "tag_id", columnDefinition = "int not null")
private Integer tagId;

View File

@ -29,13 +29,13 @@ public class Tag extends BaseEntity {
private Integer id;
/**
*
* Tag name.
*/
@Column(name = "name", columnDefinition = "varchar(255) not null")
private String name;
/**
*
* Tag slug name.
*/
@Column(name = "slug_name", columnDefinition = "varchar(255) not null")
private String slugName;

View File

@ -31,37 +31,37 @@ public class User extends BaseEntity {
private Integer id;
/**
*
* User name.
*/
@Column(name = "username", columnDefinition = "varchar(50) not null")
private String username;
/**
*
* User nick name,used to display on page.
*/
@Column(name = "nickname", columnDefinition = "varchar(255) not null")
private String nickname;
/**
*
* Password.
*/
@Column(name = "password", columnDefinition = "varchar(255) not null")
private String password;
/**
*
* User email.
*/
@Column(name = "email", columnDefinition = "varchar(127) default ''")
private String email;
/**
*
* User avatar.
*/
@Column(name = "avatar", columnDefinition = "varchar(1023) default ''")
private String avatar;
/**
*
* User description.
*/
@Column(name = "description", columnDefinition = "varchar(1023) default ''")
private String description;

View File

@ -9,6 +9,8 @@ import java.io.IOException;
import java.util.Map;
/**
* Freemarker custom tag of category.
*
* @author : RYAN0UP
* @date : 2019/3/22
*/

View File

@ -9,6 +9,8 @@ import java.io.IOException;
import java.util.Map;
/**
* Freemarker custom tag of comment.
*
* @author : RYAN0UP
* @date : 2019/3/22
*/

View File

@ -9,6 +9,8 @@ import java.io.IOException;
import java.util.Map;
/**
* Freemarker custom tag of link.
*
* @author : RYAN0UP
* @date : 2019/3/22
*/

View File

@ -9,6 +9,8 @@ import java.io.IOException;
import java.util.Map;
/**
* Freemarker custom tag of menu.
*
* @author : RYAN0UP
* @date : 2019/3/22
*/

View File

@ -11,9 +11,7 @@ import java.io.IOException;
import java.util.Map;
/**
* <pre>
* FreeMarker
* </pre>
* Freemarker custom tag of post.
*
* @author : RYAN0UP
* @date : 2018/4/26

View File

@ -9,6 +9,8 @@ import java.io.IOException;
import java.util.Map;
/**
* Freemarker custom tag of tag.
*
* @author : RYAN0UP
* @date : 2019/3/22
*/

View File

@ -19,26 +19,26 @@ import javax.validation.constraints.Size;
public class CategoryParam implements InputConverter<Category> {
/**
*
* Category name.
*/
@NotBlank(message = "Category name must not be blank")
@Size(max = 50, message = "Length of category name must not be more than {max}")
private String name;
/**
*
* Category slug name.
*/
@Size(max = 50, message = "Length of category slug name must not be more than {max}")
private String slugName;
/**
*
* Category description.
*/
@Size(max = 100, message = "Length of category description must not be more than {max}")
private String description;
/**
*
* Parent category.
*/
private Integer parentId;

View File

@ -23,7 +23,7 @@ public class HaloConst {
/**
* version constant
*/
public static final String HALO_VERSION = "0.4.2";
public static final String HALO_VERSION = "1.0.0";
/**
* Token of header param

View File

@ -20,7 +20,6 @@
<#-- 不允许修改该主题信息,也不能删除。 -->
<span>Designed by </span>
<a href="https://www.caicai.me">CaiCai</a>
<#-- 虽然Halo使用了宽松的GPL协议但开发不易希望您可以保留一下版权声明。笔芯~ -->
<div class="by_halo">
<a href="https://github.com/halo-dev/halo" target="_blank">Proudly published with Halo&#65281;</a>
</div>