1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-08 05:47:07 +09:00

GO-4459: Fix object delete error handling

This commit is contained in:
Jannis Metrikat 2025-01-10 20:52:23 +01:00
parent aeed6dcaa2
commit 4b21551fdd
No known key found for this signature in database
GPG key ID: B223CAC5AAF85615
3 changed files with 5 additions and 5 deletions

View file

@ -103,7 +103,7 @@ func DeleteObjectHandler(s *ObjectService) gin.HandlerFunc {
code := util.MapErrorCode(err,
util.ErrToCode(ErrObjectNotFound, http.StatusNotFound),
util.ErrToCode(ErrFailedRetrieveObject, http.StatusInternalServerError),
util.ErrToCode(ErrFailedDeleteObject, http.StatusInternalServerError),
util.ErrToCode(ErrFailedDeleteObject, http.StatusForbidden),
)
if code != http.StatusOK {

View file

@ -157,12 +157,12 @@ func (s *ObjectService) DeleteObject(ctx context.Context, spaceId string, object
return Object{}, err
}
resp := s.mw.ObjectListSetIsArchived(ctx, &pb.RpcObjectListSetIsArchivedRequest{
ObjectIds: []string{objectId},
resp := s.mw.ObjectSetIsArchived(ctx, &pb.RpcObjectSetIsArchivedRequest{
ContextId: objectId,
IsArchived: true,
})
if resp.Error.Code != pb.RpcObjectListSetIsArchivedResponseError_NULL {
if resp.Error.Code != pb.RpcObjectSetIsArchivedResponseError_NULL {
return Object{}, ErrFailedDeleteObject
}

View file

@ -59,7 +59,7 @@ func (s *SearchService) Search(ctx context.Context, searchQuery string, objectTy
Sorts: []*model.BlockContentDataviewSort{{
RelationKey: bundle.RelationKeyLastModifiedDate.String(),
Type: model.BlockContentDataviewSort_Desc,
Format: model.RelationFormat_longtext,
Format: model.RelationFormat_date,
IncludeTime: true,
EmptyPlacement: model.BlockContentDataviewSort_NotSpecified,
}},