Skip to content

Commit 6c7968c

Browse files
committed
feat: add archive freemarker custom tag.
1 parent d3ef9c4 commit 6c7968c

24 files changed

+112
-152
lines changed

src/main/java/run/halo/app/controller/admin/api/AdminController.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* @author johnniang
2626
* @author ryanwang
27-
* @date 3/19/19
27+
* @date 2019-03-19
2828
*/
2929
@Slf4j
3030
@RestController
@@ -41,7 +41,7 @@ public AdminController(AdminService adminService, OptionService optionService) {
4141
}
4242

4343
@GetMapping(value = "/is_installed")
44-
@ApiOperation("Check install status")
44+
@ApiOperation("Checks Installation status")
4545
public boolean isInstall() {
4646
return optionService.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);
4747
}
@@ -61,13 +61,13 @@ public void logout() {
6161
}
6262

6363
@PostMapping("password/code")
64-
@ApiOperation("Send reset password verify code.")
64+
@ApiOperation("Sends reset password verify code")
6565
public void sendResetCode(@RequestBody @Valid ResetPasswordParam param) {
6666
adminService.sendResetPasswordCode(param);
6767
}
6868

6969
@PutMapping("password/reset")
70-
@ApiOperation("Reset password by verify code.")
70+
@ApiOperation("Resets password by verify code")
7171
public void resetPassword(@RequestBody @Valid ResetPasswordParam param) {
7272
adminService.resetPasswordByCode(param);
7373
}
@@ -79,11 +79,6 @@ public AuthToken refresh(@PathVariable("refreshToken") String refreshToken) {
7979
return adminService.refreshToken(refreshToken);
8080
}
8181

82-
/**
83-
* Get some statistics about the count of posts, the count of comments, etc.
84-
*
85-
* @return counts
86-
*/
8782
@GetMapping("counts")
8883
@ApiOperation("Gets count info")
8984
@Deprecated
@@ -104,31 +99,31 @@ public void updateAdmin() {
10499
}
105100

106101
@GetMapping("spring/application.yaml")
107-
@ApiOperation("Get application config content")
102+
@ApiOperation("Gets application config content")
108103
public BaseResponse<String> getSpringApplicationConfig() {
109104
return BaseResponse.ok(HttpStatus.OK.getReasonPhrase(), adminService.getApplicationConfig());
110105
}
111106

112-
@PutMapping("spring/application.yaml/update")
113-
@ApiOperation("Update application config content")
107+
@PutMapping("spring/application.yaml")
108+
@ApiOperation("Updates application config content")
114109
public void updateSpringApplicationConfig(@RequestParam(name = "content") String content) {
115110
adminService.updateApplicationConfig(content);
116111
}
117112

118113
@PostMapping(value = {"halo/restart", "spring/restart"})
119-
@ApiOperation("Restart halo server")
114+
@ApiOperation("Restarts halo server")
120115
public void restartApplication() {
121116
Application.restart();
122117
}
123118

124119
@GetMapping(value = "halo/logfile")
125-
@ApiOperation("Get halo log file content.")
120+
@ApiOperation("Gets halo log file content")
126121
public BaseResponse<String> getLogFiles(@RequestParam("lines") Long lines) {
127122
return BaseResponse.ok(HttpStatus.OK.getReasonPhrase(), adminService.getLogFiles(lines));
128123
}
129124

130125
@GetMapping(value = "halo/logfile/download")
131-
@ApiOperation("Download halo log file.")
126+
@ApiOperation("Downloads halo log file")
132127
public void downloadLogFiles(@RequestParam("lines") Long lines, HttpServletResponse response) {
133128
adminService.downloadLogFiles(lines, response);
134129
}

src/main/java/run/halo/app/controller/admin/api/AttachmentController.java

+3-20
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,14 @@ public AttachmentController(AttachmentService attachmentService) {
3636
this.attachmentService = attachmentService;
3737
}
3838

39-
/**
40-
* List of attachment.
41-
*
42-
* @param pageable pageable
43-
* @return Page<AttachmentDTO>
44-
*/
4539
@GetMapping
4640
public Page<AttachmentDTO> pageBy(@PageableDefault(sort = "updateTime", direction = DESC) Pageable pageable,
4741
AttachmentQuery attachmentQuery) {
4842
return attachmentService.pageDtosBy(pageable, attachmentQuery);
4943
}
5044

