mirror of https://github.com/usememos/memos.git
feat: backend `ListMemos` API supports return comments
upd: rename/delete tags regardless of whether they are in comments or not
This commit is contained in:
parent
cdc27c7fee
commit
49754ef2e8
|
|
@ -301,6 +301,9 @@ message ListMemosRequest {
|
||||||
|
|
||||||
// Optional. If true, show deleted memos in the response.
|
// Optional. If true, show deleted memos in the response.
|
||||||
bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL];
|
bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL];
|
||||||
|
|
||||||
|
// Optional. If true, include comment memos in the response.
|
||||||
|
bool show_comments = 7 [(google.api.field_behavior) = OPTIONAL];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListMemosResponse {
|
message ListMemosResponse {
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,9 @@ type ListMemosRequest struct {
|
||||||
// Refer to `Shortcut.filter`.
|
// Refer to `Shortcut.filter`.
|
||||||
Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"`
|
Filter string `protobuf:"bytes,5,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||||
// Optional. If true, show deleted memos in the response.
|
// Optional. If true, show deleted memos in the response.
|
||||||
ShowDeleted bool `protobuf:"varint,6,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`
|
ShowDeleted bool `protobuf:"varint,6,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`
|
||||||
|
// Optional. If true, include comment memos in the response.
|
||||||
|
ShowComments bool `protobuf:"varint,7,opt,name=show_comments,json=showComments,proto3" json:"show_comments,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
@ -648,6 +650,13 @@ func (x *ListMemosRequest) GetShowDeleted() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ListMemosRequest) GetShowComments() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.ShowComments
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type ListMemosResponse struct {
|
type ListMemosResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
// The list of memos.
|
// The list of memos.
|
||||||
|
|
@ -2053,7 +2062,7 @@ const file_api_v1_memo_service_proto_rawDesc = "" +
|
||||||
"\amemo_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06memoId\x12(\n" +
|
"\amemo_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06memoId\x12(\n" +
|
||||||
"\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" +
|
"\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xed\x01\n" +
|
"request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\x97\x02\n" +
|
||||||
"\x10ListMemosRequest\x12 \n" +
|
"\x10ListMemosRequest\x12 \n" +
|
||||||
"\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
|
"\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
|
@ -2061,7 +2070,8 @@ const file_api_v1_memo_service_proto_rawDesc = "" +
|
||||||
"\x05state\x18\x03 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x01R\x05state\x12\x1e\n" +
|
"\x05state\x18\x03 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x01R\x05state\x12\x1e\n" +
|
||||||
"\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\x12\x1b\n" +
|
"\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\x12\x1b\n" +
|
||||||
"\x06filter\x18\x05 \x01(\tB\x03\xe0A\x01R\x06filter\x12&\n" +
|
"\x06filter\x18\x05 \x01(\tB\x03\xe0A\x01R\x06filter\x12&\n" +
|
||||||
"\fshow_deleted\x18\x06 \x01(\bB\x03\xe0A\x01R\vshowDeleted\"\x84\x01\n" +
|
"\fshow_deleted\x18\x06 \x01(\bB\x03\xe0A\x01R\vshowDeleted\x12(\n" +
|
||||||
|
"\rshow_comments\x18\a \x01(\bB\x03\xe0A\x01R\fshowComments\"\x84\x01\n" +
|
||||||
"\x11ListMemosResponse\x12(\n" +
|
"\x11ListMemosResponse\x12(\n" +
|
||||||
"\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" +
|
"\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" +
|
||||||
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
|
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
|
||||||
|
|
|
||||||
|
|
@ -620,6 +620,11 @@ paths:
|
||||||
description: Optional. If true, show deleted memos in the response.
|
description: Optional. If true, show deleted memos in the response.
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
- name: showComments
|
||||||
|
in: query
|
||||||
|
description: Optional. If true, include comment memos in the response.
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR
|
||||||
func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosRequest) (*v1pb.ListMemosResponse, error) {
|
func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosRequest) (*v1pb.ListMemosResponse, error) {
|
||||||
memoFind := &store.FindMemo{
|
memoFind := &store.FindMemo{
|
||||||
// Exclude comments by default.
|
// Exclude comments by default.
|
||||||
ExcludeComments: true,
|
ExcludeComments: !request.ShowComments,
|
||||||
}
|
}
|
||||||
if request.State == v1pb.State_ARCHIVED {
|
if request.State == v1pb.State_ARCHIVED {
|
||||||
state := store.Archived
|
state := store.Archived
|
||||||
|
|
@ -695,7 +695,7 @@ func (s *APIV1Service) RenameMemoTag(ctx context.Context, request *v1pb.RenameMe
|
||||||
memoFind := &store.FindMemo{
|
memoFind := &store.FindMemo{
|
||||||
CreatorID: &user.ID,
|
CreatorID: &user.ID,
|
||||||
Filters: []string{fmt.Sprintf("tag in [\"%s\"]", request.OldTag)},
|
Filters: []string{fmt.Sprintf("tag in [\"%s\"]", request.OldTag)},
|
||||||
ExcludeComments: true,
|
ExcludeComments: false,
|
||||||
}
|
}
|
||||||
if (request.Parent) != "memos/-" {
|
if (request.Parent) != "memos/-" {
|
||||||
memoUID, err := ExtractMemoUIDFromName(request.Parent)
|
memoUID, err := ExtractMemoUIDFromName(request.Parent)
|
||||||
|
|
@ -746,7 +746,7 @@ func (s *APIV1Service) DeleteMemoTag(ctx context.Context, request *v1pb.DeleteMe
|
||||||
CreatorID: &user.ID,
|
CreatorID: &user.ID,
|
||||||
Filters: []string{fmt.Sprintf("tag in [\"%s\"]", request.Tag)},
|
Filters: []string{fmt.Sprintf("tag in [\"%s\"]", request.Tag)},
|
||||||
ExcludeContent: true,
|
ExcludeContent: true,
|
||||||
ExcludeComments: true,
|
ExcludeComments: false,
|
||||||
}
|
}
|
||||||
if request.Parent != "memos/-" {
|
if request.Parent != "memos/-" {
|
||||||
memoUID, err := ExtractMemoUIDFromName(request.Parent)
|
memoUID, err := ExtractMemoUIDFromName(request.Parent)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue