Skip to content

Commit

Permalink
Merge pull request #77 from Dapp-Learning-DAO/feature/arc_share
Browse files Browse the repository at this point in the history
.
  • Loading branch information
arc0035 committed Dec 10, 2023
2 parents 6bf3968 + b78e974 commit d2ee705
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 23 deletions.
13 changes: 7 additions & 6 deletions interface/share.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"url": "http://81.69.8.95:8080/share/usershare/create",
"url": "http://43.135.22.107:8080/share/usershare/create",
"method": "POST",
"body": {
"theme": "主题",
Expand All @@ -11,7 +11,8 @@
"org": "所属组织",
"twitter": "分享人推特",
"sharingDoc": "分享链接",
"label": "标签类别"
"label": "标签类别",
"memberId": "分享人id"
},
"response":
{
Expand Down Expand Up @@ -43,7 +44,7 @@
}
},
{
"url": "http://81.69.8.95:8080/share/usershare/delete?shareId=111",
"url": "http://43.135.22.107:8080/share/usershare/delete?shareId=111",
"method": "POST",
"response":
{
Expand All @@ -53,7 +54,7 @@
}
},
{
"url": "http://81.69.8.95:8080/share/usershare/all?pageNo=1&pageSize=10",
"url": "http://43.135.22.107:8080/share/usershare/all?pageNo=1&pageSize=10",
"method": "GET",
"response":
{
Expand Down Expand Up @@ -89,7 +90,7 @@
}
},
{
"url": "http://81.69.8.95:8080/share/usershare/byUser?memberId=1?pageNo=1&pageSize=10",
"url": "http://43.135.22.107:8080/share/usershare/byUser?memberId=1?pageNo=1&pageSize=10",
"method": "GET",
"response":
{
Expand Down Expand Up @@ -125,7 +126,7 @@
}
},
{
"url": "http://81.69.8.95:8080/share/usershare/queryByShareId?shareId=111",
"url": "http://43.135.22.107:8080/share/usershare/queryByShareId?shareId=111",
"method": "GET",
"response":
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public class UserSharingController {
* @return
*/
@PostMapping("create")
public BaseResponse<Long> createSharing(CreateSharingReq req){
public BaseResponse<Long> createSharing(@RequestBody CreateSharingReq req){
return BaseResponse.successWithData(this.userSharingService.createSharing(req));
}

/**
* 修改分享
*/
@PostMapping("update")
public BaseResponse updateSharing(UpdateSharingReq req){
public BaseResponse updateSharing(@RequestBody UpdateSharingReq req){
this.userSharingService.updateSharing(req);
return BaseResponse.success();
}
Expand All @@ -47,8 +47,8 @@ public BaseResponse updateSharing(UpdateSharingReq req){
* 删除分享
*/
@PostMapping("delete")
public BaseResponse deleteSharing(@RequestParam("shareId") long shareId, @RequestParam("memberId") long memberId){
this.userSharingService.deleteSharing(shareId, memberId);
public BaseResponse deleteSharing(@RequestParam("shareId") long shareId){
this.userSharingService.deleteSharing(shareId);
return BaseResponse.success();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,4 @@ public class UpdateSharingReq {
*/
@ApiModelProperty("分享标签")
private String label;

/**
* 修改人id
*/
private String memberId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface IUserSharingService {
/**
* 删除分享
*/
void deleteSharing(long shareId, long memberId);
void deleteSharing(long shareId);


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public void updateSharing(UpdateSharingReq req) {
// throw new BizException(CodeEnums.SHARING_NOT_FOUND);
// }

if(!Objects.equals(sharing.getMemberId(), req.getMemberId())){
throw new BizException(CodeEnums.SHARING_NOT_OWNER);
}
// if(!Objects.equals(sharing.getMemberId(), req.getMemberId())){
// throw new BizException(CodeEnums.SHARING_NOT_OWNER);
// }
if(sharing.getLockStatus() == SharingLockStatus.LOCKED.getCode()){
throw new BizException(CodeEnums.SHARING_LOCKED);
}
Expand All @@ -105,7 +105,7 @@ public void updateSharing(UpdateSharingReq req) {
}

@Override
public void deleteSharing(long shareId, long memberId) {
public void deleteSharing(long shareId) {
//Verify
Optional<TbShare> existed = this.sharingRepository.findById(shareId);
if(!existed.isPresent()){
Expand All @@ -114,9 +114,9 @@ public void deleteSharing(long shareId, long memberId) {
TbShare sharing = existed.get();
// SessionUserInfo userInfo = HttpSessionUtils.getMember(request.getSession());
// Member member = this.memberRepository.findByAddress(userInfo.getAddress()).get();
if(!Objects.equals(sharing.getMemberId(), memberId)){
throw new BizException(CodeEnums.SHARING_NOT_OWNER);
}
// if(!Objects.equals(sharing.getMemberId(), memberId)){
// throw new BizException(CodeEnums.SHARING_NOT_OWNER);
// }
//Delete
this.sharingRepository.deleteById(shareId);
}
Expand Down

0 comments on commit d2ee705

Please sign in to comment.