diff --git a/.framework/java/backend/src/main/java/io/spring/core/comment/Comment.java b/.framework/java/backend/src/main/java/io/spring/core/comment/Comment.java index a7a6bc4b..ecfcfa1e 100644 --- a/.framework/java/backend/src/main/java/io/spring/core/comment/Comment.java +++ b/.framework/java/backend/src/main/java/io/spring/core/comment/Comment.java @@ -12,14 +12,14 @@ public class Comment { private String id; private String body; - private String userId; + private String sellerId; private String itemId; private DateTime createdAt; - public Comment(String body, String userId, String itemId) { + public Comment(String body, String sellerId, String itemId) { this.id = UUID.randomUUID().toString(); this.body = body; - this.userId = userId; + this.sellerId = sellerId; this.itemId = itemId; this.createdAt = new DateTime(); } diff --git a/.framework/java/backend/src/main/java/io/spring/core/service/AuthorizationService.java b/.framework/java/backend/src/main/java/io/spring/core/service/AuthorizationService.java index bb7fba2d..080e7428 100644 --- a/.framework/java/backend/src/main/java/io/spring/core/service/AuthorizationService.java +++ b/.framework/java/backend/src/main/java/io/spring/core/service/AuthorizationService.java @@ -10,6 +10,6 @@ public static boolean canWriteItem(User user, Item item) { } public static boolean canWriteComment(User user, Item item, Comment comment) { - return user.getId().equals(item.getSellerId()) || user.getId().equals(comment.getUserId()); + return user.getId().equals(item.getSellerId()) || user.getId().equals(comment.getSellerId()); } } diff --git a/.framework/java/backend/src/main/resources/db/migration/V1__create_tables.sql b/.framework/java/backend/src/main/resources/db/migration/V1__create_tables.sql index d2838d07..1a5b612f 100644 --- a/.framework/java/backend/src/main/resources/db/migration/V1__create_tables.sql +++ b/.framework/java/backend/src/main/resources/db/migration/V1__create_tables.sql @@ -44,7 +44,7 @@ create table comments ( id varchar(255) primary key, body text, item_id varchar(255), - user_id varchar(255), + seller_id varchar(255), created_at TIMESTAMP NOT NULL, updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); diff --git a/.framework/java/backend/src/main/resources/mapper/CommentMapper.xml b/.framework/java/backend/src/main/resources/mapper/CommentMapper.xml index 4f112826..c715304b 100644 --- a/.framework/java/backend/src/main/resources/mapper/CommentMapper.xml +++ b/.framework/java/backend/src/main/resources/mapper/CommentMapper.xml @@ -2,11 +2,11 @@ - insert into comments(id, body, user_id, item_id, created_at, updated_at) + insert into comments(id, body, seller_id, item_id, created_at, updated_at) values ( #{comment.id}, #{comment.body}, - #{comment.userId}, + #{comment.sellerId}, #{comment.itemId}, #{comment.createdAt}, #{comment.createdAt} @@ -19,7 +19,7 @@ select id commentId, body commentBody, - user_id commentUserId, + seller_id commentSellerId, item_id commentItemId, created_at commentCreatedAt from comments @@ -28,7 +28,7 @@ - + diff --git a/.framework/java/backend/src/main/resources/mapper/CommentReadService.xml b/.framework/java/backend/src/main/resources/mapper/CommentReadService.xml index 2681aa6b..cebb77e2 100644 --- a/.framework/java/backend/src/main/resources/mapper/CommentReadService.xml +++ b/.framework/java/backend/src/main/resources/mapper/CommentReadService.xml @@ -10,7 +10,7 @@ from comments C left join users U - on C.user_id = U.id + on C.seller_id = U.id