mirror of
https://github.com/usememos/memos.git
synced 2025-03-09 20:13:46 +08:00
chore: implement memo property endpoint
This commit is contained in:
parent
16d3de63c2
commit
e0600388b2
8 changed files with 1123 additions and 654 deletions
|
@ -903,9 +903,15 @@ paths:
|
|||
type: string
|
||||
pinned:
|
||||
type: boolean
|
||||
parentId:
|
||||
type: integer
|
||||
format: int32
|
||||
property:
|
||||
$ref: '#/definitions/v1MemoProperty'
|
||||
readOnly: true
|
||||
parent:
|
||||
type: string
|
||||
description: |-
|
||||
The name of the parent memo.
|
||||
Format: memos/{id}
|
||||
id is the system generated id.
|
||||
readOnly: true
|
||||
resources:
|
||||
type: array
|
||||
|
@ -1280,6 +1286,60 @@ paths:
|
|||
$ref: '#/definitions/v1CreateMemoRequest'
|
||||
tags:
|
||||
- MemoService
|
||||
/api/v1/{name}/properties:
|
||||
get:
|
||||
summary: ListMemoProperties lists memo properties.
|
||||
operationId: MemoService_ListMemoProperties
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v1ListMemoPropertiesResponse'
|
||||
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 list all properties.
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: memos/[^/]+
|
||||
tags:
|
||||
- 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:
|
||||
get:
|
||||
summary: ListMemoReactions lists reactions for a memo.
|
||||
|
@ -1462,36 +1522,6 @@ paths:
|
|||
pattern: users/[^/]+
|
||||
tags:
|
||||
- UserService
|
||||
/api/v1/{name}: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/{parent}/tags:
|
||||
get:
|
||||
summary: ListMemoTags lists tags for a memo.
|
||||
|
@ -2485,6 +2515,14 @@ definitions:
|
|||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/v1Memo'
|
||||
v1ListMemoPropertiesResponse:
|
||||
type: object
|
||||
properties:
|
||||
properties:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/v1MemoProperty'
|
||||
v1ListMemoReactionsResponse:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -2620,9 +2658,15 @@ definitions:
|
|||
type: string
|
||||
pinned:
|
||||
type: boolean
|
||||
parentId:
|
||||
type: integer
|
||||
format: int32
|
||||
property:
|
||||
$ref: '#/definitions/v1MemoProperty'
|
||||
readOnly: true
|
||||
parent:
|
||||
type: string
|
||||
description: |-
|
||||
The name of the parent memo.
|
||||
Format: memos/{id}
|
||||
id is the system generated id.
|
||||
readOnly: true
|
||||
resources:
|
||||
type: array
|
||||
|
@ -2642,6 +2686,17 @@ definitions:
|
|||
type: object
|
||||
$ref: '#/definitions/v1Reaction'
|
||||
readOnly: true
|
||||
v1MemoProperty:
|
||||
type: object
|
||||
properties:
|
||||
tags:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
hasLink:
|
||||
type: boolean
|
||||
hasTaskList:
|
||||
type: boolean
|
||||
v1MemoRelation:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
@ -57,10 +57,14 @@ service MemoService {
|
|||
body: "*"
|
||||
};
|
||||
}
|
||||
// ListMemoProperties lists memo properties.
|
||||
rpc ListMemoProperties(ListMemoPropertiesRequest) returns (ListMemoPropertiesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}/properties"};
|
||||
}
|
||||
// RebuildMemoProperty rebuilds a memo property.
|
||||
rpc RebuildMemoProperty(RebuildMemoPropertyRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{name=memos/*}:rebuild"
|
||||
post: "/api/v1/{name=memos/*}/properties:rebuild"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
@ -181,13 +185,24 @@ message Memo {
|
|||
|
||||
bool pinned = 12;
|
||||
|
||||
optional int32 parent_id = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
MemoProperty property = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated Resource resources = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
// The name of the parent memo.
|
||||
// Format: memos/{id}
|
||||
// id is the system generated id.
|
||||
optional string parent = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated MemoRelation relations = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
repeated Resource resources = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated Reaction reactions = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
repeated MemoRelation relations = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated Reaction reactions = 17 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
|
||||
message MemoProperty {
|
||||
repeated string tags = 1;
|
||||
bool has_link = 2;
|
||||
bool has_task_list = 3;
|
||||
}
|
||||
|
||||
message CreateMemoRequest {
|
||||
|
@ -254,6 +269,16 @@ message ExportMemosResponse {
|
|||
bytes content = 1;
|
||||
}
|
||||
|
||||
message ListMemoPropertiesRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}. Use "memos/-" to list all properties.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListMemoPropertiesResponse {
|
||||
repeated MemoProperty properties = 1;
|
||||
}
|
||||
|
||||
message RebuildMemoPropertyRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}. Use "memos/-" to rebuild all memos.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -359,6 +359,58 @@ func local_request_MemoService_ExportMemos_0(ctx context.Context, marshaler runt
|
|||
|
||||
}
|
||||
|
||||
func request_MemoService_ListMemoProperties_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListMemoPropertiesRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
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.ListMemoProperties(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_MemoService_ListMemoProperties_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListMemoPropertiesRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
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.ListMemoProperties(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1356,6 +1408,31 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_MemoService_ListMemoProperties_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/ListMemoProperties", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/properties"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_MemoService_ListMemoProperties_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_ListMemoProperties_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
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()
|
||||
|
@ -1364,7 +1441,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
|||
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/*}:rebuild"))
|
||||
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
|
||||
|
@ -1901,13 +1978,35 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_MemoService_ListMemoProperties_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/ListMemoProperties", runtime.WithHTTPPathPattern("/api/v1/{name=memos/*}/properties"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_MemoService_ListMemoProperties_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_ListMemoProperties_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
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/*}:rebuild"))
|
||||
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
|
||||
|
@ -2227,7 +2326,9 @@ var (
|
|||
|
||||
pattern_MemoService_ExportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "memos"}, "export"))
|
||||
|
||||
pattern_MemoService_RebuildMemoProperty_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "memos", "name"}, "rebuild"))
|
||||
pattern_MemoService_ListMemoProperties_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"}, ""))
|
||||
|
||||
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_ListMemoTags_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"}, ""))
|
||||
|
||||
|
@ -2271,6 +2372,8 @@ var (
|
|||
|
||||
forward_MemoService_ExportMemos_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_ListMemoProperties_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_RebuildMemoProperty_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_ListMemoTags_0 = runtime.ForwardResponseMessage
|
||||
|
|
|
@ -27,6 +27,7 @@ const (
|
|||
MemoService_UpdateMemo_FullMethodName = "/memos.api.v1.MemoService/UpdateMemo"
|
||||
MemoService_DeleteMemo_FullMethodName = "/memos.api.v1.MemoService/DeleteMemo"
|
||||
MemoService_ExportMemos_FullMethodName = "/memos.api.v1.MemoService/ExportMemos"
|
||||
MemoService_ListMemoProperties_FullMethodName = "/memos.api.v1.MemoService/ListMemoProperties"
|
||||
MemoService_RebuildMemoProperty_FullMethodName = "/memos.api.v1.MemoService/RebuildMemoProperty"
|
||||
MemoService_ListMemoTags_FullMethodName = "/memos.api.v1.MemoService/ListMemoTags"
|
||||
MemoService_RenameMemoTag_FullMethodName = "/memos.api.v1.MemoService/RenameMemoTag"
|
||||
|
@ -61,6 +62,8 @@ type MemoServiceClient interface {
|
|||
DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// ExportMemos exports memos.
|
||||
ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*ExportMemosResponse, error)
|
||||
// ListMemoProperties lists memo properties.
|
||||
ListMemoProperties(ctx context.Context, in *ListMemoPropertiesRequest, opts ...grpc.CallOption) (*ListMemoPropertiesResponse, error)
|
||||
// RebuildMemoProperty rebuilds a memo property.
|
||||
RebuildMemoProperty(ctx context.Context, in *RebuildMemoPropertyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// ListMemoTags lists tags for a memo.
|
||||
|
@ -162,6 +165,15 @@ func (c *memoServiceClient) ExportMemos(ctx context.Context, in *ExportMemosRequ
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) ListMemoProperties(ctx context.Context, in *ListMemoPropertiesRequest, opts ...grpc.CallOption) (*ListMemoPropertiesResponse, error) {
|
||||
out := new(ListMemoPropertiesResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_ListMemoProperties_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) RebuildMemoProperty(ctx context.Context, in *RebuildMemoPropertyRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, MemoService_RebuildMemoProperty_FullMethodName, in, out, opts...)
|
||||
|
@ -306,6 +318,8 @@ type MemoServiceServer interface {
|
|||
DeleteMemo(context.Context, *DeleteMemoRequest) (*emptypb.Empty, error)
|
||||
// ExportMemos exports memos.
|
||||
ExportMemos(context.Context, *ExportMemosRequest) (*ExportMemosResponse, error)
|
||||
// ListMemoProperties lists memo properties.
|
||||
ListMemoProperties(context.Context, *ListMemoPropertiesRequest) (*ListMemoPropertiesResponse, error)
|
||||
// RebuildMemoProperty rebuilds a memo property.
|
||||
RebuildMemoProperty(context.Context, *RebuildMemoPropertyRequest) (*emptypb.Empty, error)
|
||||
// ListMemoTags lists tags for a memo.
|
||||
|
@ -362,6 +376,9 @@ func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoReq
|
|||
func (UnimplementedMemoServiceServer) ExportMemos(context.Context, *ExportMemosRequest) (*ExportMemosResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExportMemos not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) ListMemoProperties(context.Context, *ListMemoPropertiesRequest) (*ListMemoPropertiesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListMemoProperties not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) RebuildMemoProperty(context.Context, *RebuildMemoPropertyRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RebuildMemoProperty not implemented")
|
||||
}
|
||||
|
@ -543,6 +560,24 @@ func _MemoService_ExportMemos_Handler(srv interface{}, ctx context.Context, dec
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_ListMemoProperties_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListMemoPropertiesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MemoServiceServer).ListMemoProperties(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MemoService_ListMemoProperties_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MemoServiceServer).ListMemoProperties(ctx, req.(*ListMemoPropertiesRequest))
|
||||
}
|
||||
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 {
|
||||
|
@ -830,6 +865,10 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "ExportMemos",
|
||||
Handler: _MemoService_ExportMemos_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListMemoProperties",
|
||||
Handler: _MemoService_ListMemoProperties_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RebuildMemoProperty",
|
||||
Handler: _MemoService_RebuildMemoProperty_Handler,
|
||||
|
|
|
@ -777,7 +777,7 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem
|
|||
return nil, errors.Wrap(err, "failed to parse content")
|
||||
}
|
||||
|
||||
return &v1pb.Memo{
|
||||
memoMessage := &v1pb.Memo{
|
||||
Name: name,
|
||||
Uid: memo.UID,
|
||||
RowStatus: convertRowStatusFromStore(memo.RowStatus),
|
||||
|
@ -789,11 +789,29 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem
|
|||
Nodes: convertFromASTNodes(nodes),
|
||||
Visibility: convertVisibilityFromStore(memo.Visibility),
|
||||
Pinned: memo.Pinned,
|
||||
ParentId: memo.ParentID,
|
||||
Relations: listMemoRelationsResponse.Relations,
|
||||
Resources: listMemoResourcesResponse.Resources,
|
||||
Reactions: listMemoReactionsResponse.Reactions,
|
||||
}, nil
|
||||
}
|
||||
if memo.Payload != nil {
|
||||
memoMessage.Property = convertMemoPropertyFromStore(memo.Payload.Property)
|
||||
}
|
||||
if memo.ParentID != nil {
|
||||
parent := fmt.Sprintf("%s%d", MemoNamePrefix, *memo.ParentID)
|
||||
memoMessage.Parent = &parent
|
||||
}
|
||||
return memoMessage, nil
|
||||
}
|
||||
|
||||
func convertMemoPropertyFromStore(property *storepb.MemoPayload_Property) *v1pb.MemoProperty {
|
||||
if property == nil {
|
||||
return nil
|
||||
}
|
||||
return &v1pb.MemoProperty{
|
||||
Tags: property.Tags,
|
||||
HasLink: property.HasLink,
|
||||
HasTaskList: property.HasTaskList,
|
||||
}
|
||||
}
|
||||
|
||||
func convertVisibilityFromStore(visibility store.Visibility) v1pb.Visibility {
|
||||
|
|
|
@ -9,7 +9,7 @@ import MemoView from "@/components/MemoView";
|
|||
import MobileHeader from "@/components/MobileHeader";
|
||||
import useCurrentUser from "@/hooks/useCurrentUser";
|
||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||
import { MemoNamePrefix, useMemoStore } from "@/store/v1";
|
||||
import { useMemoStore } from "@/store/v1";
|
||||
import { MemoRelation_Type } from "@/types/proto/api/v1/memo_relation_service";
|
||||
import { Memo } from "@/types/proto/api/v1/memo_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
|
@ -46,8 +46,8 @@ const MemoDetail = () => {
|
|||
}
|
||||
|
||||
(async () => {
|
||||
if (memo.parentId) {
|
||||
memoStore.getOrFetchMemoByName(`${MemoNamePrefix}${memo.parentId}`).then((memo: Memo) => {
|
||||
if (memo.parent) {
|
||||
memoStore.getOrFetchMemoByName(memo.parent).then((memo: Memo) => {
|
||||
setParentMemo(memo);
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -160,25 +160,13 @@ const Timeline = () => {
|
|||
</div>
|
||||
|
||||
<div className={clsx("w-full flex flex-col justify-start items-start")}>
|
||||
{sortedMemos.map((memo, index) => (
|
||||
<div
|
||||
{sortedMemos.map((memo) => (
|
||||
<MemoView
|
||||
key={`${memo.name}-${memo.displayTime}`}
|
||||
className={clsx("relative w-full flex flex-col justify-start items-start pl-4 sm:pl-10 pt-0")}
|
||||
>
|
||||
<MemoView
|
||||
className="!border max-w-full !border-gray-100 dark:!border-zinc-700"
|
||||
memo={memo}
|
||||
displayTimeFormat="time"
|
||||
/>
|
||||
<div className="absolute -left-2 sm:left-2 top-4 h-full">
|
||||
{index !== sortedMemos.length - 1 && (
|
||||
<div className="absolute top-2 left-[7px] h-full w-0.5 bg-gray-200 dark:bg-gray-700 block"></div>
|
||||
)}
|
||||
<div className="border-4 rounded-full border-white relative dark:border-zinc-800">
|
||||
<Icon.Circle className="w-2 h-auto bg-gray-200 text-gray-200 dark:bg-gray-700 dark:text-gray-700 rounded-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
className="!border w-full !border-gray-100 dark:!border-zinc-700"
|
||||
memo={memo}
|
||||
displayTimeFormat="time"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue