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
1ab2c894
Commit
1ab2c894
authored
Jul 11, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(api): implement get memo by uid
parent
34e938a1
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1017 additions
and
602 deletions
+1017
-602
apidocs.swagger.yaml
docs/apidocs.swagger.yaml
+222
-64
memo_service.proto
proto/api/v1/memo_service.proto
+10
-0
memo_service.pb.go
proto/gen/api/v1/memo_service.pb.go
+591
-519
memo_service.pb.gw.go
proto/gen/api/v1/memo_service.pb.gw.go
+103
-0
memo_service_grpc.pb.go
proto/gen/api/v1/memo_service_grpc.pb.go
+40
-0
memo_service.go
server/router/api/v1/memo_service.go
+30
-7
EmbeddedMemo.tsx
...c/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
+6
-6
ReferencedMemo.tsx
...mponents/MemoContent/ReferencedContent/ReferencedMemo.tsx
+5
-5
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+1
-1
memo.ts
web/src/store/v1/memo.ts
+9
-0
No files found.
docs/apidocs.swagger.yaml
View file @
1ab2c894
...
@@ -301,12 +301,16 @@ paths:
...
@@ -301,12 +301,16 @@ paths:
type
:
integer
type
:
integer
format
:
int32
format
:
int32
-
name
:
pageToken
-
name
:
pageToken
description
:
"
A
page
token,
received
from
a
previous
`ListMemos`
call.
\r\n
Provide
this
to
retrieve
the
subsequent
page."
description
:
|-
A page token, received from a previous `ListMemos` call.
Provide this to retrieve the subsequent page.
in: query
in: query
required: false
required: false
type: string
type: string
-
name
:
filter
-
name
:
filter
description
:
"
Filter
is
used
to
filter
memos
returned
in
the
list.
\r\n
Format:
\"
creator
==
'users/{uid}'
&&
visibilities
==
['PUBLIC',
'PROTECTED']
\"
"
description
:
|-
Filter is used to filter memos returned in the list.
Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"
in: query
in: query
required: false
required: false
type: string
type: string
...
@@ -347,12 +351,17 @@ paths:
...
@@ -347,12 +351,17 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
name
is
the
name
of
the
user
to
get
stats
for.
\r\n
Format:
users/{id}"
description
:
|-
name is the name of the user to get stats for.
Format: users/{id}
in: query
in: query
required: false
required: false
type: string
type: string
-
name
:
timezone
-
name
:
timezone
description
:
"
timezone
location
\r\n
Format:
uses
tz
identifier
\r\n
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
description
:
|-
timezone location
Format: uses tz identifier
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
in: query
in: query
required: false
required: false
type: string
type: string
...
@@ -363,6 +372,27 @@ paths:
...
@@ -363,6 +372,27 @@ paths:
type
:
string
type
:
string
tags
:
tags
:
-
MemoService
-
MemoService
/api/v1/memos:by-uid/{uid}
:
get
:
summary
:
GetMemoByUid gets a memo by uid
operationId
:
MemoService_GetMemoByUid
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v1Memo'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
uid
description
:
The uid of the memo.
in
:
path
required
:
true
type
:
string
tags
:
-
MemoService
/api/v1/memos:export
:
/api/v1/memos:export
:
post
:
post
:
summary
:
ExportMemos exports memos.
summary
:
ExportMemos exports memos.
...
@@ -399,7 +429,9 @@ paths:
...
@@ -399,7 +429,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
filter
-
name
:
filter
description
:
"
Filter
is
used
to
filter
memos
returned.
\r\n
Format:
\"
creator
==
'users/{uid}'
&&
visibilities
==
['PUBLIC',
'PROTECTED']
\"
"
description
:
|-
Filter is used to filter memos returned.
Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"
in: query
in: query
required: false
required: false
type: string
type: string
...
@@ -532,7 +564,9 @@ paths:
...
@@ -532,7 +564,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
filter
-
name
:
filter
description
:
"
Filter
is
used
to
filter
users
returned
in
the
list.
\r\n
Format:
\"
username
==
'frank'
\"
"
description
:
|-
Filter is used to filter users returned in the list.
Format: "username == 'frank'"
in: query
in: query
required: false
required: false
type: string
type: string
...
@@ -693,7 +727,9 @@ paths:
...
@@ -693,7 +727,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
resource
name
of
the
workspace
setting.
\r\n
Format:
settings/{setting}"
description
:
|-
The resource name of the workspace setting.
Format: settings/{setting}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -715,7 +751,9 @@ paths:
...
@@ -715,7 +751,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
setting.name
-
name
:
setting.name
description
:
"
name
is
the
name
of
the
setting.
\r\n
Format:
settings/{setting}"
description
:
|-
name is the name of the setting.
Format: settings/{setting}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -751,7 +789,9 @@ paths:
...
@@ -751,7 +789,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
identityProvider.name
-
name
:
identityProvider.name
description
:
"
The
name
of
the
identityProvider.
\r\n
Format:
identityProviders/{id}"
description
:
|-
The name of the identityProvider.
Format: identityProviders/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -789,7 +829,9 @@ paths:
...
@@ -789,7 +829,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
inbox.name
-
name
:
inbox.name
description
:
"
The
name
of
the
inbox.
\r\n
Format:
inboxes/{id}"
description
:
|-
The name of the inbox.
Format: inboxes/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -833,7 +875,10 @@ paths:
...
@@ -833,7 +875,10 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
memo.name
-
name
:
memo.name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}
\r\n
id
is
the
system
generated
id."
description
:
|-
The name of the memo.
Format: memos/{id}
id is the system generated id.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -851,7 +896,9 @@ paths:
...
@@ -851,7 +896,9 @@ paths:
$ref
:
'
#/definitions/v1RowStatus'
$ref
:
'
#/definitions/v1RowStatus'
creator
:
creator
:
type
:
string
type
:
string
title
:
"
The
name
of
the
creator.
\r\n
Format:
users/{id}"
title
:
|-
The name of the creator.
Format: users/{id}
createTime
:
createTime
:
type
:
string
type
:
string
format
:
date-time
format
:
date-time
...
@@ -904,7 +951,9 @@ paths:
...
@@ -904,7 +951,9 @@ paths:
readOnly
:
true
readOnly
:
true
parent
:
parent
:
type
:
string
type
:
string
title
:
"
The
name
of
the
parent
memo.
\r\n
Format:
memos/{id}"
title
:
|-
The name of the parent memo.
Format: memos/{id}
readOnly: true
readOnly: true
tags
:
tags
:
-
MemoService
-
MemoService
...
@@ -923,7 +972,9 @@ paths:
...
@@ -923,7 +972,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_1
-
name
:
name_1
description
:
"
The
name
of
the
identityProvider
to
get.
\r\n
Format:
identityProviders/{id}"
description
:
|-
The name of the identityProvider to get.
Format: identityProviders/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -945,7 +996,9 @@ paths:
...
@@ -945,7 +996,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_1
-
name
:
name_1
description
:
"
The
name
of
the
identityProvider
to
delete.
\r\n
Format:
identityProviders/{id}"
description
:
|-
The name of the identityProvider to delete.
Format: identityProviders/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -967,7 +1020,10 @@ paths:
...
@@ -967,7 +1020,10 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_2
-
name
:
name_2
description
:
"
The
name
of
the
resource.
\r\n
Format:
resources/{id}
\r\n
id
is
the
system
generated
unique
identifier."
description
:
|-
The name of the resource.
Format: resources/{id}
id is the system generated unique identifier.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -989,7 +1045,9 @@ paths:
...
@@ -989,7 +1045,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_2
-
name
:
name_2
description
:
"
The
name
of
the
inbox
to
delete.
\r\n
Format:
inboxes/{id}"
description
:
|-
The name of the inbox to delete.
Format: inboxes/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1011,7 +1069,9 @@ paths:
...
@@ -1011,7 +1069,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_3
-
name
:
name_3
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1033,7 +1093,10 @@ paths:
...
@@ -1033,7 +1093,10 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_3
-
name
:
name_3
description
:
"
The
name
of
the
resource.
\r\n
Format:
resources/{id}
\r\n
id
is
the
system
generated
unique
identifier."
description
:
|-
The name of the resource.
Format: resources/{id}
id is the system generated unique identifier.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1056,7 +1119,9 @@ paths:
...
@@ -1056,7 +1119,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name_4
-
name
:
name_4
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1078,7 +1143,9 @@ paths:
...
@@ -1078,7 +1143,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1100,7 +1167,9 @@ paths:
...
@@ -1100,7 +1167,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1122,7 +1191,9 @@ paths:
...
@@ -1122,7 +1191,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1143,7 +1214,9 @@ paths:
...
@@ -1143,7 +1214,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1171,7 +1244,9 @@ paths:
...
@@ -1171,7 +1244,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1198,7 +1273,9 @@ paths:
...
@@ -1198,7 +1273,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1219,7 +1296,9 @@ paths:
...
@@ -1219,7 +1296,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1246,7 +1325,9 @@ paths:
...
@@ -1246,7 +1325,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}.
Use
\"
memos/-
\"
to
list
all
properties."
description
:
|-
The name of the memo.
Format: memos/{id}. Use "memos/-" to list all properties.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1269,7 +1350,9 @@ paths:
...
@@ -1269,7 +1350,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}.
Use
\"
memos/-
\"
to
rebuild
all
memos."
description
:
|-
The name of the memo.
Format: memos/{id}. Use "memos/-" to rebuild all memos.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1296,7 +1379,9 @@ paths:
...
@@ -1296,7 +1379,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1317,7 +1402,9 @@ paths:
...
@@ -1317,7 +1402,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1344,7 +1431,9 @@ paths:
...
@@ -1344,7 +1431,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1366,7 +1455,9 @@ paths:
...
@@ -1366,7 +1455,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1393,7 +1484,9 @@ paths:
...
@@ -1393,7 +1484,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1415,7 +1508,9 @@ paths:
...
@@ -1415,7 +1508,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}"
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1442,7 +1537,9 @@ paths:
...
@@ -1442,7 +1537,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1464,13 +1561,17 @@ paths:
...
@@ -1464,13 +1561,17 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
parent
-
name
:
parent
description
:
"
The
parent,
who
owns
the
tags.
\r\n
Format:
memos/{id}.
Use
\"
memos/-
\"
to
list
all
tags."
description
:
|-
The parent, who owns the tags.
Format: memos/{id}. Use "memos/-" to list all tags.
in: path
in: path
required: true
required: true
type: string
type: string
pattern: memos/[^/]+
pattern: memos/[^/]+
-
name
:
filter
-
name
:
filter
description
:
"
Filter
is
used
to
filter
memos.
\r\n
Format:
\"
creator
==
'users/{uid}'
&&
visibilities
==
['PUBLIC',
'PROTECTED']
\"
"
description
:
|-
Filter is used to filter memos.
Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']"
in: query
in: query
required: false
required: false
type: string
type: string
...
@@ -1492,7 +1593,9 @@ paths:
...
@@ -1492,7 +1593,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
parent
-
name
:
parent
description
:
"
The
parent,
who
owns
the
tags.
\r\n
Format:
memos/{id}.
Use
\"
memos/-
\"
to
delete
all
tags."
description
:
|-
The parent, who owns the tags.
Format: memos/{id}. Use "memos/-" to delete all tags.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1523,7 +1626,9 @@ paths:
...
@@ -1523,7 +1626,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
parent
-
name
:
parent
description
:
"
The
parent,
who
owns
the
tags.
\r\n
Format:
memos/{id}.
Use
\"
memos/-
\"
to
rename
all
tags."
description
:
|-
The parent, who owns the tags.
Format: memos/{id}. Use "memos/-" to rename all tags.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1550,7 +1655,10 @@ paths:
...
@@ -1550,7 +1655,10 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
resource.name
-
name
:
resource.name
description
:
"
The
name
of
the
resource.
\r\n
Format:
resources/{id}
\r\n
id
is
the
system
generated
unique
identifier."
description
:
|-
The name of the resource.
Format: resources/{id}
id is the system generated unique identifier.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1582,7 +1690,9 @@ paths:
...
@@ -1582,7 +1690,9 @@ paths:
format
:
int64
format
:
int64
memo
:
memo
:
type
:
string
type
:
string
title
:
"
The
related
memo.
\r\n
Format:
memos/{id}"
title
:
|-
The related memo.
Format: memos/{id}
tags
:
tags
:
-
ResourceService
-
ResourceService
/api/v1/{setting.name}
:
/api/v1/{setting.name}
:
...
@@ -1600,7 +1710,9 @@ paths:
...
@@ -1600,7 +1710,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
setting.name
-
name
:
setting.name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1637,7 +1749,9 @@ paths:
...
@@ -1637,7 +1749,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
user.name
-
name
:
user.name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1691,7 +1805,9 @@ paths:
...
@@ -1691,7 +1805,9 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
description
:
|-
The name of the user.
Format: users/{id}
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1724,7 +1840,10 @@ paths:
...
@@ -1724,7 +1840,10 @@ paths:
$ref
:
'
#/definitions/googlerpcStatus'
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
parameters
:
-
name
:
name
-
name
:
name
description
:
"
The
name
of
the
resource.
\r\n
Format:
resources/{id}
\r\n
id
is
the
system
generated
unique
identifier."
description
:
|-
The name of the resource.
Format: resources/{id}
id is the system generated unique identifier.
in: path
in: path
required: true
required: true
type: string
type: string
...
@@ -1905,7 +2024,9 @@ definitions:
...
@@ -1905,7 +2024,9 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
title
:
"
The
name
of
the
identityProvider.
\r\n
Format:
identityProviders/{id}"
title
:
|-
The name of the identityProvider.
Format: identityProviders/{id}
type
:
type
:
$ref
:
'
#/definitions/apiv1IdentityProviderType'
$ref
:
'
#/definitions/apiv1IdentityProviderType'
title
:
title
:
...
@@ -1949,7 +2070,9 @@ definitions:
...
@@ -1949,7 +2070,9 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
title
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
title
:
|-
The name of the user.
Format: users/{id}
locale
:
locale
:
type
:
string
type
:
string
description
:
The preferred locale of the user.
description
:
The preferred locale of the user.
...
@@ -2011,7 +2134,9 @@ definitions:
...
@@ -2011,7 +2134,9 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
title
:
"
name
is
the
name
of
the
setting.
\r\n
Format:
settings/{setting}"
title
:
|-
name is the name of the setting.
Format: settings/{setting}
generalSetting
:
generalSetting
:
$ref
:
'
#/definitions/apiv1WorkspaceGeneralSetting'
$ref
:
'
#/definitions/apiv1WorkspaceGeneralSetting'
storageSetting
:
storageSetting
:
...
@@ -2026,7 +2151,9 @@ definitions:
...
@@ -2026,7 +2151,9 @@ definitions:
description
:
storage_type is the storage type.
description
:
storage_type is the storage type.
filepathTemplate
:
filepathTemplate
:
type
:
string
type
:
string
title
:
"
The
template
of
file
path.
\r\n
e.g.
assets/{timestamp}_{filename}"
title
:
|-
The template of file path.
e.g. assets/{timestamp}_{filename}
uploadSizeLimitMb
:
uploadSizeLimitMb
:
type
:
string
type
:
string
format
:
int64
format
:
int64
...
@@ -2295,7 +2422,9 @@ definitions:
...
@@ -2295,7 +2422,9 @@ definitions:
additionalProperties
:
additionalProperties
:
type
:
integer
type
:
integer
format
:
int32
format
:
int32
description
:
"
stats
is
the
stats
of
memo
creating/updating
activities.
\r\n
key
is
the
year-month-day
string.
e.g.
\"
2020-01-01
\"
."
description
:
|-
stats is the stats of memo creating/updating activities.
key is the year-month-day string. e.g. "2020-01-01".
v1HeadingNode
:
v1HeadingNode
:
type
:
object
type
:
object
properties
:
properties
:
...
@@ -2329,7 +2458,9 @@ definitions:
...
@@ -2329,7 +2458,9 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
title
:
"
The
name
of
the
inbox.
\r\n
Format:
inboxes/{id}"
title
:
|-
The name of the inbox.
Format: inboxes/{id}
sender
:
sender
:
type
:
string
type
:
string
title
:
'
Format:
users/{id}'
title
:
'
Format:
users/{id}'
...
@@ -2449,7 +2580,10 @@ definitions:
...
@@ -2449,7 +2580,10 @@ definitions:
additionalProperties
:
additionalProperties
:
type
:
integer
type
:
integer
format
:
int32
format
:
int32
description
:
"
tag_amounts
is
the
amount
of
tags.
\r\n
key
is
the
tag
name.
e.g.
\"
tag1
\"
.
\r\n
value
is
the
amount
of
the
tag."
description
:
|-
tag_amounts is the amount of tags.
key is the tag name. e.g. "tag1".
value is the amount of the tag.
v1ListMemosResponse
:
v1ListMemosResponse
:
type
:
object
type
:
object
properties
:
properties
:
...
@@ -2460,7 +2594,9 @@ definitions:
...
@@ -2460,7 +2594,9 @@ definitions:
$ref
:
'
#/definitions/v1Memo'
$ref
:
'
#/definitions/v1Memo'
nextPageToken
:
nextPageToken
:
type
:
string
type
:
string
description
:
"
A
token,
which
can
be
sent
as
`page_token`
to
retrieve
the
next
page.
\r\n
If
this
field
is
omitted,
there
are
no
subsequent
pages."
description
:
|-
A token, which can be sent as `page_token` to retrieve the next page.
If this field is omitted, there are no subsequent pages.
v1ListResourcesResponse
:
v1ListResourcesResponse
:
type
:
object
type
:
object
properties
:
properties
:
...
@@ -2508,7 +2644,10 @@ definitions:
...
@@ -2508,7 +2644,10 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
description
:
"
The
name
of
the
memo.
\r\n
Format:
memos/{id}
\r\n
id
is
the
system
generated
id."
description
:
|-
The name of the memo.
Format: memos/{id}
id is the system generated id.
uid
:
uid
:
type
:
string
type
:
string
description
:
The user defined id of the memo.
description
:
The user defined id of the memo.
...
@@ -2516,7 +2655,9 @@ definitions:
...
@@ -2516,7 +2655,9 @@ definitions:
$ref
:
'
#/definitions/v1RowStatus'
$ref
:
'
#/definitions/v1RowStatus'
creator
:
creator
:
type
:
string
type
:
string
title
:
"
The
name
of
the
creator.
\r\n
Format:
users/{id}"
title
:
|-
The name of the creator.
Format: users/{id}
createTime
:
createTime
:
type
:
string
type
:
string
format
:
date-time
format
:
date-time
...
@@ -2569,7 +2710,9 @@ definitions:
...
@@ -2569,7 +2710,9 @@ definitions:
readOnly
:
true
readOnly
:
true
parent
:
parent
:
type
:
string
type
:
string
title
:
"
The
name
of
the
parent
memo.
\r\n
Format:
memos/{id}"
title
:
|-
The name of the parent memo.
Format: memos/{id}
readOnly: true
readOnly: true
v1MemoProperty
:
v1MemoProperty
:
type
:
object
type
:
object
...
@@ -2591,10 +2734,14 @@ definitions:
...
@@ -2591,10 +2734,14 @@ definitions:
properties
:
properties
:
memo
:
memo
:
type
:
string
type
:
string
title
:
"
The
name
of
memo.
\r\n
Format:
\"
memos/{uid}
\"
"
title
:
|-
The name of memo.
Format: "memos/{uid}"
relatedMemo
:
relatedMemo
:
type
:
string
type
:
string
title
:
"
The
name
of
related
memo.
\r\n
Format:
\"
memos/{uid}
\"
"
title
:
|-
The name of related memo.
Format: "memos/{uid}"
type
:
type
:
$ref
:
'
#/definitions/v1MemoRelationType'
$ref
:
'
#/definitions/v1MemoRelationType'
v1MemoRelationType
:
v1MemoRelationType
:
...
@@ -2743,7 +2890,9 @@ definitions:
...
@@ -2743,7 +2890,9 @@ definitions:
format
:
int32
format
:
int32
creator
:
creator
:
type
:
string
type
:
string
title
:
"
The
name
of
the
creator.
\r\n
Format:
users/{id}"
title
:
|-
The name of the creator.
Format: users/{id}
contentId
:
contentId
:
type
:
string
type
:
string
reactionType
:
reactionType
:
...
@@ -2777,7 +2926,10 @@ definitions:
...
@@ -2777,7 +2926,10 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
description
:
"
The
name
of
the
resource.
\r\n
Format:
resources/{id}
\r\n
id
is
the
system
generated
unique
identifier."
description
:
|-
The name of the resource.
Format: resources/{id}
id is the system generated unique identifier.
uid
:
uid
:
type
:
string
type
:
string
description
:
The user defined id of the resource.
description
:
The user defined id of the resource.
...
@@ -2799,7 +2951,9 @@ definitions:
...
@@ -2799,7 +2951,9 @@ definitions:
format
:
int64
format
:
int64
memo
:
memo
:
type
:
string
type
:
string
title
:
"
The
related
memo.
\r\n
Format:
memos/{id}"
title
:
|-
The related memo.
Format: memos/{id}
v1RestoreMarkdownRequest
:
v1RestoreMarkdownRequest
:
type
:
object
type
:
object
properties
:
properties
:
...
@@ -2923,7 +3077,9 @@ definitions:
...
@@ -2923,7 +3077,9 @@ definitions:
properties
:
properties
:
name
:
name
:
type
:
string
type
:
string
title
:
"
The
name
of
the
user.
\r\n
Format:
users/{id}"
title
:
|-
The name of the user.
Format: users/{id}
id
:
id
:
type
:
integer
type
:
integer
format
:
int32
format
:
int32
...
@@ -2997,7 +3153,9 @@ definitions:
...
@@ -2997,7 +3153,9 @@ definitions:
properties
:
properties
:
owner
:
owner
:
type
:
string
type
:
string
title
:
"
The
name
of
instance
owner.
\r\n
Format:
\"
users/{id}
\"
"
title
:
|-
The name of instance owner.
Format: "users/{id}"
version
:
version
:
type
:
string
type
:
string
title
:
version is the current version of instance
title
:
version is the current version of instance
...
...
proto/api/v1/memo_service.proto
View file @
1ab2c894
...
@@ -37,6 +37,11 @@ service MemoService {
...
@@ -37,6 +37,11 @@ service MemoService {
option
(
google.api.http
)
=
{
get
:
"/api/v1/{name=memos/*}"
};
option
(
google.api.http
)
=
{
get
:
"/api/v1/{name=memos/*}"
};
option
(
google.api.method_signature
)
=
"name"
;
option
(
google.api.method_signature
)
=
"name"
;
}
}
// GetMemoByUid gets a memo by uid
rpc
GetMemoByUid
(
GetMemoByUidRequest
)
returns
(
Memo
)
{
option
(
google.api.http
)
=
{
get
:
"/api/v1/memos:by-uid/{uid}"
};
option
(
google.api.method_signature
)
=
"uid"
;
}
// UpdateMemo updates a memo.
// UpdateMemo updates a memo.
rpc
UpdateMemo
(
UpdateMemoRequest
)
returns
(
Memo
)
{
rpc
UpdateMemo
(
UpdateMemoRequest
)
returns
(
Memo
)
{
option
(
google.api.http
)
=
{
option
(
google.api.http
)
=
{
...
@@ -254,6 +259,11 @@ message GetMemoRequest {
...
@@ -254,6 +259,11 @@ message GetMemoRequest {
string
name
=
1
;
string
name
=
1
;
}
}
message
GetMemoByUidRequest
{
// The uid of the memo.
string
uid
=
1
;
}
message
UpdateMemoRequest
{
message
UpdateMemoRequest
{
Memo
memo
=
1
;
Memo
memo
=
1
;
...
...
proto/gen/api/v1/memo_service.pb.go
View file @
1ab2c894
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 @
1ab2c894
...
@@ -181,6 +181,58 @@ func local_request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime.
...
@@ -181,6 +181,58 @@ func local_request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime.
}
}
func
request_MemoService_GetMemoByUid_0
(
ctx
context
.
Context
,
marshaler
runtime
.
Marshaler
,
client
MemoServiceClient
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
(
proto
.
Message
,
runtime
.
ServerMetadata
,
error
)
{
var
protoReq
GetMemoByUidRequest
var
metadata
runtime
.
ServerMetadata
var
(
val
string
ok
bool
err
error
_
=
err
)
val
,
ok
=
pathParams
[
"uid"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"uid"
)
}
protoReq
.
Uid
,
err
=
runtime
.
String
(
val
)
if
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"type mismatch, parameter: %s, error: %v"
,
"uid"
,
err
)
}
msg
,
err
:=
client
.
GetMemoByUid
(
ctx
,
&
protoReq
,
grpc
.
Header
(
&
metadata
.
HeaderMD
),
grpc
.
Trailer
(
&
metadata
.
TrailerMD
))
return
msg
,
metadata
,
err
}
func
local_request_MemoService_GetMemoByUid_0
(
ctx
context
.
Context
,
marshaler
runtime
.
Marshaler
,
server
MemoServiceServer
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
(
proto
.
Message
,
runtime
.
ServerMetadata
,
error
)
{
var
protoReq
GetMemoByUidRequest
var
metadata
runtime
.
ServerMetadata
var
(
val
string
ok
bool
err
error
_
=
err
)
val
,
ok
=
pathParams
[
"uid"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"uid"
)
}
protoReq
.
Uid
,
err
=
runtime
.
String
(
val
)
if
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"type mismatch, parameter: %s, error: %v"
,
"uid"
,
err
)
}
msg
,
err
:=
server
.
GetMemoByUid
(
ctx
,
&
protoReq
)
return
msg
,
metadata
,
err
}
var
(
var
(
filter_MemoService_UpdateMemo_0
=
&
utilities
.
DoubleArray
{
Encoding
:
map
[
string
]
int
{
"memo"
:
0
,
"name"
:
1
},
Base
:
[]
int
{
1
,
2
,
1
,
0
,
0
},
Check
:
[]
int
{
0
,
1
,
2
,
3
,
2
}}
filter_MemoService_UpdateMemo_0
=
&
utilities
.
DoubleArray
{
Encoding
:
map
[
string
]
int
{
"memo"
:
0
,
"name"
:
1
},
Base
:
[]
int
{
1
,
2
,
1
,
0
,
0
},
Check
:
[]
int
{
0
,
1
,
2
,
3
,
2
}}
)
)
...
@@ -1333,6 +1385,31 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
...
@@ -1333,6 +1385,31 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
})
})
mux
.
Handle
(
"GET"
,
pattern_MemoService_GetMemoByUid_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/GetMemoByUid"
,
runtime
.
WithHTTPPathPattern
(
"/api/v1/memos:by-uid/{uid}"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
}
resp
,
md
,
err
:=
local_request_MemoService_GetMemoByUid_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_GetMemoByUid_0
(
annotatedContext
,
mux
,
outboundMarshaler
,
w
,
req
,
resp
,
mux
.
GetForwardResponseOptions
()
...
)
})
mux
.
Handle
(
"PATCH"
,
pattern_MemoService_UpdateMemo_0
,
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
{
mux
.
Handle
(
"PATCH"
,
pattern_MemoService_UpdateMemo_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,6 +1989,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
...
@@ -1912,6 +1989,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
})
})
mux
.
Handle
(
"GET"
,
pattern_MemoService_GetMemoByUid_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/GetMemoByUid"
,
runtime
.
WithHTTPPathPattern
(
"/api/v1/memos:by-uid/{uid}"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
}
resp
,
md
,
err
:=
request_MemoService_GetMemoByUid_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_GetMemoByUid_0
(
annotatedContext
,
mux
,
outboundMarshaler
,
w
,
req
,
resp
,
mux
.
GetForwardResponseOptions
()
...
)
})
mux
.
Handle
(
"PATCH"
,
pattern_MemoService_UpdateMemo_0
,
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
{
mux
.
Handle
(
"PATCH"
,
pattern_MemoService_UpdateMemo_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
()
...
@@ -2320,6 +2419,8 @@ var (
...
@@ -2320,6 +2419,8 @@ var (
pattern_MemoService_GetMemo_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_GetMemo_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_GetMemoByUid_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
1
,
5
,
3
},
[]
string
{
"api"
,
"v1"
,
"memos:by-uid"
,
"uid"
},
""
))
pattern_MemoService_UpdateMemo_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
2
,
5
,
3
},
[]
string
{
"api"
,
"v1"
,
"memos"
,
"memo.name"
},
""
))
pattern_MemoService_UpdateMemo_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
2
,
5
,
3
},
[]
string
{
"api"
,
"v1"
,
"memos"
,
"memo.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_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"
},
""
))
...
@@ -2366,6 +2467,8 @@ var (
...
@@ -2366,6 +2467,8 @@ var (
forward_MemoService_GetMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_GetMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_GetMemoByUid_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_UpdateMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_UpdateMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_DeleteMemo_0
=
runtime
.
ForwardResponseMessage
forward_MemoService_DeleteMemo_0
=
runtime
.
ForwardResponseMessage
...
...
proto/gen/api/v1/memo_service_grpc.pb.go
View file @
1ab2c894
...
@@ -24,6 +24,7 @@ const (
...
@@ -24,6 +24,7 @@ const (
MemoService_ListMemos_FullMethodName
=
"/memos.api.v1.MemoService/ListMemos"
MemoService_ListMemos_FullMethodName
=
"/memos.api.v1.MemoService/ListMemos"
MemoService_SearchMemos_FullMethodName
=
"/memos.api.v1.MemoService/SearchMemos"
MemoService_SearchMemos_FullMethodName
=
"/memos.api.v1.MemoService/SearchMemos"
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_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_ExportMemos_FullMethodName
=
"/memos.api.v1.MemoService/ExportMemos"
...
@@ -56,6 +57,8 @@ type MemoServiceClient interface {
...
@@ -56,6 +57,8 @@ type MemoServiceClient interface {
SearchMemos
(
ctx
context
.
Context
,
in
*
SearchMemosRequest
,
opts
...
grpc
.
CallOption
)
(
*
SearchMemosResponse
,
error
)
SearchMemos
(
ctx
context
.
Context
,
in
*
SearchMemosRequest
,
opts
...
grpc
.
CallOption
)
(
*
SearchMemosResponse
,
error
)
// GetMemo gets a memo.
// GetMemo gets a memo.
GetMemo
(
ctx
context
.
Context
,
in
*
GetMemoRequest
,
opts
...
grpc
.
CallOption
)
(
*
Memo
,
error
)
GetMemo
(
ctx
context
.
Context
,
in
*
GetMemoRequest
,
opts
...
grpc
.
CallOption
)
(
*
Memo
,
error
)
// GetMemoByUid gets a memo by uid
GetMemoByUid
(
ctx
context
.
Context
,
in
*
GetMemoByUidRequest
,
opts
...
grpc
.
CallOption
)
(
*
Memo
,
error
)
// UpdateMemo updates a memo.
// UpdateMemo updates a memo.
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.
...
@@ -142,6 +145,16 @@ func (c *memoServiceClient) GetMemo(ctx context.Context, in *GetMemoRequest, opt
...
@@ -142,6 +145,16 @@ func (c *memoServiceClient) GetMemo(ctx context.Context, in *GetMemoRequest, opt
return
out
,
nil
return
out
,
nil
}
}
func
(
c
*
memoServiceClient
)
GetMemoByUid
(
ctx
context
.
Context
,
in
*
GetMemoByUidRequest
,
opts
...
grpc
.
CallOption
)
(
*
Memo
,
error
)
{
cOpts
:=
append
([]
grpc
.
CallOption
{
grpc
.
StaticMethod
()},
opts
...
)
out
:=
new
(
Memo
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
MemoService_GetMemoByUid_FullMethodName
,
in
,
out
,
cOpts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
func
(
c
*
memoServiceClient
)
UpdateMemo
(
ctx
context
.
Context
,
in
*
UpdateMemoRequest
,
opts
...
grpc
.
CallOption
)
(
*
Memo
,
error
)
{
func
(
c
*
memoServiceClient
)
UpdateMemo
(
ctx
context
.
Context
,
in
*
UpdateMemoRequest
,
opts
...
grpc
.
CallOption
)
(
*
Memo
,
error
)
{
cOpts
:=
append
([]
grpc
.
CallOption
{
grpc
.
StaticMethod
()},
opts
...
)
cOpts
:=
append
([]
grpc
.
CallOption
{
grpc
.
StaticMethod
()},
opts
...
)
out
:=
new
(
Memo
)
out
:=
new
(
Memo
)
...
@@ -334,6 +347,8 @@ type MemoServiceServer interface {
...
@@ -334,6 +347,8 @@ type MemoServiceServer interface {
SearchMemos
(
context
.
Context
,
*
SearchMemosRequest
)
(
*
SearchMemosResponse
,
error
)
SearchMemos
(
context
.
Context
,
*
SearchMemosRequest
)
(
*
SearchMemosResponse
,
error
)
// GetMemo gets a memo.
// GetMemo gets a memo.
GetMemo
(
context
.
Context
,
*
GetMemoRequest
)
(
*
Memo
,
error
)
GetMemo
(
context
.
Context
,
*
GetMemoRequest
)
(
*
Memo
,
error
)
// GetMemoByUid gets a memo by uid
GetMemoByUid
(
context
.
Context
,
*
GetMemoByUidRequest
)
(
*
Memo
,
error
)
// UpdateMemo updates a memo.
// UpdateMemo updates a memo.
UpdateMemo
(
context
.
Context
,
*
UpdateMemoRequest
)
(
*
Memo
,
error
)
UpdateMemo
(
context
.
Context
,
*
UpdateMemoRequest
)
(
*
Memo
,
error
)
// DeleteMemo deletes a memo.
// DeleteMemo deletes a memo.
...
@@ -389,6 +404,9 @@ func (UnimplementedMemoServiceServer) SearchMemos(context.Context, *SearchMemosR
...
@@ -389,6 +404,9 @@ func (UnimplementedMemoServiceServer) SearchMemos(context.Context, *SearchMemosR
func
(
UnimplementedMemoServiceServer
)
GetMemo
(
context
.
Context
,
*
GetMemoRequest
)
(
*
Memo
,
error
)
{
func
(
UnimplementedMemoServiceServer
)
GetMemo
(
context
.
Context
,
*
GetMemoRequest
)
(
*
Memo
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method GetMemo not implemented"
)
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method GetMemo not implemented"
)
}
}
func
(
UnimplementedMemoServiceServer
)
GetMemoByUid
(
context
.
Context
,
*
GetMemoByUidRequest
)
(
*
Memo
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method GetMemoByUid not implemented"
)
}
func
(
UnimplementedMemoServiceServer
)
UpdateMemo
(
context
.
Context
,
*
UpdateMemoRequest
)
(
*
Memo
,
error
)
{
func
(
UnimplementedMemoServiceServer
)
UpdateMemo
(
context
.
Context
,
*
UpdateMemoRequest
)
(
*
Memo
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method UpdateMemo not implemented"
)
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method UpdateMemo not implemented"
)
}
}
...
@@ -528,6 +546,24 @@ func _MemoService_GetMemo_Handler(srv interface{}, ctx context.Context, dec func
...
@@ -528,6 +546,24 @@ func _MemoService_GetMemo_Handler(srv interface{}, ctx context.Context, dec func
return
interceptor
(
ctx
,
in
,
info
,
handler
)
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
}
func
_MemoService_GetMemoByUid_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
GetMemoByUidRequest
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
MemoServiceServer
)
.
GetMemoByUid
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
MemoService_GetMemoByUid_FullMethodName
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
MemoServiceServer
)
.
GetMemoByUid
(
ctx
,
req
.
(
*
GetMemoByUidRequest
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
func
_MemoService_UpdateMemo_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
func
_MemoService_UpdateMemo_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
UpdateMemoRequest
)
in
:=
new
(
UpdateMemoRequest
)
if
err
:=
dec
(
in
);
err
!=
nil
{
if
err
:=
dec
(
in
);
err
!=
nil
{
...
@@ -875,6 +911,10 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
...
@@ -875,6 +911,10 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
MethodName
:
"GetMemo"
,
MethodName
:
"GetMemo"
,
Handler
:
_MemoService_GetMemo_Handler
,
Handler
:
_MemoService_GetMemo_Handler
,
},
},
{
MethodName
:
"GetMemoByUid"
,
Handler
:
_MemoService_GetMemoByUid_Handler
,
},
{
{
MethodName
:
"UpdateMemo"
,
MethodName
:
"UpdateMemo"
,
Handler
:
_MemoService_UpdateMemo_Handler
,
Handler
:
_MemoService_UpdateMemo_Handler
,
...
...
server/router/api/v1/memo_service.go
View file @
1ab2c894
...
@@ -205,6 +205,36 @@ func (s *APIV1Service) GetMemo(ctx context.Context, request *v1pb.GetMemoRequest
...
@@ -205,6 +205,36 @@ func (s *APIV1Service) GetMemo(ctx context.Context, request *v1pb.GetMemoRequest
return
memoMessage
,
nil
return
memoMessage
,
nil
}
}
func
(
s
*
APIV1Service
)
GetMemoByUID
(
ctx
context
.
Context
,
request
*
v1pb
.
GetMemoByUidRequest
)
(
*
v1pb
.
Memo
,
error
)
{
memo
,
err
:=
s
.
Store
.
GetMemo
(
ctx
,
&
store
.
FindMemo
{
UID
:
&
request
.
Uid
,
})
if
err
!=
nil
{
return
nil
,
err
}
if
memo
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
NotFound
,
"memo not found"
)
}
if
memo
.
Visibility
!=
store
.
Public
{
user
,
err
:=
s
.
GetCurrentUser
(
ctx
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to get user"
)
}
if
user
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
if
memo
.
Visibility
==
store
.
Private
&&
memo
.
CreatorID
!=
user
.
ID
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
}
memoMessage
,
err
:=
s
.
convertMemoFromStore
(
ctx
,
memo
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"failed to convert memo"
)
}
return
memoMessage
,
nil
}
func
(
s
*
APIV1Service
)
UpdateMemo
(
ctx
context
.
Context
,
request
*
v1pb
.
UpdateMemoRequest
)
(
*
v1pb
.
Memo
,
error
)
{
func
(
s
*
APIV1Service
)
UpdateMemo
(
ctx
context
.
Context
,
request
*
v1pb
.
UpdateMemoRequest
)
(
*
v1pb
.
Memo
,
error
)
{
id
,
err
:=
ExtractMemoIDFromName
(
request
.
Memo
.
Name
)
id
,
err
:=
ExtractMemoIDFromName
(
request
.
Memo
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -968,9 +998,6 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store.
...
@@ -968,9 +998,6 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store.
}
}
find
.
CreatorID
=
&
user
.
ID
find
.
CreatorID
=
&
user
.
ID
}
}
if
filter
.
UID
!=
nil
{
find
.
UID
=
filter
.
UID
}
if
filter
.
RowStatus
!=
nil
{
if
filter
.
RowStatus
!=
nil
{
find
.
RowStatus
=
filter
.
RowStatus
find
.
RowStatus
=
filter
.
RowStatus
}
}
...
@@ -1059,7 +1086,6 @@ type SearchMemosFilter struct {
...
@@ -1059,7 +1086,6 @@ type SearchMemosFilter struct {
DisplayTimeBefore
*
int64
DisplayTimeBefore
*
int64
DisplayTimeAfter
*
int64
DisplayTimeAfter
*
int64
Creator
*
string
Creator
*
string
UID
*
string
RowStatus
*
store
.
RowStatus
RowStatus
*
store
.
RowStatus
Random
bool
Random
bool
Limit
*
int
Limit
*
int
...
@@ -1122,9 +1148,6 @@ func findSearchMemosField(callExpr *expr.Expr_Call, filter *SearchMemosFilter) {
...
@@ -1122,9 +1148,6 @@ func findSearchMemosField(callExpr *expr.Expr_Call, filter *SearchMemosFilter) {
}
else
if
idExpr
.
Name
==
"creator"
{
}
else
if
idExpr
.
Name
==
"creator"
{
creator
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetStringValue
()
creator
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetStringValue
()
filter
.
Creator
=
&
creator
filter
.
Creator
=
&
creator
}
else
if
idExpr
.
Name
==
"uid"
{
uid
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetStringValue
()
filter
.
UID
=
&
uid
}
else
if
idExpr
.
Name
==
"row_status"
{
}
else
if
idExpr
.
Name
==
"row_status"
{
rowStatus
:=
store
.
RowStatus
(
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetStringValue
())
rowStatus
:=
store
.
RowStatus
(
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetStringValue
())
filter
.
RowStatus
=
&
rowStatus
filter
.
RowStatus
=
&
rowStatus
...
...
web/src/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
View file @
1ab2c894
...
@@ -13,22 +13,22 @@ interface Props {
...
@@ -13,22 +13,22 @@ interface Props {
params
:
string
;
params
:
string
;
}
}
const
EmbeddedMemo
=
({
resourceId
,
params
:
paramsStr
}:
Props
)
=>
{
const
EmbeddedMemo
=
({
resourceId
:
uid
,
params
:
paramsStr
}:
Props
)
=>
{
const
context
=
useContext
(
RendererContext
);
const
context
=
useContext
(
RendererContext
);
const
loadingState
=
useLoading
();
const
loadingState
=
useLoading
();
const
memoStore
=
useMemoStore
();
const
memoStore
=
useMemoStore
();
const
memo
=
memoStore
.
getMemoByUid
(
resourceI
d
);
const
memo
=
memoStore
.
getMemoByUid
(
ui
d
);
const
resourceName
=
`memos/
${
resourceI
d
}
`
;
const
resourceName
=
`memos/
${
ui
d
}
`
;
useEffect
(()
=>
{
useEffect
(()
=>
{
memoStore
.
searchMemos
(
`uid == "
${
resourceId
}
" && include_comments == true`
).
finally
(()
=>
loadingState
.
setFinish
());
memoStore
.
fetchMemoByUid
(
uid
).
finally
(()
=>
loadingState
.
setFinish
());
},
[
resourceI
d
]);
},
[
ui
d
]);
if
(
loadingState
.
isLoading
)
{
if
(
loadingState
.
isLoading
)
{
return
null
;
return
null
;
}
}
if
(
!
memo
)
{
if
(
!
memo
)
{
return
<
Error
message=
{
`Memo not found: ${
resourceI
d}`
}
/>;
return
<
Error
message=
{
`Memo not found: ${
ui
d}`
}
/>;
}
}
if
(
memo
.
name
===
context
.
memoName
||
context
.
embeddedMemos
.
has
(
resourceName
))
{
if
(
memo
.
name
===
context
.
memoName
||
context
.
embeddedMemos
.
has
(
resourceName
))
{
return
<
Error
message=
{
`Nested Rendering Error: ![[${resourceName}]]`
}
/>;
return
<
Error
message=
{
`Nested Rendering Error: ![[${resourceName}]]`
}
/>;
...
...
web/src/components/MemoContent/ReferencedContent/ReferencedMemo.tsx
View file @
1ab2c894
...
@@ -9,22 +9,22 @@ interface Props {
...
@@ -9,22 +9,22 @@ interface Props {
params
:
string
;
params
:
string
;
}
}
const
ReferencedMemo
=
({
resourceId
,
params
:
paramsStr
}:
Props
)
=>
{
const
ReferencedMemo
=
({
resourceId
:
uid
,
params
:
paramsStr
}:
Props
)
=>
{
const
navigateTo
=
useNavigateTo
();
const
navigateTo
=
useNavigateTo
();
const
loadingState
=
useLoading
();
const
loadingState
=
useLoading
();
const
memoStore
=
useMemoStore
();
const
memoStore
=
useMemoStore
();
const
memo
=
memoStore
.
getMemoByUid
(
resourceI
d
);
const
memo
=
memoStore
.
getMemoByUid
(
ui
d
);
const
params
=
new
URLSearchParams
(
paramsStr
);
const
params
=
new
URLSearchParams
(
paramsStr
);
useEffect
(()
=>
{
useEffect
(()
=>
{
memoStore
.
searchMemos
(
`uid == "
${
resourceId
}
" && include_comments == true`
).
finally
(()
=>
loadingState
.
setFinish
());
memoStore
.
fetchMemoByUid
(
uid
).
finally
(()
=>
loadingState
.
setFinish
());
},
[
resourceI
d
]);
},
[
ui
d
]);
if
(
loadingState
.
isLoading
)
{
if
(
loadingState
.
isLoading
)
{
return
null
;
return
null
;
}
}
if
(
!
memo
)
{
if
(
!
memo
)
{
return
<
Error
message=
{
`Memo not found: ${
resourceI
d}`
}
/>;
return
<
Error
message=
{
`Memo not found: ${
ui
d}`
}
/>;
}
}
const
paramsText
=
params
.
has
(
"text"
)
?
params
.
get
(
"text"
)
:
undefined
;
const
paramsText
=
params
.
has
(
"text"
)
?
params
.
get
(
"text"
)
:
undefined
;
...
...
web/src/pages/MemoDetail.tsx
View file @
1ab2c894
...
@@ -34,7 +34,7 @@ const MemoDetail = () => {
...
@@ -34,7 +34,7 @@ const MemoDetail = () => {
// Prepare memo.
// Prepare memo.
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
uid
)
{
if
(
uid
)
{
memoStore
.
searchMemos
(
`uid == "
${
uid
}
"`
).
catch
((
error
:
ClientError
)
=>
{
memoStore
.
fetchMemoByUid
(
uid
).
catch
((
error
:
ClientError
)
=>
{
toast
.
error
(
error
.
details
);
toast
.
error
(
error
.
details
);
navigateTo
(
"/403"
);
navigateTo
(
"/403"
);
});
});
...
...
web/src/store/v1/memo.ts
View file @
1ab2c894
...
@@ -59,6 +59,15 @@ export const useMemoStore = create(
...
@@ -59,6 +59,15 @@ export const useMemoStore = create(
set
({
stateId
:
uniqueId
(),
memoMapByName
:
memoMap
});
set
({
stateId
:
uniqueId
(),
memoMapByName
:
memoMap
});
return
memos
;
return
memos
;
},
},
fetchMemoByUid
:
async
(
uid
:
string
)
=>
{
const
memo
=
await
memoServiceClient
.
getMemoByUid
({
uid
,
});
const
memoMap
=
get
().
memoMapByName
;
memoMap
[
memo
.
name
]
=
memo
;
set
({
stateId
:
uniqueId
(),
memoMapByName
:
memoMap
});
return
memo
;
},
getMemoByUid
:
(
uid
:
string
)
=>
{
getMemoByUid
:
(
uid
:
string
)
=>
{
const
memoMap
=
get
().
memoMapByName
;
const
memoMap
=
get
().
memoMapByName
;
return
Object
.
values
(
memoMap
).
find
((
memo
)
=>
memo
.
uid
===
uid
);
return
Object
.
values
(
memoMap
).
find
((
memo
)
=>
memo
.
uid
===
uid
);
...
...
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