51-
/**
52-
* Get attachment by id.
53-
*
54-
* @param id attachment id
55-
* @return AttachmentDTO
56-
*/
5745
@GetMapping("{id:\\d+}")
58-
@ApiOperation("Get attachment detail by id")
46+
@ApiOperation("Gets attachment detail by id")
5947
public AttachmentDTO getBy(@PathVariable("id") Integer id) {
6048
Attachment attachment = attachmentService.getById(id);
6149
return attachmentService.convertToDto(attachment);
@@ -70,19 +58,14 @@ public AttachmentDTO updateBy(@PathVariable("attachmentId") Integer attachmentId
7058
return new AttachmentDTO().convertFrom(attachmentService.update(attachment));
7159
}
7260

73-
/**
74-
* Delete attachment by id
75-
*
76-
* @param id id
77-
*/
7861
@DeleteMapping("{id:\\d+}")
79-
@ApiOperation("Delete attachment permanently by id")
62+
@ApiOperation("Deletes attachment permanently by id")
8063
public AttachmentDTO deletePermanently(@PathVariable("id") Integer id) {
8164
return attachmentService.convertToDto(attachmentService.removePermanently(id));
8265
}
8366

8467
@DeleteMapping
85-
@ApiOperation("Delete attachments permanently in batch by id array")
68+
@ApiOperation("Deletes attachments permanently in batch by id array")
8669
public List<Attachment> deletePermanentlyInBatch(@RequestBody List<Integer> ids) {
8770
return attachmentService.removePermanently(ids);
8871
}

src/main/java/run/halo/app/controller/admin/api/BackupController.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ public BackupController(BackupService backupService) {
4343
}
4444

4545
@PostMapping("halo")
46-
@ApiOperation("Backup halo")
46+
@ApiOperation("Backups halo")
4747
public BackupDTO backupHalo() {
4848
return backupService.zipWorkDirectory();
4949
}
5050

5151
@GetMapping("halo")
52-
@ApiOperation("Get all backups")
52+
@ApiOperation("Gets all backups")
5353
public List<BackupDTO> listBackups() {
5454
return backupService.listHaloBackups();
5555
}
5656

5757
@GetMapping("halo/{fileName:.+}")
58-
@ApiOperation("Download backup file")
58+
@ApiOperation("Downloads backup file")
5959
public ResponseEntity<Resource> downloadBackup(@PathVariable("fileName") String fileName, HttpServletRequest request) {
6060
log.info("Try to download backup file: [{}]", fileName);
6161

@@ -77,7 +77,7 @@ public ResponseEntity<Resource> downloadBackup(@PathVariable("fileName") String
7777
}
7878

7979
@DeleteMapping("halo")
80-
@ApiOperation("Delete a backup")
80+
@ApiOperation("Deletes a backup")
8181
public void deleteBackup(@RequestParam("filename") String filename) {
8282
backupService.deleteHaloBackup(filename);
8383
}

src/main/java/run/halo/app/controller/admin/api/CategoryController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Category controller.
2222
*
2323
* @author johnniang
24-
* @date 3/21/19
24+
* @date 2019-03-21
2525
*/
2626
@RestController
2727
@RequestMapping("/api/admin/categories")

src/main/java/run/halo/app/controller/admin/api/InstallController.java

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import cn.hutool.core.text.StrBuilder;
44
import cn.hutool.crypto.SecureUtil;
5+
import io.swagger.annotations.ApiOperation;
56
import lombok.extern.slf4j.Slf4j;
67
import org.apache.commons.lang3.StringUtils;
78
import org.springframework.context.ApplicationEventPublisher;
@@ -78,6 +79,7 @@ public InstallController(UserService userService,
7879
@PostMapping
7980
@ResponseBody
8081
@CacheLock
82+
@ApiOperation("Initializes the blog")
8183
public BaseResponse<String> installBlog(@RequestBody InstallParam installParam) {
8284
// Validate manually
8385
ValidationUtils.validate(installParam, CreateCheck.class);

src/main/java/run/halo/app/controller/admin/api/JournalCommentController.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Journal comment controller.
2828
*
2929
* @author johnniang
30-
* @date 19-4-25
30+
* @date 2019-04-25
3131
*/
3232
@RestController
3333
@RequestMapping("/api/admin/journals/comments")
@@ -53,6 +53,7 @@ public Page<JournalCommentWithJournalVO> pageBy(@PageableDefault(sort = "updateT
5353
}
5454

5555
@GetMapping("latest")
56+
@ApiOperation("Lists latest journal comments")
5657
public List<JournalCommentWithJournalVO> listLatest(@RequestParam(name = "top", defaultValue = "10") int top,
5758
@RequestParam(name = "status", required = false) CommentStatus status) {
5859
List<JournalComment> latestComments = journalCommentService.pageLatest(top, status).getContent();

src/main/java/run/halo/app/controller/admin/api/LinkController.java

+11-23
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
import javax.validation.Valid;
1313
import java.util.List;
1414

15+
import static org.springframework.data.domain.Sort.Direction.ASC;
16+
import static org.springframework.data.domain.Sort.Direction.DESC;
17+
1518
/**
1619
* Link Controller
1720
*
1821
* @author ryanwang
19-
* @date 2019/3/21
22+
* @date 2019-03-21
2023
*/
2124
@RestController
2225
@RequestMapping("/api/admin/links")
@@ -28,36 +31,26 @@ public LinkController(LinkService linkService) {
2831
this.linkService = linkService;
2932
}
3033

31-
/**
32-
* List all links
33-
*
34-
* @param sort sort
35-
* @return List
36-
*/
3734
@GetMapping
38-
public List<LinkDTO> listLinks(@SortDefault(sort = "priority", direction = Sort.Direction.ASC) Sort sort) {
39-
return linkService.listDtos(sort);
35+
@ApiOperation("Lists links")
36+
public List<LinkDTO> listLinks(@SortDefault(sort = "team", direction = DESC) Sort sort) {
37+
return linkService.listDtos(sort.and(Sort.by(ASC, "priority")));
4038
}
4139

42-
/**
43-
* Get link by id.
44-
*
45-
* @param id id
46-
* @return LinkDTO
47-
*/
4840
@GetMapping("{id:\\d+}")
49-
@ApiOperation("Get link detail by id")
41+
@ApiOperation("Gets link detail by id")
5042
public LinkDTO getBy(@PathVariable("id") Integer id) {
5143
return new LinkDTO().convertFrom(linkService.getById(id));
5244
}
5345

5446
@GetMapping("parse")
55-
@ApiOperation("Get link by parse url")
47+
@ApiOperation("Gets link by parse url")
5648
public LinkDTO getByParse(@RequestParam("url") String url) {
5749
return linkService.getByParse(url);
5850
}
5951

6052
@PostMapping
53+
@ApiOperation("Creates a link")
6154
public LinkDTO createBy(@RequestBody @Valid LinkParam linkParam) {
6255
Link link = linkService.createBy(linkParam);
6356
return new LinkDTO().convertFrom(link);
@@ -72,19 +65,14 @@ public LinkDTO updateBy(@PathVariable("id") Integer id,
7265
return new LinkDTO().convertFrom(linkService.update(link));
7366
}
7467

75-
/**
76-
* Delete link by id.
77-
*
78-
* @param id id
79-
*/
8068
@DeleteMapping("{id:\\d+}")
8169
@ApiOperation("Delete link by id")
8270
public void deletePermanently(@PathVariable("id") Integer id) {
8371
linkService.removeById(id);
8472
}
8573

8674
@GetMapping("teams")
87-
@ApiOperation(("List all link teams"))
75+
@ApiOperation(("Lists all link teams"))
8876
public List<String> teams() {
8977
return linkService.listAllTeams();
9078
}

src/main/java/run/halo/app/controller/admin/api/LogController.java

+3-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Log controller.
2121
*
2222
* @author johnniang
23-
* @date 3/19/19
23+
* @date 2019-03-19
2424
*/
2525
@RestController
2626
@RequestMapping("/api/admin/logs")
@@ -32,29 +32,21 @@ public LogController(LogService logService) {
3232
this.logService = logService;
3333
}
3434

35-
/**
36-
* List latest logs.
37-
*
38-
* @param top top
39-
* @return List of logs
40-
*/
4135
@GetMapping("latest")
4236
@ApiOperation("Pages latest logs")
4337
public List<LogDTO> pageLatest(@RequestParam(name = "top", defaultValue = "10") int top) {
4438
return logService.pageLatest(top).getContent();
4539
}
4640

4741
@GetMapping
42+
@ApiOperation("Lists logs")
4843
public Page<LogDTO> pageBy(@PageableDefault(sort = "updateTime", direction = DESC) Pageable pageable) {
4944
Page<Log> logPage = logService.listAll(pageable);
5045
return logPage.map(log -> new LogDTO().convertFrom(log));
5146
}
5247

53-
/**
54-
* Clear all logs.
55-
*/
5648
@GetMapping("clear")
57-
@ApiOperation("Clear all logs")
49+
@ApiOperation("Clears all logs")
5850
public void clear() {
5951
logService.removeAll();
6052
}

src/main/java/run/halo/app/controller/admin/api/MailController.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package run.halo.app.controller.admin.api;
22

3+
import io.swagger.annotations.ApiOperation;
34
import org.springframework.web.bind.annotation.PostMapping;
45
import org.springframework.web.bind.annotation.RequestBody;
56
import org.springframework.web.bind.annotation.RequestMapping;
@@ -14,7 +15,7 @@
1415
* Mail controller.
1516
*
1617
* @author johnniang
17-
* @date 19-5-7
18+
* @date 2019-05-07
1819
*/
1920
@RestController
2021
@RequestMapping("/api/admin/mails")
@@ -27,6 +28,7 @@ public MailController(MailService mailService) {
2728
}
2829

2930
@PostMapping("test")
31+
@ApiOperation("Tests the SMTP service")
3032
public BaseResponse testMail(@Valid @RequestBody MailParam mailParam) {
3133
mailService.sendMail(mailParam.getTo(), mailParam.getSubject(), mailParam.getContent());
3234
return BaseResponse.ok("发送成功");

src/main/java/run/halo/app/controller/admin/api/MenuController.java

+7-13
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,18 @@ public MenuController(MenuService menuService) {
3535

3636
@GetMapping
3737
@ApiOperation("Lists all menus")
38-
public List<MenuDTO> listAll(@SortDefault(sort = "priority", direction = DESC) Sort sort) {
39-
return menuService.listDtos(sort);
38+
public List<MenuDTO> listAll(@SortDefault(sort = "team", direction = DESC) Sort sort) {
39+
return menuService.listDtos(sort.and(Sort.by(ASC, "priority")));
4040
}
4141

4242
@GetMapping("tree_view")
43-
@ApiOperation("List as category tree")
44-
public List<MenuVO> listAsTree(@SortDefault(sort = "priority", direction = ASC) Sort sort) {
45-
return menuService.listAsTree(sort);
43+
@ApiOperation("Lists categories as tree")
44+
public List<MenuVO> listAsTree(@SortDefault(sort = "team", direction = DESC) Sort sort) {
45+
return menuService.listAsTree(sort.and(Sort.by(ASC, "priority")));
4646
}
4747

48-
/**
49-
* Get menu by menuId.
50-
*
51-
* @param menuId menuId
52-
* @return MenuDTO
53-
*/
5448
@GetMapping("{menuId:\\d+}")
55-
@ApiOperation("Get menu detail by id")
49+
@ApiOperation("Gets menu detail by id")
5650
public MenuDTO getBy(@PathVariable("menuId") Integer menuId) {
5751
return new MenuDTO().convertFrom(menuService.getById(menuId));
5852
}
@@ -91,7 +85,7 @@ public MenuDTO deleteBy(@PathVariable("menuId") Integer menuId) {
9185
}
9286

9387
@GetMapping("teams")
94-
@ApiOperation(("List all menu teams"))
88+
@ApiOperation(("Lists all menu teams"))
9589
public List<String> teams() {
9690
return menuService.listAllTeams();
9791
}

0 commit comments

Comments
 (0)