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
ed89cb83
Commit
ed89cb83
authored
Mar 19, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update memo relation definition
parent
722e3560
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
192 additions
and
180 deletions
+192
-180
memo_relation_service.proto
proto/api/v2/memo_relation_service.proto
+7
-2
README.md
proto/gen/api/v2/README.md
+2
-2
memo_relation_service.pb.go
proto/gen/api/v2/memo_relation_service.pb.go
+37
-33
apidocs.swagger.md
server/route/api/v2/apidocs.swagger.md
+106
-94
apidocs.swagger.yaml
server/route/api/v2/apidocs.swagger.yaml
+10
-6
memo_relation_service.go
server/route/api/v2/memo_relation_service.go
+10
-5
memo_service.go
server/route/api/v2/memo_service.go
+0
-11
AddMemoRelationButton.tsx
...ponents/MemoEditor/ActionButton/AddMemoRelationButton.tsx
+4
-4
RelationListView.tsx
web/src/components/MemoEditor/RelationListView.tsx
+3
-3
index.tsx
web/src/components/MemoEditor/index.tsx
+4
-1
MemoRelationListView.tsx
web/src/components/MemoRelationListView.tsx
+5
-11
MemoView.tsx
web/src/components/MemoView.tsx
+1
-1
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+3
-7
No files found.
proto/api/v2/memo_relation_service.proto
View file @
ed89cb83
...
...
@@ -5,8 +5,13 @@ package memos.api.v2;
option
go_package
=
"gen/api/v2"
;
message
MemoRelation
{
int32
memo_id
=
1
;
int32
related_memo_id
=
2
;
// The name of memo.
// Format: "memos/{uid}"
string
memo
=
1
;
// The name of related memo.
// Format: "memos/{uid}"
string
related_memo
=
2
;
enum
Type
{
TYPE_UNSPECIFIED
=
0
;
...
...
proto/gen/api/v2/README.md
View file @
ed89cb83
...
...
@@ -1226,8 +1226,8 @@ Used internally for obfuscating the page token.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| memo
_id |
[
int32
](
#int32
)
| |
|
| related_memo
_id |
[
int32
](
#int32
)
| |
|
| memo
|
[
string
](
#string
)
| | The name of memo. Format:
"
memos/{uid}
"
|
| related_memo
|
[
string
](
#string
)
| | The name of related memo. Format:
"
memos/{uid}
"
|
| type |
[
MemoRelation.Type
](
#memos-api-v2-MemoRelation-Type
)
| | |
...
...
proto/gen/api/v2/memo_relation_service.pb.go
View file @
ed89cb83
...
...
@@ -74,9 +74,13 @@ type MemoRelation struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
MemoId
int32
`protobuf:"varint,1,opt,name=memo_id,json=memoId,proto3" json:"memo_id,omitempty"`
RelatedMemoId
int32
`protobuf:"varint,2,opt,name=related_memo_id,json=relatedMemoId,proto3" json:"related_memo_id,omitempty"`
Type
MemoRelation_Type
`protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.v2.MemoRelation_Type" json:"type,omitempty"`
// The name of memo.
// Format: "memos/{uid}"
Memo
string
`protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"`
// The name of related memo.
// Format: "memos/{uid}"
RelatedMemo
string
`protobuf:"bytes,2,opt,name=related_memo,json=relatedMemo,proto3" json:"related_memo,omitempty"`
Type
MemoRelation_Type
`protobuf:"varint,3,opt,name=type,proto3,enum=memos.api.v2.MemoRelation_Type" json:"type,omitempty"`
}
func
(
x
*
MemoRelation
)
Reset
()
{
...
...
@@ -111,18 +115,18 @@ func (*MemoRelation) Descriptor() ([]byte, []int) {
return
file_api_v2_memo_relation_service_proto_rawDescGZIP
(),
[]
int
{
0
}
}
func
(
x
*
MemoRelation
)
GetMemo
Id
()
int32
{
func
(
x
*
MemoRelation
)
GetMemo
()
string
{
if
x
!=
nil
{
return
x
.
Memo
Id
return
x
.
Memo
}
return
0
return
""
}
func
(
x
*
MemoRelation
)
GetRelatedMemo
Id
()
int32
{
func
(
x
*
MemoRelation
)
GetRelatedMemo
()
string
{
if
x
!=
nil
{
return
x
.
RelatedMemo
Id
return
x
.
RelatedMemo
}
return
0
return
""
}
func
(
x
*
MemoRelation
)
GetType
()
MemoRelation_Type
{
...
...
@@ -138,30 +142,30 @@ var file_api_v2_memo_relation_service_proto_rawDesc = []byte{
0x0a
,
0x22
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x76
,
0x32
,
0x2f
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x5f
,
0x72
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x5f
,
0x73
,
0x65
,
0x72
,
0x76
,
0x69
,
0x63
,
0x65
,
0x2e
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x12
,
0x0c
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x61
,
0x70
,
0x69
,
0x2e
,
0x76
,
0x32
,
0x22
,
0xb
e
,
0x01
,
0x0a
,
0x0c
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x12
,
0x1
7
,
0x0a
,
0x07
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x01
,
0x
20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x06
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x49
,
0x64
,
0x12
,
0x26
,
0x0a
,
0x0f
,
0x
72
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x65
,
0x64
,
0x5f
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x
02
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x0d
,
0x72
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x65
,
0x64
,
0x4d
,
0x65
,
0x
6d
,
0x6f
,
0x49
,
0x64
,
0x12
,
0x33
,
0x0a
,
0x04
,
0x74
,
0x79
,
0x70
,
0x65
,
0x18
,
0x03
,
0x20
,
0x01
,
0x2
8
,
0x0e
,
0x32
,
0x1f
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x61
,
0x70
,
0x69
,
0x2e
,
0x76
,
0x
32
,
0x2e
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x2e
,
0x54
,
0x
79
,
0x70
,
0x65
,
0x52
,
0x04
,
0x74
,
0x79
,
0x70
,
0x65
,
0x22
,
0x38
,
0x0a
,
0x04
,
0x54
,
0x79
,
0x70
,
0x
65
,
0x12
,
0x14
,
0x0a
,
0x10
,
0x54
,
0x59
,
0x50
,
0x45
,
0x5f
,
0x55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x
49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x0d
,
0x0a
,
0x09
,
0x52
,
0x45
,
0x46
,
0x45
,
0x52
,
0x4
5
,
0x4e
,
0x43
,
0x45
,
0x10
,
0x01
,
0x12
,
0x0b
,
0x0a
,
0x07
,
0x43
,
0x4f
,
0x4d
,
0x4d
,
0x45
,
0x4e
,
0x
54
,
0x10
,
0x02
,
0x42
,
0xb0
,
0x01
,
0x0a
,
0x10
,
0x63
,
0x6f
,
0x6d
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x
73
,
0x2e
,
0x61
,
0x70
,
0x69
,
0x2e
,
0x76
,
0x32
,
0x42
,
0x18
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6
c
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x53
,
0x65
,
0x72
,
0x76
,
0x69
,
0x63
,
0x65
,
0x50
,
0x72
,
0x6f
,
0x7
4
,
0x6f
,
0x50
,
0x01
,
0x5a
,
0x30
,
0x67
,
0x69
,
0x74
,
0x68
,
0x75
,
0x62
,
0x2e
,
0x63
,
0x6f
,
0x6d
,
0x
2f
,
0x75
,
0x73
,
0x65
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2f
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2f
,
0x
70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x2f
,
0x67
,
0x65
,
0x6e
,
0x2f
,
0x61
,
0x70
,
0x69
,
0x2f
,
0x76
,
0x32
,
0x
3b
,
0x61
,
0x70
,
0x69
,
0x76
,
0x32
,
0xa2
,
0x02
,
0x03
,
0x4d
,
0x41
,
0x58
,
0xaa
,
0x02
,
0x0c
,
0x4d
,
0x
65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x41
,
0x70
,
0x69
,
0x2e
,
0x56
,
0x32
,
0xca
,
0x02
,
0x0c
,
0x4d
,
0x65
,
0x
6d
,
0x6f
,
0x73
,
0x5c
,
0x41
,
0x70
,
0x69
,
0x5c
,
0x56
,
0x32
,
0xe2
,
0x02
,
0x18
,
0x4d
,
0x65
,
0x6d
,
0x
6f
,
0x73
,
0x5c
,
0x41
,
0x70
,
0x69
,
0x5c
,
0x56
,
0x32
,
0x5c
,
0x47
,
0x50
,
0x42
,
0x4d
,
0x65
,
0x74
,
0x6
1
,
0x64
,
0x61
,
0x74
,
0x61
,
0xea
,
0x02
,
0x0e
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x3a
,
0x3a
,
0x41
,
0x
70
,
0x69
,
0x3a
,
0x3a
,
0x56
,
0x32
,
0x62
,
0x06
,
0x70
,
0x72
,
0x
6f
,
0x74
,
0x6f
,
0x33
,
0x76
,
0x32
,
0x22
,
0xb
4
,
0x01
,
0x0a
,
0x0c
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x12
,
0x1
2
,
0x0a
,
0x04
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x
09
,
0x52
,
0x04
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x12
,
0x21
,
0x0a
,
0x0c
,
0x72
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x
65
,
0x64
,
0x5f
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0b
,
0x72
,
0x
65
,
0x6c
,
0x61
,
0x74
,
0x65
,
0x64
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x12
,
0x33
,
0x0a
,
0x04
,
0x74
,
0x79
,
0x
70
,
0x65
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x0e
,
0x32
,
0x1f
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2
e
,
0x61
,
0x70
,
0x69
,
0x2e
,
0x76
,
0x32
,
0x2e
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6c
,
0x61
,
0x
74
,
0x69
,
0x6f
,
0x6e
,
0x2e
,
0x54
,
0x79
,
0x70
,
0x65
,
0x52
,
0x04
,
0x74
,
0x79
,
0x70
,
0x65
,
0x22
,
0x
38
,
0x0a
,
0x04
,
0x54
,
0x79
,
0x70
,
0x65
,
0x12
,
0x14
,
0x0a
,
0x10
,
0x54
,
0x59
,
0x50
,
0x45
,
0x5f
,
0x
55
,
0x4e
,
0x53
,
0x50
,
0x45
,
0x43
,
0x49
,
0x46
,
0x49
,
0x45
,
0x44
,
0x10
,
0x00
,
0x12
,
0x0d
,
0x0a
,
0x
09
,
0x52
,
0x45
,
0x46
,
0x45
,
0x52
,
0x45
,
0x4e
,
0x43
,
0x45
,
0x10
,
0x01
,
0x12
,
0x0b
,
0x0a
,
0x07
,
0x4
3
,
0x4f
,
0x4d
,
0x4d
,
0x45
,
0x4e
,
0x54
,
0x10
,
0x02
,
0x42
,
0xb0
,
0x01
,
0x0a
,
0x10
,
0x63
,
0x6f
,
0x
6d
,
0x2e
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x61
,
0x70
,
0x69
,
0x2e
,
0x76
,
0x32
,
0x42
,
0x18
,
0x
4d
,
0x65
,
0x6d
,
0x6f
,
0x52
,
0x65
,
0x6c
,
0x61
,
0x74
,
0x69
,
0x6f
,
0x6e
,
0x53
,
0x65
,
0x72
,
0x76
,
0x6
9
,
0x63
,
0x65
,
0x50
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x50
,
0x01
,
0x5a
,
0x30
,
0x67
,
0x69
,
0x74
,
0x68
,
0x7
5
,
0x62
,
0x2e
,
0x63
,
0x6f
,
0x6d
,
0x2f
,
0x75
,
0x73
,
0x65
,
0x6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2f
,
0x
6d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2f
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x2f
,
0x67
,
0x65
,
0x6e
,
0x2f
,
0x
61
,
0x70
,
0x69
,
0x2f
,
0x76
,
0x32
,
0x3b
,
0x61
,
0x70
,
0x69
,
0x76
,
0x32
,
0xa2
,
0x02
,
0x03
,
0x4d
,
0x
41
,
0x58
,
0xaa
,
0x02
,
0x0c
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x2e
,
0x41
,
0x70
,
0x69
,
0x2e
,
0x56
,
0x
32
,
0xca
,
0x02
,
0x0c
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x5c
,
0x41
,
0x70
,
0x69
,
0x5c
,
0x56
,
0x32
,
0x
e2
,
0x02
,
0x18
,
0x4d
,
0x65
,
0x6d
,
0x6f
,
0x73
,
0x5c
,
0x41
,
0x70
,
0x69
,
0x5c
,
0x56
,
0x32
,
0x5c
,
0x
47
,
0x50
,
0x42
,
0x4d
,
0x65
,
0x74
,
0x61
,
0x64
,
0x61
,
0x74
,
0x61
,
0xea
,
0x02
,
0x0e
,
0x4d
,
0x65
,
0x6
d
,
0x6f
,
0x73
,
0x3a
,
0x3a
,
0x41
,
0x70
,
0x69
,
0x3a
,
0x3a
,
0x56
,
0x32
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
var
(
...
...
server/route/api/v2/apidocs.swagger.md
View file @
ed89cb83
...
...
@@ -143,6 +143,24 @@ UpdateInbox updates an inbox.
### /api/v2/{name_1}
#### GET
##### Summary
GetMemo gets a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name_1 | path | The name of the memo. Format: memos/{uid} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2GetMemoResponse
](
#v2getmemoresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### DELETE
##### Summary
...
...
@@ -223,326 +241,326 @@ CreateMemo creates a memo.
| 200 | A successful response. |
[
v2CreateMemoResponse
](
#v2creatememoresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/memos/
name/{name}
### /api/v2/memos/
stats
#### GET
##### Summary
Get
MemoByName gets a memo by name
.
Get
UserMemosStats gets stats of memos for a user
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | path | | Yes | string |
| name | query | name is the name of the user to get stats for. Format: users/{uid} | No | string |
| timezone | query | timezone location Format: uses tz identifier https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | No | string |
| filter | query | Same as ListMemosRequest.filter | No | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2Get
MemoByNameResponse
](
#v2getmemobyname
response
)
|
| 200 | A successful response. |
[
v2Get
UserMemosStatsResponse
](
#v2getusermemosstats
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/memos
/stats
### /api/v2/memos
:export
####
GE
T
####
POS
T
##### Summary
GetUserMemosStats gets stats of memos for a user
.
ExportMemos exports memos
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | query | name is the name of the user to get stats for. Format: users/{username} | No | string |
| timezone | query | timezone location Format: uses tz identifier https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | No | string |
| filter | query | Same as ListMemosRequest.filter | No | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
GetUserMemosStatsResponse
](
#v2getusermemosstat
sresponse
)
|
| 200 | A successful response. |
[
v2
ExportMemosResponse
](
#v2exportmemo
sresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/memos
/{id}
### /api/v2/memos
:search
#### GET
##### Summary
GetMemo gets a memo by id
.
SearchMemosRequest searches memos
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
id | path | | Yes | integer
|
|
filter | query | Filter is used to filter memos returned. Format: "creator == users/{uid} && visibilities ==
[
'PUBLIC', 'PROTECTED'
]
" | No | string
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
GetMemoResponse
](
#v2getmemo
response
)
|
| 200 | A successful response. |
[
v2
SearchMemosResponse
](
#v2searchmemos
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### DELETE
### /api/v2/{memo.name}
#### PATCH
##### Summary
DeleteMemo deletes a memo by id
.
UpdateMemo updates a memo
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | | Yes | integer |
| memo.name | path | The name of the memo. Format: memos/{uid} | Yes | string |
| memo | body | | Yes | {
**"resourceId"**
: string,
**"rowStatus"**
:
[
apiv2RowStatus
](
#apiv2rowstatus
)
,
**"creator"**
: string,
**"createTime"**
: dateTime,
**"updateTime"**
: dateTime,
**"displayTime"**
: dateTime,
**"content"**
: string,
**"visibility"**
:
[
v2Visibility
](
#v2visibility
)
,
**"pinned"**
: boolean,
**"parentId"**
: integer,
**"resources"**
:
[
[v2Resource
](
#v2resource
)
],
**"relations"**
:
[
[v2MemoRelation
](
#v2memorelation
)
],
**"reactions"**
:
[
[apiv2Reaction
](
#apiv2reaction
)
] } |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
DeleteMemoResponse
](
#v2dele
tememoresponse
)
|
| 200 | A successful response. |
[
v2
UpdateMemoResponse
](
#v2upda
tememoresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/
memos/{id}/comments
### /api/v2/
{name_1}
#### GET
##### Summary
ListMemoComments lists comments for
a memo.
GetMemo gets
a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
id | path | | Yes | integer
|
|
name_1 | path | The name of the memo. Format: memos/{uid} | Yes | string
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
ListMemoCommentsResponse
](
#v2listmemocomments
response
)
|
| 200 | A successful response. |
[
v2
GetMemoResponse
](
#v2getmemo
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
####
POST
####
DELETE
##### Summary
CreateMemoComment creates a comment for a memo
.
DeleteInbox deletes an inbox
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | id is the memo id to create comment for. | Yes | integer |
| create.content | query | | No | string |
| create.visibility | query | | No | string |
| name_1 | path | The name of the inbox to delete. Format: inboxes/{uid} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
CreateMemoCommentResponse
](
#v2creatememocomment
response
)
|
| 200 | A successful response. |
[
v2
DeleteInboxResponse
](
#v2deleteinbox
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/
memos/{id}/reactions
### /api/v2/
{name_2}
####
GET
####
DELETE
##### Summary
ListMemoReactions lists reactions for
a memo.
DeleteMemo deletes
a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
id | path | | Yes | integer
|
|
name_2 | path | The name of the memo. Format: memos/{uid} | Yes | string
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
ListMemoReactionsResponse
](
#v2listmemoreactions
response
)
|
| 200 | A successful response. |
[
v2
DeleteMemoResponse
](
#v2deletememo
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### POST
### /api/v2/{name}/comments
#### GET
##### Summary
UpsertMemoReaction upserts a reaction
for a memo.
ListMemoComments lists comments
for a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | | Yes | integer |
| reaction.id | query | | No | integer |
| reaction.creator | query | The name of the creator. Format: users/{uid} | No | string |
| reaction.contentId | query | | No | string |
| reaction.reactionType | query | | No | string |
| name | path | The name of the memo. Format: memos/{uid} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
UpsertMemoReactionResponse
](
#v2upsertmemoreaction
response
)
|
| 200 | A successful response. |
[
v2
ListMemoCommentsResponse
](
#v2listmemocomments
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/memos/{id}/reactions/{reactionId}
#### DELETE
#### POST
##### Summary
DeleteMemoReaction deletes a reaction
for a memo.
CreateMemoComment creates a comment
for a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | | Yes | integer |
| reactionId | path | | Yes | integer |
| name | path | The name of the memo. Format: memos/{uid} | Yes | string |
| comment.content | query | | No | string |
| comment.visibility | query | | No | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
DeleteMemoReactionResponse
](
#v2deletememoreaction
response
)
|
| 200 | A successful response. |
[
v2
CreateMemoCommentResponse
](
#v2creatememocomment
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/
memos/{id}/rela
tions
### /api/v2/
{name}/reac
tions
#### GET
##### Summary
ListMemoRe
lations lists rela
tions for a memo.
ListMemoRe
actions lists reac
tions for a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
id | path | | Yes | integer
|
|
name | path | The name of the memo. Format: memos/{uid} | Yes | string
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2ListMemoRe
lationsResponse
](
#v2listmemorela
tionsresponse
)
|
| 200 | A successful response. |
[
v2ListMemoRe
actionsResponse
](
#v2listmemoreac
tionsresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### POST
##### Summary
SetMemoRelations sets relations
for a memo.
UpsertMemoReaction upserts a reaction
for a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | | Yes | integer |
| body | body | | Yes |
[
MemoServiceSetMemoRelationsBody
](
#memoservicesetmemorelationsbody
)
|
| name | path | The name of the memo. Format: memos/{uid} | Yes | string |
| reaction.id | query | | No | integer |
| reaction.creator | query | The name of the creator. Format: users/{uid} | No | string |
| reaction.contentId | query | | No | string |
| reaction.reactionType | query | | No | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
SetMemoRelationsResponse
](
#v2setmemorelations
response
)
|
| 200 | A successful response. |
[
v2
UpsertMemoReactionResponse
](
#v2upsertmemoreaction
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/
memos/{id}/resources
### /api/v2/
{name}/reactions/{reactionId}
####
GET
####
DELETE
##### Summary
ListMemoResources lists resources
for a memo.
DeleteMemoReaction deletes a reaction
for a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | | Yes | integer |
| name | path | The name of the memo. Format: memos/{uid} | Yes | string |
| reactionId | path | | Yes | integer |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
ListMemoResourcesResponse
](
#v2listmemoresources
response
)
|
| 200 | A successful response. |
[
v2
DeleteMemoReactionResponse
](
#v2deletememoreaction
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### POST
### /api/v2/{name}/relations
#### GET
##### Summary
SetMemoResources sets resource
s for a memo.
ListMemoRelations lists relation
s for a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| id | path | | Yes | integer |
| body | body | | Yes |
[
MemoServiceSetMemoResourcesBody
](
#memoservicesetmemoresourcesbody
)
|
| name | path | The name of the memo. Format: memos/{uid} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
SetMemoResourcesResponse
](
#v2setmemoresource
sresponse
)
|
| 200 | A successful response. |
[
v2
ListMemoRelationsResponse
](
#v2listmemorelation
sresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/memos/{memo.id}
#### PATCH
#### POST
##### Summary
UpdateMemo updates
a memo.
SetMemoRelations sets relations for
a memo.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
memo.id | path | id is the system generated unique identifier. | Yes | integer
|
|
memo | body | | Yes | {
**"name"**
: string,
**"rowStatus"**
:
[
apiv2RowStatus
](
#apiv2rowstatus
)
,
**"creator"**
: string,
**"createTime"**
: dateTime,
**"updateTime"**
: dateTime,
**"displayTime"**
: dateTime,
**"content"**
: string,
**"visibility"**
:
[
v2Visibility
](
#v2visibility
)
,
**"pinned"**
: boolean,
**"parentId"**
: integer,
**"resources"**
:
[
[v2Resource
](
#v2resource
)
],
**"relations"**
:
[
[v2MemoRelation
](
#v2memorelation
)
],
**"reactions"**
:
[
[apiv2Reaction
](
#apiv2reaction
)
] }
|
|
name | path | The name of the memo. Format: memos/{uid} | Yes | string
|
|
body | body | | Yes |
[
MemoServiceSetMemoRelationsBody
](
#memoservicesetmemorelationsbody
)
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
UpdateMemoResponse
](
#v2updatememo
response
)
|
| 200 | A successful response. |
[
v2
SetMemoRelationsResponse
](
#v2setmemorelations
response
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/
memos:export
### /api/v2/
{name}/resources
####
POS
T
####
GE
T
##### Summary
ExportMemos exports memos
.
ListMemoResources lists resources for a memo
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
filter | query | Same as ListMemosRequest.filter | No
| string |
|
name | path | The name of the memo. Format: memos/{uid} | Yes
| string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
ExportMemosResponse
](
#v2exportmemo
sresponse
)
|
| 200 | A successful response. |
[
v2
ListMemoResourcesResponse
](
#v2listmemoresource
sresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/memos:search
#### GET
#### POST
##### Summary
Se
archMemosRequest searches memos
.
Se
tMemoResources sets resources for a memo
.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| filter | query | Filter is used to filter memos returned. Format: "creator == users/{uid} && visibilities ==
[
'PUBLIC', 'PROTECTED'
]
" | No | string |
| name | path | The name of the memo. Format: memos/{uid} | Yes | string |
| body | body | | Yes |
[
MemoServiceSetMemoResourcesBody
](
#memoservicesetmemoresourcesbody
)
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2Se
archMemosResponse
](
#v2searchmemo
sresponse
)
|
| 200 | A successful response. |
[
v2Se
tMemoResourcesResponse
](
#v2setmemoresource
sresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
---
...
...
@@ -1439,12 +1457,6 @@ GetActivity returns the activity with the given id.
| ---- | ---- | ----------- | -------- |
| linkMetadata |
[
v2LinkMetadata
](
#v2linkmetadata
)
| | No |
#### v2GetMemoByNameResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| memo |
[
v2Memo
](
#v2memo
)
| | No |
#### v2GetMemoResponse
| Name | Type | Description | Required |
...
...
@@ -1608,8 +1620,8 @@ GetActivity returns the activity with the given id.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
|
id | integer | id is the system generated unique identifier.
| No |
|
name | string | name is the user provided name.
| No |
|
name | string |
| No |
|
resourceId | string |
| No |
| rowStatus |
[
apiv2RowStatus
](
#apiv2rowstatus
)
| | No |
| creator | string | | No |
| createTime | dateTime | | No |
...
...
@@ -1627,8 +1639,8 @@ GetActivity returns the activity with the given id.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| memo
Id | integer
| | No |
| relatedMemo
Id | integer
| | No |
| memo
| string
| | No |
| relatedMemo
| string
| | No |
| type |
[
v2MemoRelationType
](
#v2memorelationtype
)
| | No |
#### v2MemoRelationType
...
...
server/route/api/v2/apidocs.swagger.yaml
View file @
ed89cb83
...
...
@@ -2130,12 +2130,16 @@ definitions:
v2MemoRelation
:
type
:
object
properties
:
memoId
:
type
:
integer
format
:
int32
relatedMemoId
:
type
:
integer
format
:
int32
memo
:
type
:
string
title
:
|-
The name of memo.
Format: "memos/{uid}"
relatedMemo
:
type
:
string
title
:
|-
The name of related memo.
Format: "memos/{uid}"
type
:
$ref
:
'
#/definitions/v2MemoRelationType'
v2MemoRelationType
:
...
...
server/route/api/v2/memo_relation_service.go
View file @
ed89cb83
...
...
@@ -2,6 +2,7 @@ package v2
import
(
"context"
"fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
...
...
@@ -26,7 +27,7 @@ func (s *APIV2Service) SetMemoRelations(ctx context.Context, request *apiv2pb.Se
for
_
,
relation
:=
range
request
.
Relations
{
// Ignore reflexive relations.
if
id
==
relation
.
RelatedMemoId
{
if
request
.
Name
==
relation
.
RelatedMemo
{
continue
}
// Ignore comment relations as there's no need to update a comment's relation.
...
...
@@ -34,9 +35,13 @@ func (s *APIV2Service) SetMemoRelations(ctx context.Context, request *apiv2pb.Se
if
relation
.
Type
==
apiv2pb
.
MemoRelation_COMMENT
{
continue
}
relatedMemoID
,
err
:=
ExtractMemoIDFromName
(
relation
.
RelatedMemo
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid related memo name: %v"
,
err
)
}
if
_
,
err
:=
s
.
Store
.
UpsertMemoRelation
(
ctx
,
&
store
.
MemoRelation
{
MemoID
:
id
,
RelatedMemoID
:
relat
ion
.
RelatedMemoId
,
RelatedMemoID
:
relat
edMemoID
,
Type
:
convertMemoRelationTypeToStore
(
relation
.
Type
),
});
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to upsert memo relation"
)
...
...
@@ -79,9 +84,9 @@ func (s *APIV2Service) ListMemoRelations(ctx context.Context, request *apiv2pb.L
func
convertMemoRelationFromStore
(
memoRelation
*
store
.
MemoRelation
)
*
apiv2pb
.
MemoRelation
{
return
&
apiv2pb
.
MemoRelation
{
Memo
Id
:
memoRelation
.
MemoID
,
RelatedMemo
Id
:
memoRelation
.
RelatedMemoID
,
Type
:
convertMemoRelationTypeFromStore
(
memoRelation
.
Type
),
Memo
:
fmt
.
Sprintf
(
"%s%d"
,
MemoNamePrefix
,
memoRelation
.
MemoID
)
,
RelatedMemo
:
fmt
.
Sprintf
(
"%s%d"
,
MemoNamePrefix
,
memoRelation
.
RelatedMemoID
)
,
Type
:
convertMemoRelationTypeFromStore
(
memoRelation
.
Type
),
}
}
...
...
server/route/api/v2/memo_service.go
View file @
ed89cb83
...
...
@@ -883,17 +883,6 @@ func convertMemoToWebhookPayload(memo *apiv2pb.Memo) (*webhook.WebhookPayload, e
}
return
resources
}(),
RelationList
:
func
()
[]
*
webhook
.
MemoRelation
{
relations
:=
[]
*
webhook
.
MemoRelation
{}
for
_
,
relation
:=
range
memo
.
Relations
{
relations
=
append
(
relations
,
&
webhook
.
MemoRelation
{
MemoID
:
relation
.
MemoId
,
RelatedMemoID
:
relation
.
RelatedMemoId
,
Type
:
relation
.
Type
.
String
(),
})
}
return
relations
}(),
},
},
nil
}
web/src/components/MemoEditor/ActionButton/AddMemoRelationButton.tsx
View file @
ed89cb83
...
...
@@ -5,7 +5,7 @@ import toast from "react-hot-toast";
import
showCreateMemoRelationDialog
from
"@/components/CreateMemoRelationDialog"
;
import
Icon
from
"@/components/Icon"
;
import
{
UNKNOWN_ID
}
from
"@/helpers/consts"
;
import
{
extractMemoIdFromName
}
from
"@/store/v1"
;
import
{
MemoNamePrefix
}
from
"@/store/v1"
;
import
{
MemoRelation_Type
}
from
"@/types/proto/api/v2/memo_relation_service"
;
import
{
EditorRefActions
}
from
"../Editor"
;
import
{
MemoEditorContext
}
from
"../types"
;
...
...
@@ -47,12 +47,12 @@ const AddMemoRelationButton = (props: Props) => {
uniqBy
(
[
...
memos
.
map
((
memo
)
=>
({
memo
Id
:
context
.
memoId
||
UNKNOWN_ID
,
relatedMemo
Id
:
extractMemoIdFromName
(
memo
.
name
)
,
memo
:
`
${
MemoNamePrefix
}${
context
.
memoId
||
UNKNOWN_ID
}
`
,
relatedMemo
:
memo
.
name
,
type
:
MemoRelation_Type
.
REFERENCE
,
})),
...
context
.
relationList
,
].
filter
((
relation
)
=>
relation
.
relatedMemo
Id
!==
(
context
.
memoId
||
UNKNOWN_ID
)
),
].
filter
((
relation
)
=>
relation
.
relatedMemo
!==
`
${
MemoNamePrefix
}${
context
.
memoId
||
UNKNOWN_ID
}
`
),
"relatedMemoId"
,
),
);
...
...
web/src/components/MemoEditor/RelationListView.tsx
View file @
ed89cb83
import
{
useEffect
,
useState
}
from
"react"
;
import
{
MemoNamePrefix
,
extractMemoIdFromName
,
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
MemoRelation
,
MemoRelation_Type
}
from
"@/types/proto/api/v2/memo_relation_service"
;
import
{
Memo
}
from
"@/types/proto/api/v2/memo_service"
;
import
Icon
from
"../Icon"
;
...
...
@@ -19,7 +19,7 @@ const RelationListView = (props: Props) => {
const
requests
=
relationList
.
filter
((
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
REFERENCE
)
.
map
(
async
(
relation
)
=>
{
return
await
memoStore
.
getOrFetchMemoByName
(
`
${
MemoNamePrefix
}${
relation
.
relatedMemoId
}
`
,
{
skipStore
:
true
});
return
await
memoStore
.
getOrFetchMemoByName
(
relation
.
relatedMemo
,
{
skipStore
:
true
});
});
const
list
=
await
Promise
.
all
(
requests
);
setReferencingMemoList
(
list
);
...
...
@@ -27,7 +27,7 @@ const RelationListView = (props: Props) => {
},
[
relationList
]);
const
handleDeleteRelation
=
async
(
memo
:
Memo
)
=>
{
setRelationList
(
relationList
.
filter
((
relation
)
=>
relation
.
relatedMemo
Id
!==
extractMemoIdFromName
(
memo
.
name
)
));
setRelationList
(
relationList
.
filter
((
relation
)
=>
relation
.
relatedMemo
!==
memo
.
name
));
};
return
(
...
...
web/src/components/MemoEditor/index.tsx
View file @
ed89cb83
...
...
@@ -75,7 +75,10 @@ const MemoEditor = (props: Props) => {
const
[
contentCache
,
setContentCache
]
=
useLocalStorage
<
string
>
(
contentCacheKey
,
""
);
const
referenceRelations
=
memoId
?
state
.
relationList
.
filter
(
(
relation
)
=>
relation
.
memoId
===
memoId
&&
relation
.
relatedMemoId
!==
memoId
&&
relation
.
type
===
MemoRelation_Type
.
REFERENCE
,
(
relation
)
=>
extractMemoIdFromName
(
relation
.
memo
)
===
memoId
&&
extractMemoIdFromName
(
relation
.
relatedMemo
)
!==
memoId
&&
relation
.
type
===
MemoRelation_Type
.
REFERENCE
,
)
:
state
.
relationList
.
filter
((
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
REFERENCE
);
...
...
web/src/components/MemoRelationListView.tsx
View file @
ed89cb83
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
memo
,
useEffect
,
useState
}
from
"react"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
MemoNamePrefix
,
extractMemoIdFromName
,
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
MemoRelation
}
from
"@/types/proto/api/v2/memo_relation_service"
;
import
{
Memo
}
from
"@/types/proto/api/v2/memo_service"
;
import
Icon
from
"./Icon"
;
...
...
@@ -21,20 +21,14 @@ const MemoRelationListView = (props: Props) => {
(
async
()
=>
{
const
referencingMemoList
=
await
Promise
.
all
(
relationList
.
filter
(
(
relation
)
=>
relation
.
memoId
===
extractMemoIdFromName
(
memo
.
name
)
&&
relation
.
relatedMemoId
!==
extractMemoIdFromName
(
memo
.
name
),
)
.
map
((
relation
)
=>
memoStore
.
getOrFetchMemoByName
(
`
${
MemoNamePrefix
}${
relation
.
relatedMemoId
}
`
,
{
skipStore
:
true
})),
.
filter
((
relation
)
=>
relation
.
memo
===
memo
.
name
&&
relation
.
relatedMemo
!==
memo
.
name
)
.
map
((
relation
)
=>
memoStore
.
getOrFetchMemoByName
(
relation
.
relatedMemo
,
{
skipStore
:
true
})),
);
setReferencingMemoList
(
referencingMemoList
);
const
referencedMemoList
=
await
Promise
.
all
(
relationList
.
filter
(
(
relation
)
=>
relation
.
memoId
!==
extractMemoIdFromName
(
memo
.
name
)
&&
relation
.
relatedMemoId
===
extractMemoIdFromName
(
memo
.
name
),
)
.
map
((
relation
)
=>
memoStore
.
getOrFetchMemoByName
(
`
${
MemoNamePrefix
}${
relation
.
memoId
}
`
,
{
skipStore
:
true
})),
.
filter
((
relation
)
=>
relation
.
memo
!==
memo
.
name
&&
relation
.
relatedMemo
===
memo
.
name
)
.
map
((
relation
)
=>
memoStore
.
getOrFetchMemoByName
(
relation
.
memo
,
{
skipStore
:
true
})),
);
setReferencedMemoList
(
referencedMemoList
);
})();
...
...
web/src/components/MemoView.tsx
View file @
ed89cb83
...
...
@@ -41,7 +41,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
const
memoContainerRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
referencedMemos
=
memo
.
relations
.
filter
((
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
REFERENCE
);
const
commentAmount
=
memo
.
relations
.
filter
(
(
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
COMMENT
&&
relation
.
relatedMemo
Id
===
extractMemoIdFromName
(
memo
.
name
)
,
(
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
COMMENT
&&
relation
.
relatedMemo
===
memo
.
name
,
).
length
;
const
readonly
=
memo
.
creator
!==
user
?.
name
;
const
isInMemoDetailPage
=
location
.
pathname
.
startsWith
(
`/m/
${
memo
.
name
}
`
);
...
...
web/src/pages/MemoDetail.tsx
View file @
ed89cb83
...
...
@@ -23,12 +23,8 @@ const MemoDetail = () => {
const
memo
=
memoStore
.
getMemoByResourceId
(
resourceId
||
""
);
const
[
parentMemo
,
setParentMemo
]
=
useState
<
Memo
|
undefined
>
(
undefined
);
const
commentRelations
=
memo
?.
relations
.
filter
(
(
relation
)
=>
relation
.
relatedMemoId
===
extractMemoIdFromName
(
memo
.
name
)
&&
relation
.
type
===
MemoRelation_Type
.
COMMENT
,
)
||
[];
const
comments
=
commentRelations
.
map
((
relation
)
=>
memoStore
.
getMemoByName
(
`
${
MemoNamePrefix
}${
relation
.
memoId
}
`
))
.
filter
((
memo
)
=>
memo
)
as
any
as
Memo
[];
memo
?.
relations
.
filter
((
relation
)
=>
relation
.
relatedMemo
===
memo
.
name
&&
relation
.
type
===
MemoRelation_Type
.
COMMENT
)
||
[];
const
comments
=
commentRelations
.
map
((
relation
)
=>
memoStore
.
getMemoByName
(
relation
.
memo
)).
filter
((
memo
)
=>
memo
)
as
any
as
Memo
[];
// Prepare memo.
useEffect
(()
=>
{
...
...
@@ -56,7 +52,7 @@ const MemoDetail = () => {
}
else
{
setParentMemo
(
undefined
);
}
await
Promise
.
all
(
commentRelations
.
map
((
relation
)
=>
memoStore
.
getOrFetchMemoByName
(
`
${
MemoNamePrefix
}${
relation
.
memoId
}
`
)));
await
Promise
.
all
(
commentRelations
.
map
((
relation
)
=>
memoStore
.
getOrFetchMemoByName
(
relation
.
memo
)));
})();
},
[
memo
]);
...
...
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