This commit is contained in:
wangchuxiao
2022-05-05 11:58:48 +08:00
parent 8ed0f8ec73
commit d75eb456dc
7 changed files with 88 additions and 3104 deletions
+9
View File
@@ -34,6 +34,14 @@ type CommentOneWorkMomentResp struct {
CommResp
}
type DeleteCommentReq struct {
office.DeleteCommentReq
}
type DeleteCommentResp struct {
CommResp
}
type WorkMomentsUserCommonReq struct {
PageNumber int32 `json:"pageNumber" binding:"required"`
ShowNumber int32 `json:"showNumber" binding:"required"`
@@ -54,6 +62,7 @@ type WorkMoment struct {
UserName string `json:"userName"`
AtUserList []*WorkMomentUser `json:"atUsers"`
CreateTime int32 `json:"createTime"`
Permission int32 `json:"permission"`
}
type WorkMomentUser struct {
+12
View File
@@ -716,6 +716,18 @@ func (d *DataBases) DeleteOneWorkMoment(workMomentID string) error {
return err
}
func (d *DataBases) DeleteComment(workMomentID, contentID, opUserID string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cWorkMoment)
_, err := c.UpdateOne(ctx, bson.D{{"work_moment_id", workMomentID},
{"$or", bson.A{
bson.D{{"user_id", opUserID}},
bson.D{{"comments", bson.M{"$elemMatch": bson.M{"user_id": opUserID}}}},
},
}}, bson.M{"$pull": bson.M{"comments": bson.M{"content_id": contentID}}})
return err
}
func (d *DataBases) GetWorkMomentByID(workMomentID string) (*WorkMoment, error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cWorkMoment)
File diff suppressed because it is too large Load Diff
+12
View File
@@ -195,6 +195,17 @@ message CommentOneWorkMomentResp {
CommonResp commonResp = 1;
}
message DeleteCommentReq {
string workMomentID = 1;
string contentID = 2;
string opUserID = 3;
string operationID = 4;
}
message DeleteCommentResp {
CommonResp commonResp = 1;
}
message GetWorkMomentByIDReq {
string workMomentID = 1;
string opUserID = 2;
@@ -280,6 +291,7 @@ service OfficeService {
rpc DeleteOneWorkMoment(DeleteOneWorkMomentReq) returns(DeleteOneWorkMomentResp);
rpc LikeOneWorkMoment(LikeOneWorkMomentReq) returns(LikeOneWorkMomentResp);
rpc CommentOneWorkMoment(CommentOneWorkMomentReq) returns(CommentOneWorkMomentResp);
rpc DeleteComment(DeleteCommentReq) returns(DeleteCommentResp);
rpc GetWorkMomentByID(GetWorkMomentByIDReq) returns(GetWorkMomentByIDResp);
rpc ChangeWorkMomentPermission(ChangeWorkMomentPermissionReq) returns(ChangeWorkMomentPermissionResp);
/// user self