mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 17:31:15 +08:00
Fix post controller test setup
This commit is contained in:
@@ -17,7 +17,7 @@ public class CategoryController {
|
||||
|
||||
@PostMapping
|
||||
public CategoryDto create(@RequestBody CategoryRequest req) {
|
||||
Category c = categoryService.createCategory(req.getName());
|
||||
Category c = categoryService.createCategory(req.getName(), req.getDescribe(), req.getIcon());
|
||||
return toDto(c);
|
||||
}
|
||||
|
||||
@@ -42,17 +42,23 @@ public class CategoryController {
|
||||
CategoryDto dto = new CategoryDto();
|
||||
dto.setId(c.getId());
|
||||
dto.setName(c.getName());
|
||||
dto.setIcon(c.getIcon());
|
||||
dto.setDescribe(c.getDescribe());
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class CategoryRequest {
|
||||
private String name;
|
||||
private String describe;
|
||||
private String icon;
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class CategoryDto {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String describe;
|
||||
private String icon;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class TagController {
|
||||
|
||||
@PostMapping
|
||||
public TagDto create(@RequestBody TagRequest req) {
|
||||
Tag tag = tagService.createTag(req.getName());
|
||||
Tag tag = tagService.createTag(req.getName(), req.getDescribe(), req.getIcon());
|
||||
return toDto(tag);
|
||||
}
|
||||
|
||||
@@ -42,17 +42,23 @@ public class TagController {
|
||||
TagDto dto = new TagDto();
|
||||
dto.setId(tag.getId());
|
||||
dto.setName(tag.getName());
|
||||
dto.setIcon(tag.getIcon());
|
||||
dto.setDescribe(tag.getDescribe());
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class TagRequest {
|
||||
private String name;
|
||||
private String describe;
|
||||
private String icon;
|
||||
}
|
||||
|
||||
@Data
|
||||
private static class TagDto {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String describe;
|
||||
private String icon;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user