Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
a8ea2806
Commit
a8ea2806
authored
Aug 28, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: retire export memos
parent
9bea6e1e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
455 additions
and
811 deletions
+455
-811
apidocs.swagger.yaml
docs/apidocs.swagger.yaml
+0
-33
memo_service.proto
proto/api/v1/memo_service.proto
+0
-16
memo_service.pb.go
proto/gen/api/v1/memo_service.pb.go
+455
-592
memo_service.pb.gw.go
proto/gen/api/v1/memo_service.pb.gw.go
+0
-77
memo_service_grpc.pb.go
proto/gen/api/v1/memo_service_grpc.pb.go
+0
-40
memo_service.go
server/router/api/v1/memo_service.go
+0
-43
MyAccountSection.tsx
web/src/components/Settings/MyAccountSection.tsx
+0
-10
No files found.
docs/apidocs.swagger.yaml
View file @
a8ea2806
...
@@ -356,27 +356,6 @@ paths:
...
@@ -356,27 +356,6 @@ paths:
type
:
string
type
:
string
tags
:
tags
:
-
MemoService
-
MemoService
/api/v1/memos:export
:
post
:
summary
:
ExportMemos exports memos.
operationId
:
MemoService_ExportMemos
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v1ExportMemosResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
body
in
:
body
required
:
true
schema
:
$ref
:
'
#/definitions/v1ExportMemosRequest'
tags
:
-
MemoService
/api/v1/reactions/{reactionId}
:
/api/v1/reactions/{reactionId}
:
delete
:
delete
:
summary
:
DeleteMemoReaction deletes a reaction for a memo.
summary
:
DeleteMemoReaction deletes a reaction for a memo.
...
@@ -2381,18 +2360,6 @@ definitions:
...
@@ -2381,18 +2360,6 @@ definitions:
properties
:
properties
:
symbol
:
symbol
:
type
:
string
type
:
string
v1ExportMemosRequest
:
type
:
object
properties
:
filter
:
type
:
string
title
:
Same as ListMemosRequest.filter
v1ExportMemosResponse
:
type
:
object
properties
:
content
:
type
:
string
format
:
byte
v1HTMLElementNode
:
v1HTMLElementNode
:
type
:
object
type
:
object
properties
:
properties
:
...
...
proto/api/v1/memo_service.proto
View file @
a8ea2806
...
@@ -51,13 +51,6 @@ service MemoService {
...
@@ -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"
;
}
}
// ExportMemos exports memos.
rpc
ExportMemos
(
ExportMemosRequest
)
returns
(
ExportMemosResponse
)
{
option
(
google.api.http
)
=
{
post
:
"/api/v1/memos:export"
body
:
"*"
};
}
// ListMemoProperties lists memo properties.
// ListMemoProperties lists memo properties.
rpc
ListMemoProperties
(
ListMemoPropertiesRequest
)
returns
(
ListMemoPropertiesResponse
)
{
rpc
ListMemoProperties
(
ListMemoPropertiesRequest
)
returns
(
ListMemoPropertiesResponse
)
{
option
(
google.api.http
)
=
{
get
:
"/api/v1/{name=memos/*}/properties"
};
option
(
google.api.http
)
=
{
get
:
"/api/v1/{name=memos/*}/properties"
};
...
@@ -260,15 +253,6 @@ message DeleteMemoRequest {
...
@@ -260,15 +253,6 @@ message DeleteMemoRequest {
string
name
=
1
;
string
name
=
1
;
}
}
message
ExportMemosRequest
{
// Same as ListMemosRequest.filter
string
filter
=
1
;
}
message
ExportMemosResponse
{
bytes
content
=
1
;
}
message
ListMemoPropertiesRequest
{
message
ListMemoPropertiesRequest
{
// The name of the memo.
// The name of the memo.
// Format: memos/{id}. Use "memos/-" to list all properties.
// Format: memos/{id}. Use "memos/-" to list all properties.
...
...
proto/gen/api/v1/memo_service.pb.go
View file @
a8ea2806
This source diff could not be displayed because it is too large. You can
view the blob
instead.
proto/gen/api/v1/memo_service.pb.gw.go
View file @
a8ea2806
...
@@ -349,32 +349,6 @@ func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runti
...
@@ -349,32 +349,6 @@ func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runti
}
}
func
request_MemoService_ExportMemos_0
(
ctx
context
.
Context
,
marshaler
runtime
.
Marshaler
,
client
MemoServiceClient
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
(
proto
.
Message
,
runtime
.
ServerMetadata
,
error
)
{
var
protoReq
ExportMemosRequest
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
)
}
msg
,
err
:=
client
.
ExportMemos
(
ctx
,
&
protoReq
,
grpc
.
Header
(
&
metadata
.
HeaderMD
),
grpc
.
Trailer
(
&
metadata
.
TrailerMD
))
return
msg
,
metadata
,
err
}
func
local_request_MemoService_ExportMemos_0
(
ctx
context
.
Context
,
marshaler
runtime
.
Marshaler
,
server
MemoServiceServer
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
(
proto
.
Message
,
runtime
.
ServerMetadata
,
error
)
{
var
protoReq
ExportMemosRequest
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
)
}
msg
,
err
:=
server
.
ExportMemos
(
ctx
,
&
protoReq
)
return
msg
,
metadata
,
err
}
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
)
{
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
protoReq
ListMemoPropertiesRequest
var
metadata
runtime
.
ServerMetadata
var
metadata
runtime
.
ServerMetadata
...
@@ -1364,31 +1338,6 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
...
@@ -1364,31 +1338,6 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
})
})
mux
.
Handle
(
"POST"
,
pattern_MemoService_ExportMemos_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/ExportMemos"
,
runtime
.
WithHTTPPathPattern
(
"/api/v1/memos:export"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
}
resp
,
md
,
err
:=
local_request_MemoService_ExportMemos_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_ExportMemos_0
(
annotatedContext
,
mux
,
outboundMarshaler
,
w
,
req
,
resp
,
mux
.
GetForwardResponseOptions
()
...
)
})
mux
.
Handle
(
"GET"
,
pattern_MemoService_ListMemoProperties_0
,
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
{
mux
.
Handle
(
"GET"
,
pattern_MemoService_ListMemoProperties_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
()
...
@@ -1912,28 +1861,6 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
...
@@ -1912,28 +1861,6 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
})
})
mux
.
Handle
(
"POST"
,
pattern_MemoService_ExportMemos_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/ExportMemos"
,
runtime
.
WithHTTPPathPattern
(
"/api/v1/memos:export"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
}
resp
,
md
,
err
:=
request_MemoService_ExportMemos_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_ExportMemos_0
(
annotatedContext
,
mux
,
outboundMarshaler
,
w
,
req
,
resp
,
mux
.
GetForwardResponseOptions
()
...
)
})
mux
.
Handle
(
"GET"
,
pattern_MemoService_ListMemoProperties_0
,
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
{
mux
.
Handle
(
"GET"
,
pattern_MemoService_ListMemoProperties_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
()
...
@@ -2258,8 +2185,6 @@ var (
...
@@ -2258,8 +2185,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_ExportMemos_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
},
[]
string
{
"api"
,
"v1"
,
"memos"
},
"export"
))
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_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_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"
))
...
@@ -2302,8 +2227,6 @@ var (
...
@@ -2302,8 +2227,6 @@ var (
forward_MemoService_DeleteMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_DeleteMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_ExportMemos_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_ListMemoProperties_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_ListMemoProperties_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_RebuildMemoProperty_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_RebuildMemoProperty_0
=
runtime
.
ForwardResponseMessage
...
...
proto/gen/api/v1/memo_service_grpc.pb.go
View file @
a8ea2806
...
@@ -26,7 +26,6 @@ const (
...
@@ -26,7 +26,6 @@ const (
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_ExportMemos_FullMethodName
=
"/memos.api.v1.MemoService/ExportMemos"
MemoService_ListMemoProperties_FullMethodName
=
"/memos.api.v1.MemoService/ListMemoProperties"
MemoService_ListMemoProperties_FullMethodName
=
"/memos.api.v1.MemoService/ListMemoProperties"
MemoService_RebuildMemoProperty_FullMethodName
=
"/memos.api.v1.MemoService/RebuildMemoProperty"
MemoService_RebuildMemoProperty_FullMethodName
=
"/memos.api.v1.MemoService/RebuildMemoProperty"
MemoService_ListMemoTags_FullMethodName
=
"/memos.api.v1.MemoService/ListMemoTags"
MemoService_ListMemoTags_FullMethodName
=
"/memos.api.v1.MemoService/ListMemoTags"
...
@@ -59,8 +58,6 @@ type MemoServiceClient interface {
...
@@ -59,8 +58,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
)
// ExportMemos exports memos.
ExportMemos
(
ctx
context
.
Context
,
in
*
ExportMemosRequest
,
opts
...
grpc
.
CallOption
)
(
*
ExportMemosResponse
,
error
)
// ListMemoProperties lists memo properties.
// ListMemoProperties lists memo properties.
ListMemoProperties
(
ctx
context
.
Context
,
in
*
ListMemoPropertiesRequest
,
opts
...
grpc
.
CallOption
)
(
*
ListMemoPropertiesResponse
,
error
)
ListMemoProperties
(
ctx
context
.
Context
,
in
*
ListMemoPropertiesRequest
,
opts
...
grpc
.
CallOption
)
(
*
ListMemoPropertiesResponse
,
error
)
// RebuildMemoProperty rebuilds a memo property.
// RebuildMemoProperty rebuilds a memo property.
...
@@ -159,16 +156,6 @@ func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoReques
...
@@ -159,16 +156,6 @@ func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoReques
return
out
,
nil
return
out
,
nil
}
}
func
(
c
*
memoServiceClient
)
ExportMemos
(
ctx
context
.
Context
,
in
*
ExportMemosRequest
,
opts
...
grpc
.
CallOption
)
(
*
ExportMemosResponse
,
error
)
{
cOpts
:=
append
([]
grpc
.
CallOption
{
grpc
.
StaticMethod
()},
opts
...
)
out
:=
new
(
ExportMemosResponse
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
MemoService_ExportMemos_FullMethodName
,
in
,
out
,
cOpts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
memoServiceClient
)
ListMemoProperties
(
ctx
context
.
Context
,
in
*
ListMemoPropertiesRequest
,
opts
...
grpc
.
CallOption
)
(
*
ListMemoPropertiesResponse
,
error
)
{
func
(
c
*
memoServiceClient
)
ListMemoProperties
(
ctx
context
.
Context
,
in
*
ListMemoPropertiesRequest
,
opts
...
grpc
.
CallOption
)
(
*
ListMemoPropertiesResponse
,
error
)
{
cOpts
:=
append
([]
grpc
.
CallOption
{
grpc
.
StaticMethod
()},
opts
...
)
cOpts
:=
append
([]
grpc
.
CallOption
{
grpc
.
StaticMethod
()},
opts
...
)
out
:=
new
(
ListMemoPropertiesResponse
)
out
:=
new
(
ListMemoPropertiesResponse
)
...
@@ -325,8 +312,6 @@ type MemoServiceServer interface {
...
@@ -325,8 +312,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
)
// ExportMemos exports memos.
ExportMemos
(
context
.
Context
,
*
ExportMemosRequest
)
(
*
ExportMemosResponse
,
error
)
// ListMemoProperties lists memo properties.
// ListMemoProperties lists memo properties.
ListMemoProperties
(
context
.
Context
,
*
ListMemoPropertiesRequest
)
(
*
ListMemoPropertiesResponse
,
error
)
ListMemoProperties
(
context
.
Context
,
*
ListMemoPropertiesRequest
)
(
*
ListMemoPropertiesResponse
,
error
)
// RebuildMemoProperty rebuilds a memo property.
// RebuildMemoProperty rebuilds a memo property.
...
@@ -383,9 +368,6 @@ func (UnimplementedMemoServiceServer) UpdateMemo(context.Context, *UpdateMemoReq
...
@@ -383,9 +368,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
)
ExportMemos
(
context
.
Context
,
*
ExportMemosRequest
)
(
*
ExportMemosResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method ExportMemos not implemented"
)
}
func
(
UnimplementedMemoServiceServer
)
ListMemoProperties
(
context
.
Context
,
*
ListMemoPropertiesRequest
)
(
*
ListMemoPropertiesResponse
,
error
)
{
func
(
UnimplementedMemoServiceServer
)
ListMemoProperties
(
context
.
Context
,
*
ListMemoPropertiesRequest
)
(
*
ListMemoPropertiesResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method ListMemoProperties not implemented"
)
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method ListMemoProperties not implemented"
)
}
}
...
@@ -557,24 +539,6 @@ func _MemoService_DeleteMemo_Handler(srv interface{}, ctx context.Context, dec f
...
@@ -557,24 +539,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_ExportMemos_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
ExportMemosRequest
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
MemoServiceServer
)
.
ExportMemos
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
MemoService_ExportMemos_FullMethodName
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
MemoServiceServer
)
.
ExportMemos
(
ctx
,
req
.
(
*
ExportMemosRequest
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_MemoService_ListMemoProperties_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
func
_MemoService_ListMemoProperties_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
ListMemoPropertiesRequest
)
in
:=
new
(
ListMemoPropertiesRequest
)
if
err
:=
dec
(
in
);
err
!=
nil
{
if
err
:=
dec
(
in
);
err
!=
nil
{
...
@@ -858,10 +822,6 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
...
@@ -858,10 +822,6 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
MethodName
:
"DeleteMemo"
,
MethodName
:
"DeleteMemo"
,
Handler
:
_MemoService_DeleteMemo_Handler
,
Handler
:
_MemoService_DeleteMemo_Handler
,
},
},
{
MethodName
:
"ExportMemos"
,
Handler
:
_MemoService_ExportMemos_Handler
,
},
{
{
MethodName
:
"ListMemoProperties"
,
MethodName
:
"ListMemoProperties"
,
Handler
:
_MemoService_ListMemoProperties_Handler
,
Handler
:
_MemoService_ListMemoProperties_Handler
,
...
...
server/router/api/v1/memo_service.go
View file @
a8ea2806
package
v1
package
v1
import
(
import
(
"archive/zip"
"bytes"
"context"
"context"
"fmt"
"fmt"
"log/slog"
"log/slog"
...
@@ -491,47 +489,6 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM
...
@@ -491,47 +489,6 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM
return
response
,
nil
return
response
,
nil
}
}
func
(
s
*
APIV1Service
)
ExportMemos
(
ctx
context
.
Context
,
request
*
v1pb
.
ExportMemosRequest
)
(
*
v1pb
.
ExportMemosResponse
,
error
)
{
normalRowStatus
:=
store
.
Normal
memoFind
:=
&
store
.
FindMemo
{
RowStatus
:
&
normalRowStatus
,
// Exclude comments by default.
ExcludeComments
:
true
,
}
if
err
:=
s
.
buildMemoFindWithFilter
(
ctx
,
memoFind
,
request
.
Filter
);
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"failed to build find memos with filter: %v"
,
err
)
}
memos
,
err
:=
s
.
Store
.
ListMemos
(
ctx
,
memoFind
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to list memos: %v"
,
err
)
}
buf
:=
new
(
bytes
.
Buffer
)
writer
:=
zip
.
NewWriter
(
buf
)
for
_
,
memo
:=
range
memos
{
memoMessage
,
err
:=
s
.
convertMemoFromStore
(
ctx
,
memo
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"failed to convert memo"
)
}
file
,
err
:=
writer
.
Create
(
time
.
Unix
(
memo
.
CreatedTs
,
0
)
.
Format
(
time
.
RFC3339
)
+
"-"
+
memo
.
UID
+
"-"
+
string
(
memo
.
Visibility
)
+
".md"
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"Failed to create memo file"
)
}
_
,
err
=
file
.
Write
([]
byte
(
memoMessage
.
Content
))
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"Failed to write to memo file"
)
}
}
if
err
:=
writer
.
Close
();
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"Failed to close zip file writer"
)
}
return
&
v1pb
.
ExportMemosResponse
{
Content
:
buf
.
Bytes
(),
},
nil
}
func
(
s
*
APIV1Service
)
ListMemoProperties
(
ctx
context
.
Context
,
request
*
v1pb
.
ListMemoPropertiesRequest
)
(
*
v1pb
.
ListMemoPropertiesResponse
,
error
)
{
func
(
s
*
APIV1Service
)
ListMemoProperties
(
ctx
context
.
Context
,
request
*
v1pb
.
ListMemoPropertiesRequest
)
(
*
v1pb
.
ListMemoPropertiesResponse
,
error
)
{
user
,
err
:=
s
.
GetCurrentUser
(
ctx
)
user
,
err
:=
s
.
GetCurrentUser
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
web/src/components/Settings/MyAccountSection.tsx
View file @
a8ea2806
import
{
Button
,
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
{
Button
,
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
{
MoreVerticalIcon
,
PenLineIcon
}
from
"lucide-react"
;
import
{
MoreVerticalIcon
,
PenLineIcon
}
from
"lucide-react"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
downloadFileFromUrl
}
from
"@/helpers/utils"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showChangePasswordDialog
from
"../ChangePasswordDialog"
;
import
showChangePasswordDialog
from
"../ChangePasswordDialog"
;
...
@@ -13,13 +11,6 @@ const MyAccountSection = () => {
...
@@ -13,13 +11,6 @@ const MyAccountSection = () => {
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
user
=
useCurrentUser
();
const
user
=
useCurrentUser
();
const
downloadExportedMemos
=
async
(
user
:
any
)
=>
{
const
{
content
}
=
await
memoServiceClient
.
exportMemos
({
filter
:
`creator == "
${
user
.
name
}
"`
});
const
downloadUrl
=
window
.
URL
.
createObjectURL
(
new
Blob
([
content
]));
downloadFileFromUrl
(
downloadUrl
,
"memos-export.zip"
);
URL
.
revokeObjectURL
(
downloadUrl
);
};
return
(
return
(
<
div
className=
"w-full gap-2 pt-2 pb-4"
>
<
div
className=
"w-full gap-2 pt-2 pb-4"
>
<
p
className=
"font-medium text-gray-700 dark:text-gray-500"
>
{
t
(
"setting.account-section.title"
)
}
</
p
>
<
p
className=
"font-medium text-gray-700 dark:text-gray-500"
>
{
t
(
"setting.account-section.title"
)
}
</
p
>
...
@@ -46,7 +37,6 @@ const MyAccountSection = () => {
...
@@ -46,7 +37,6 @@ const MyAccountSection = () => {
</
MenuButton
>
</
MenuButton
>
<
Menu
className=
"text-sm"
size=
"sm"
placement=
"bottom"
>
<
Menu
className=
"text-sm"
size=
"sm"
placement=
"bottom"
>
<
MenuItem
onClick=
{
showChangePasswordDialog
}
>
{
t
(
"setting.account-section.change-password"
)
}
</
MenuItem
>
<
MenuItem
onClick=
{
showChangePasswordDialog
}
>
{
t
(
"setting.account-section.change-password"
)
}
</
MenuItem
>
<
MenuItem
onClick=
{
()
=>
downloadExportedMemos
(
user
)
}
>
{
t
(
"setting.account-section.export-memos"
)
}
</
MenuItem
>
</
Menu
>
</
Menu
>
</
Dropdown
>
</
Dropdown
>
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment