fix: query wihout parent_id all result will come out
This commit is contained in:
		
							parent
							
								
									56145d71af
								
							
						
					
					
						commit
						efff638ab5
					
				| 
						 | 
					@ -110,7 +110,12 @@ func (repo *CommentRepository) ListComments(ctx context.Context, req repository.
 | 
				
			||||||
	filter := bson.M{}
 | 
						filter := bson.M{}
 | 
				
			||||||
	if req.ParentID != nil {
 | 
						if req.ParentID != nil {
 | 
				
			||||||
		filter["parent_comment_id"] = req.ParentID
 | 
							filter["parent_comment_id"] = req.ParentID
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							filter["parent_comment_id"] = bson.M{
 | 
				
			||||||
 | 
								"$in": []interface{}{"", nil},
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if req.ReferenceID != nil {
 | 
						if req.ReferenceID != nil {
 | 
				
			||||||
		filter["reference_id"] = req.ReferenceID
 | 
							filter["reference_id"] = req.ReferenceID
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue