mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: tweak user statistics view
This commit is contained in:
@ -51,13 +51,6 @@ service MemoService {
|
|||||||
option (google.api.http) = {delete: "/api/v1/{name=memos/*}"};
|
option (google.api.http) = {delete: "/api/v1/{name=memos/*}"};
|
||||||
option (google.api.method_signature) = "name";
|
option (google.api.method_signature) = "name";
|
||||||
}
|
}
|
||||||
// RebuildMemoProperty rebuilds a memo property.
|
|
||||||
rpc RebuildMemoProperty(RebuildMemoPropertyRequest) returns (google.protobuf.Empty) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/api/v1/{name=memos/*}/properties:rebuild"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// RenameMemoTag renames a tag for a memo.
|
// RenameMemoTag renames a tag for a memo.
|
||||||
rpc RenameMemoTag(RenameMemoTagRequest) returns (google.protobuf.Empty) {
|
rpc RenameMemoTag(RenameMemoTagRequest) returns (google.protobuf.Empty) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
@ -268,12 +261,6 @@ message DeleteMemoRequest {
|
|||||||
string name = 1;
|
string name = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RebuildMemoPropertyRequest {
|
|
||||||
// The name of the memo.
|
|
||||||
// Format: memos/{id}. Use "memos/-" to rebuild all memos.
|
|
||||||
string name = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RenameMemoTagRequest {
|
message RenameMemoTagRequest {
|
||||||
// The parent, who owns the tags.
|
// The parent, who owns the tags.
|
||||||
// Format: memos/{id}. Use "memos/-" to rename all tags.
|
// Format: memos/{id}. Use "memos/-" to rename all tags.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -349,66 +349,6 @@ func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runti
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func request_MemoService_RebuildMemoProperty_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq RebuildMemoPropertyRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
val string
|
|
||||||
ok bool
|
|
||||||
err error
|
|
||||||
_ = err
|
|
||||||
)
|
|
||||||
|
|
||||||
val, ok = pathParams["name"]
|
|
||||||
if !ok {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
|
||||||
}
|
|
||||||
|
|
||||||
protoReq.Name, err = runtime.String(val)
|
|
||||||
if err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := client.RebuildMemoProperty(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_MemoService_RebuildMemoProperty_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq RebuildMemoPropertyRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
val string
|
|
||||||
ok bool
|
|
||||||
err error
|
|
||||||
_ = err
|
|
||||||
)
|
|
||||||
|
|
||||||
val, ok = pathParams["name"]
|
|
||||||
if !ok {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
|
||||||
}
|
|
||||||
|
|
||||||
protoReq.Name, err = runtime.String(val)
|
|
||||||
if err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.RebuildMemoProperty(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_MemoService_RenameMemoTag_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_MemoService_RenameMemoTag_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq RenameMemoTagRequest
|
var protoReq RenameMemoTagRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -1216,31 +1156,6 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle("POST", pattern_MemoService_RebuildMemoProperty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
var err error
|
|
||||||
var annotatedContext context.Context
|
|
||||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MemoService/RebuildMemoProperty", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/properties:rebuild"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_MemoService_RebuildMemoProperty_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_MemoService_RebuildMemoProperty_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PATCH", pattern_MemoService_RenameMemoTag_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle("PATCH", pattern_MemoService_RenameMemoTag_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -1689,28 +1604,6 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mux.Handle("POST", pattern_MemoService_RebuildMemoProperty_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
var err error
|
|
||||||
var annotatedContext context.Context
|
|
||||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MemoService/RebuildMemoProperty", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/properties:rebuild"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_MemoService_RebuildMemoProperty_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_MemoService_RebuildMemoProperty_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PATCH", pattern_MemoService_RenameMemoTag_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle("PATCH", pattern_MemoService_RenameMemoTag_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -1969,8 +1862,6 @@ var (
|
|||||||
|
|
||||||
pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "memos", "name"}, ""))
|
pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "memos", "name"}, ""))
|
||||||
|
|
||||||
pattern_MemoService_RebuildMemoProperty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "name", "properties"}, "rebuild"))
|
|
||||||
|
|
||||||
pattern_MemoService_RenameMemoTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "parent", "tags"}, "rename"))
|
pattern_MemoService_RenameMemoTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "memos", "parent", "tags"}, "rename"))
|
||||||
|
|
||||||
pattern_MemoService_DeleteMemoTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "memos", "parent", "tags", "tag"}, ""))
|
pattern_MemoService_DeleteMemoTag_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "memos", "parent", "tags", "tag"}, ""))
|
||||||
@ -2007,8 +1898,6 @@ var (
|
|||||||
|
|
||||||
forward_MemoService_DeleteMemo_0 = runtime.ForwardResponseMessage
|
forward_MemoService_DeleteMemo_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_MemoService_RebuildMemoProperty_0 = runtime.ForwardResponseMessage
|
|
||||||
|
|
||||||
forward_MemoService_RenameMemoTag_0 = runtime.ForwardResponseMessage
|
forward_MemoService_RenameMemoTag_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
forward_MemoService_DeleteMemoTag_0 = runtime.ForwardResponseMessage
|
forward_MemoService_DeleteMemoTag_0 = runtime.ForwardResponseMessage
|
||||||
|
@ -20,24 +20,23 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MemoService_CreateMemo_FullMethodName = "/memos.api.v1.MemoService/CreateMemo"
|
MemoService_CreateMemo_FullMethodName = "/memos.api.v1.MemoService/CreateMemo"
|
||||||
MemoService_ListMemos_FullMethodName = "/memos.api.v1.MemoService/ListMemos"
|
MemoService_ListMemos_FullMethodName = "/memos.api.v1.MemoService/ListMemos"
|
||||||
MemoService_GetMemo_FullMethodName = "/memos.api.v1.MemoService/GetMemo"
|
MemoService_GetMemo_FullMethodName = "/memos.api.v1.MemoService/GetMemo"
|
||||||
MemoService_GetMemoByUid_FullMethodName = "/memos.api.v1.MemoService/GetMemoByUid"
|
MemoService_GetMemoByUid_FullMethodName = "/memos.api.v1.MemoService/GetMemoByUid"
|
||||||
MemoService_UpdateMemo_FullMethodName = "/memos.api.v1.MemoService/UpdateMemo"
|
MemoService_UpdateMemo_FullMethodName = "/memos.api.v1.MemoService/UpdateMemo"
|
||||||
MemoService_DeleteMemo_FullMethodName = "/memos.api.v1.MemoService/DeleteMemo"
|
MemoService_DeleteMemo_FullMethodName = "/memos.api.v1.MemoService/DeleteMemo"
|
||||||
MemoService_RebuildMemoProperty_FullMethodName = "/memos.api.v1.MemoService/RebuildMemoProperty"
|
MemoService_RenameMemoTag_FullMethodName = "/memos.api.v1.MemoService/RenameMemoTag"
|
||||||
MemoService_RenameMemoTag_FullMethodName = "/memos.api.v1.MemoService/RenameMemoTag"
|
MemoService_DeleteMemoTag_FullMethodName = "/memos.api.v1.MemoService/DeleteMemoTag"
|
||||||
MemoService_DeleteMemoTag_FullMethodName = "/memos.api.v1.MemoService/DeleteMemoTag"
|
MemoService_SetMemoResources_FullMethodName = "/memos.api.v1.MemoService/SetMemoResources"
|
||||||
MemoService_SetMemoResources_FullMethodName = "/memos.api.v1.MemoService/SetMemoResources"
|
MemoService_ListMemoResources_FullMethodName = "/memos.api.v1.MemoService/ListMemoResources"
|
||||||
MemoService_ListMemoResources_FullMethodName = "/memos.api.v1.MemoService/ListMemoResources"
|
MemoService_SetMemoRelations_FullMethodName = "/memos.api.v1.MemoService/SetMemoRelations"
|
||||||
MemoService_SetMemoRelations_FullMethodName = "/memos.api.v1.MemoService/SetMemoRelations"
|
MemoService_ListMemoRelations_FullMethodName = "/memos.api.v1.MemoService/ListMemoRelations"
|
||||||
MemoService_ListMemoRelations_FullMethodName = "/memos.api.v1.MemoService/ListMemoRelations"
|
MemoService_CreateMemoComment_FullMethodName = "/memos.api.v1.MemoService/CreateMemoComment"
|
||||||
MemoService_CreateMemoComment_FullMethodName = "/memos.api.v1.MemoService/CreateMemoComment"
|
MemoService_ListMemoComments_FullMethodName = "/memos.api.v1.MemoService/ListMemoComments"
|
||||||
MemoService_ListMemoComments_FullMethodName = "/memos.api.v1.MemoService/ListMemoComments"
|
MemoService_ListMemoReactions_FullMethodName = "/memos.api.v1.MemoService/ListMemoReactions"
|
||||||
MemoService_ListMemoReactions_FullMethodName = "/memos.api.v1.MemoService/ListMemoReactions"
|
MemoService_UpsertMemoReaction_FullMethodName = "/memos.api.v1.MemoService/UpsertMemoReaction"
|
||||||
MemoService_UpsertMemoReaction_FullMethodName = "/memos.api.v1.MemoService/UpsertMemoReaction"
|
MemoService_DeleteMemoReaction_FullMethodName = "/memos.api.v1.MemoService/DeleteMemoReaction"
|
||||||
MemoService_DeleteMemoReaction_FullMethodName = "/memos.api.v1.MemoService/DeleteMemoReaction"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MemoServiceClient is the client API for MemoService service.
|
// MemoServiceClient is the client API for MemoService service.
|
||||||
@ -56,8 +55,6 @@ type MemoServiceClient interface {
|
|||||||
UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*Memo, error)
|
UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*Memo, error)
|
||||||
// DeleteMemo deletes a memo.
|
// DeleteMemo deletes a memo.
|
||||||
DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
// RebuildMemoProperty rebuilds a memo property.
|
|
||||||
RebuildMemoProperty(ctx context.Context, in *RebuildMemoPropertyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
// RenameMemoTag renames a tag for a memo.
|
// RenameMemoTag renames a tag for a memo.
|
||||||
RenameMemoTag(ctx context.Context, in *RenameMemoTagRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
RenameMemoTag(ctx context.Context, in *RenameMemoTagRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
// DeleteMemoTag deletes a tag for a memo.
|
// DeleteMemoTag deletes a tag for a memo.
|
||||||
@ -150,16 +147,6 @@ func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoReques
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *memoServiceClient) RebuildMemoProperty(ctx context.Context, in *RebuildMemoPropertyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, MemoService_RebuildMemoProperty_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *memoServiceClient) RenameMemoTag(ctx context.Context, in *RenameMemoTagRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
func (c *memoServiceClient) RenameMemoTag(ctx context.Context, in *RenameMemoTagRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(emptypb.Empty)
|
out := new(emptypb.Empty)
|
||||||
@ -286,8 +273,6 @@ type MemoServiceServer interface {
|
|||||||
UpdateMemo(context.Context, *UpdateMemoRequest) (*Memo, error)
|
UpdateMemo(context.Context, *UpdateMemoRequest) (*Memo, error)
|
||||||
// DeleteMemo deletes a memo.
|
// DeleteMemo deletes a memo.
|
||||||
DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error)
|
DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error)
|
||||||
// RebuildMemoProperty rebuilds a memo property.
|
|
||||||
RebuildMemoProperty(context.Context, *RebuildMemoPropertyRequest) (*emptypb.Empty, error)
|
|
||||||
// RenameMemoTag renames a tag for a memo.
|
// RenameMemoTag renames a tag for a memo.
|
||||||
RenameMemoTag(context.Context, *RenameMemoTagRequest) (*emptypb.Empty, error)
|
RenameMemoTag(context.Context, *RenameMemoTagRequest) (*emptypb.Empty, error)
|
||||||
// DeleteMemoTag deletes a tag for a memo.
|
// DeleteMemoTag deletes a tag for a memo.
|
||||||
@ -338,9 +323,6 @@ func (UnimplementedMemoServiceServer) UpdateMemo(context.Context, *UpdateMemoReq
|
|||||||
func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error) {
|
func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteMemo not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method DeleteMemo not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedMemoServiceServer) RebuildMemoProperty(context.Context, *RebuildMemoPropertyRequest) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RebuildMemoProperty not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedMemoServiceServer) RenameMemoTag(context.Context, *RenameMemoTagRequest) (*emptypb.Empty, error) {
|
func (UnimplementedMemoServiceServer) RenameMemoTag(context.Context, *RenameMemoTagRequest) (*emptypb.Empty, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RenameMemoTag not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method RenameMemoTag not implemented")
|
||||||
}
|
}
|
||||||
@ -503,24 +485,6 @@ func _MemoService_DeleteMemo_Handler(srv interface{}, ctx context.Context, dec f
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _MemoService_RebuildMemoProperty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(RebuildMemoPropertyRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(MemoServiceServer).RebuildMemoProperty(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: MemoService_RebuildMemoProperty_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(MemoServiceServer).RebuildMemoProperty(ctx, req.(*RebuildMemoPropertyRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _MemoService_RenameMemoTag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _MemoService_RenameMemoTag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(RenameMemoTagRequest)
|
in := new(RenameMemoTagRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -750,10 +714,6 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "DeleteMemo",
|
MethodName: "DeleteMemo",
|
||||||
Handler: _MemoService_DeleteMemo_Handler,
|
Handler: _MemoService_DeleteMemo_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "RebuildMemoProperty",
|
|
||||||
Handler: _MemoService_RebuildMemoProperty_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "RenameMemoTag",
|
MethodName: "RenameMemoTag",
|
||||||
Handler: _MemoService_RenameMemoTag_Handler,
|
Handler: _MemoService_RenameMemoTag_Handler,
|
||||||
|
@ -1278,36 +1278,6 @@ paths:
|
|||||||
$ref: '#/definitions/v1CreateMemoRequest'
|
$ref: '#/definitions/v1CreateMemoRequest'
|
||||||
tags:
|
tags:
|
||||||
- MemoService
|
- MemoService
|
||||||
/api/v1/{name}/properties:rebuild:
|
|
||||||
post:
|
|
||||||
summary: RebuildMemoProperty rebuilds a memo property.
|
|
||||||
operationId: MemoService_RebuildMemoProperty
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: A successful response.
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties: {}
|
|
||||||
default:
|
|
||||||
description: An unexpected error response.
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/googlerpcStatus'
|
|
||||||
parameters:
|
|
||||||
- name: name
|
|
||||||
description: |-
|
|
||||||
The name of the memo.
|
|
||||||
Format: memos/{id}. Use "memos/-" to rebuild all memos.
|
|
||||||
in: path
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
pattern: memos/[^/]+
|
|
||||||
- name: body
|
|
||||||
in: body
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/MemoServiceRebuildMemoPropertyBody'
|
|
||||||
tags:
|
|
||||||
- MemoService
|
|
||||||
/api/v1/{name}/reactions:
|
/api/v1/{name}/reactions:
|
||||||
get:
|
get:
|
||||||
summary: ListMemoReactions lists reactions for a memo.
|
summary: ListMemoReactions lists reactions for a memo.
|
||||||
@ -1782,8 +1752,6 @@ definitions:
|
|||||||
- UNORDERED
|
- UNORDERED
|
||||||
- DESCRIPTION
|
- DESCRIPTION
|
||||||
default: KIND_UNSPECIFIED
|
default: KIND_UNSPECIFIED
|
||||||
MemoServiceRebuildMemoPropertyBody:
|
|
||||||
type: object
|
|
||||||
MemoServiceRenameMemoTagBody:
|
MemoServiceRenameMemoTagBody:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -536,48 +536,6 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM
|
|||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *APIV1Service) RebuildMemoProperty(ctx context.Context, request *v1pb.RebuildMemoPropertyRequest) (*emptypb.Empty, error) {
|
|
||||||
user, err := s.GetCurrentUser(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Errorf(codes.Internal, "failed to get current user")
|
|
||||||
}
|
|
||||||
|
|
||||||
normalRowStatus := store.Normal
|
|
||||||
memoFind := &store.FindMemo{
|
|
||||||
CreatorID: &user.ID,
|
|
||||||
RowStatus: &normalRowStatus,
|
|
||||||
ExcludeComments: true,
|
|
||||||
}
|
|
||||||
if (request.Name) != "memos/-" {
|
|
||||||
memoID, err := ExtractMemoIDFromName(request.Name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Errorf(codes.InvalidArgument, "invalid memo name: %v", err)
|
|
||||||
}
|
|
||||||
memoFind.ID = &memoID
|
|
||||||
}
|
|
||||||
|
|
||||||
memos, err := s.Store.ListMemos(ctx, memoFind)
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Errorf(codes.Internal, "failed to list memos")
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, memo := range memos {
|
|
||||||
property, err := memoproperty.GetMemoPropertyFromContent(memo.Content)
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Errorf(codes.Internal, "failed to get memo property: %v", err)
|
|
||||||
}
|
|
||||||
memo.Payload.Property = property
|
|
||||||
if err := s.Store.UpdateMemo(ctx, &store.UpdateMemo{
|
|
||||||
ID: memo.ID,
|
|
||||||
Payload: memo.Payload,
|
|
||||||
}); err != nil {
|
|
||||||
return nil, status.Errorf(codes.Internal, "failed to update memo")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &emptypb.Empty{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *APIV1Service) RenameMemoTag(ctx context.Context, request *v1pb.RenameMemoTagRequest) (*emptypb.Empty, error) {
|
func (s *APIV1Service) RenameMemoTag(ctx context.Context, request *v1pb.RenameMemoTagRequest) (*emptypb.Empty, error) {
|
||||||
user, err := s.GetCurrentUser(ctx)
|
user, err := s.GetCurrentUser(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Divider, Tooltip } from "@mui/joy";
|
import { Divider, IconButton, Tooltip } from "@mui/joy";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { countBy } from "lodash-es";
|
import { countBy } from "lodash-es";
|
||||||
@ -11,11 +11,8 @@ import {
|
|||||||
LinkIcon,
|
LinkIcon,
|
||||||
ListTodoIcon,
|
ListTodoIcon,
|
||||||
MoreVerticalIcon,
|
MoreVerticalIcon,
|
||||||
RefreshCcwIcon,
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
|
||||||
import { memoServiceClient } from "@/grpcweb";
|
|
||||||
import useAsyncEffect from "@/hooks/useAsyncEffect";
|
import useAsyncEffect from "@/hooks/useAsyncEffect";
|
||||||
import useCurrentUser from "@/hooks/useCurrentUser";
|
import useCurrentUser from "@/hooks/useCurrentUser";
|
||||||
import i18n from "@/i18n";
|
import i18n from "@/i18n";
|
||||||
@ -66,14 +63,6 @@ const UserStatisticsView = () => {
|
|||||||
setActivityStats(countBy(metadataList.map((memo) => dayjs(memo.displayTime).format("YYYY-MM-DD"))));
|
setActivityStats(countBy(metadataList.map((memo) => dayjs(memo.displayTime).format("YYYY-MM-DD"))));
|
||||||
}, [memoMetadataStore.stateId]);
|
}, [memoMetadataStore.stateId]);
|
||||||
|
|
||||||
const rebuildMemoProperty = async () => {
|
|
||||||
await memoServiceClient.rebuildMemoProperty({
|
|
||||||
name: "memos/-",
|
|
||||||
});
|
|
||||||
toast.success("Rebuild memo properties successfully.");
|
|
||||||
window.location.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onCalendarClick = (date: string) => {
|
const onCalendarClick = (date: string) => {
|
||||||
memoFilterStore.removeFilter((f) => f.factor === "displayTime");
|
memoFilterStore.removeFilter((f) => f.factor === "displayTime");
|
||||||
memoFilterStore.addFilter({ factor: "displayTime", value: date });
|
memoFilterStore.addFilter({ factor: "displayTime", value: date });
|
||||||
@ -94,23 +83,17 @@ const UserStatisticsView = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="invisible group-hover:visible flex justify-end items-center">
|
<div className="invisible group-hover:visible flex justify-end items-center">
|
||||||
<ChevronLeftIcon
|
|
||||||
className="w-4 h-auto shrink-0 opacity-60"
|
|
||||||
onClick={() => setVisibleMonthString(dayjs(visibleMonthString).subtract(1, "month").format("YYYY-MM"))}
|
|
||||||
/>
|
|
||||||
<ChevronRightIcon
|
|
||||||
className="w-4 h-auto shrink-0 opacity-60"
|
|
||||||
onClick={() => setVisibleMonthString(dayjs(visibleMonthString).add(1, "month").format("YYYY-MM"))}
|
|
||||||
/>
|
|
||||||
<Popover>
|
<Popover>
|
||||||
<PopoverTrigger>
|
<PopoverTrigger>
|
||||||
<MoreVerticalIcon className="w-4 h-auto shrink-0 opacity-60" />
|
<MoreVerticalIcon className="w-4 h-auto shrink-0 opacity-60" />
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent align="end" alignOffset={-12}>
|
<PopoverContent className="flex flex-row justify-end items-center" align="end" alignOffset={-12}>
|
||||||
<button className="w-auto flex flex-row justify-between items-center gap-2 hover:opacity-80" onClick={rebuildMemoProperty}>
|
<IconButton size="sm" onClick={() => setVisibleMonthString(dayjs(visibleMonthString).subtract(1, "month").format("YYYY-MM"))}>
|
||||||
<RefreshCcwIcon className="text-gray-400 w-4 h-auto cursor-pointer opacity-60" />
|
<ChevronLeftIcon className="w-5 h-auto shrink-0 opacity-60" />
|
||||||
<span className="text-sm shrink-0 text-gray-500 dark:text-gray-400">Rebuild properties</span>
|
</IconButton>
|
||||||
</button>
|
<IconButton size="sm" onClick={() => setVisibleMonthString(dayjs(visibleMonthString).add(1, "month").format("YYYY-MM"))}>
|
||||||
|
<ChevronRightIcon className="w-5 h-auto shrink-0 opacity-60" />
|
||||||
|
</IconButton>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user