refactoring

- change Color to BoardBackgroundColor
- change setBoardMemberPermission to setMemberPermission
This commit is contained in:
Raffaele Mignone 2019-11-10 10:51:43 +01:00
parent 991b19a1b8
commit f4d51da443
Signed by: norangebit
GPG Key ID: F5255658CB220573
5 changed files with 18 additions and 14 deletions

View File

@ -22,7 +22,7 @@ public interface BoardService {
Call<Void> deleteBoard(@Path("boardId") String boardId); Call<Void> deleteBoard(@Path("boardId") String boardId);
@POST("/api/boards/{boardId}/members/{memberId}") @POST("/api/boards/{boardId}/members/{memberId}")
Call<Void> setBoardMemberPermission( Call<Void> setMemberPermission(
@Path("boardId") String board, @Path("boardId") String board,
@Path("memberId") String member, @Path("memberId") String member,
@Body MemberPermission memberPermission @Body MemberPermission memberPermission

View File

@ -16,7 +16,8 @@ public class Board {
// TODO list of labels // TODO list of labels
// TODO list of members // TODO list of members
private Permission permission; private Permission permission;
private Color color; @SerializedName("color")
private BoardBackgroundColor backgroundColor;
private String description; private String description;
private String subtasksDefaultBoardId; private String subtasksDefaultBoardId;
private String subtasksDefaultListId; private String subtasksDefaultListId;
@ -62,8 +63,8 @@ public class Board {
return permission; return permission;
} }
public Color getColor() { public BoardBackgroundColor getBackgroundColor() {
return color; return backgroundColor;
} }
public String getDescription() { public String getDescription() {
@ -125,7 +126,7 @@ public class Board {
", modifiedAt=" + modifiedAt + ", modifiedAt=" + modifiedAt +
", starts=" + starts + ", starts=" + starts +
", permission=" + permission + ", permission=" + permission +
", color=" + color + ", color=" + backgroundColor +
", description='" + description + '\'' + ", description='" + description + '\'' +
", subtasksDefaultBoardId='" + subtasksDefaultBoardId + '\'' + ", subtasksDefaultBoardId='" + subtasksDefaultBoardId + '\'' +
", subtasksDefaultListId='" + subtasksDefaultListId + '\'' + ", subtasksDefaultListId='" + subtasksDefaultListId + '\'' +

View File

@ -2,7 +2,7 @@ package wekan.wrapper.entity;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public enum Color { public enum BoardBackgroundColor {
@SerializedName("belize") @SerializedName("belize")
BELIZE, BELIZE,
@SerializedName("nephritis") @SerializedName("nephritis")

View File

@ -1,5 +1,7 @@
package wekan.wrapper.entity; package wekan.wrapper.entity;
import com.google.gson.annotations.SerializedName;
public class BoardPrototype { public class BoardPrototype {
private String title; private String title;
private String owner; private String owner;
@ -8,7 +10,8 @@ public class BoardPrototype {
private boolean isNoComments; private boolean isNoComments;
private boolean isCommentOnly; private boolean isCommentOnly;
private Permission permission; private Permission permission;
private Color color; @SerializedName("color")
private BoardBackgroundColor backgroundColor;
private BoardPrototype( private BoardPrototype(
String title, String title,
@ -18,7 +21,7 @@ public class BoardPrototype {
boolean isNoComments, boolean isNoComments,
boolean isCommentOnly, boolean isCommentOnly,
Permission permission, Permission permission,
Color color BoardBackgroundColor backgroundColor
) { ) {
this.title = title; this.title = title;
this.owner = owner; this.owner = owner;
@ -27,7 +30,7 @@ public class BoardPrototype {
this.isNoComments = isNoComments; this.isNoComments = isNoComments;
this.isCommentOnly = isCommentOnly; this.isCommentOnly = isCommentOnly;
this.permission = permission; this.permission = permission;
this.color = color; this.backgroundColor = backgroundColor;
} }
public static class Builder { public static class Builder {
@ -38,7 +41,7 @@ public class BoardPrototype {
private boolean isNoComments = false; private boolean isNoComments = false;
private boolean isCommentOnly = false; private boolean isCommentOnly = false;
private Permission permission = Permission.PRIVATE; private Permission permission = Permission.PRIVATE;
private Color color = Color.BELIZE; private BoardBackgroundColor backgroundColor = BoardBackgroundColor.BELIZE;
public Builder() { public Builder() {
} }
@ -52,7 +55,7 @@ public class BoardPrototype {
isNoComments, isNoComments,
isCommentOnly, isCommentOnly,
permission, permission,
color backgroundColor
); );
} }
@ -91,8 +94,8 @@ public class BoardPrototype {
return this; return this;
} }
public Builder setColor(Color color) { public Builder setBackgroundColor(BoardBackgroundColor backgroundColor) {
this.color = color; this.backgroundColor = backgroundColor;
return this; return this;
} }
} }

View File

@ -118,7 +118,7 @@ public class BoardServiceTest {
assertFalse(board.isArchived()); assertFalse(board.isArchived());
assertEquals(0, board.getStarts()); assertEquals(0, board.getStarts());
assertEquals(Permission.PRIVATE, board.getPermission()); assertEquals(Permission.PRIVATE, board.getPermission());
assertEquals(Color.CORTEZA, board.getColor()); assertEquals(BoardBackgroundColor.CORTEZA, board.getBackgroundColor());
assertTrue(board.isAllowsSubtasks()); assertTrue(board.isAllowsSubtasks());
assertEquals(PresentParentTask.NO_PARENT, board.getPresentParentTask()); assertEquals(PresentParentTask.NO_PARENT, board.getPresentParentTask());
assertEquals(0, board.getSpentTime()); assertEquals(0, board.getSpentTime());