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
fc5d5cf2
Unverified
Commit
fc5d5cf2
authored
Oct 21, 2022
by
Zeng1998
Committed by
GitHub
Oct 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: patch memo with resource list (#328)
fix: 修改memo时添加图片不显示
parent
2a4fc7dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
memo.go
api/memo.go
+3
-0
memo.go
server/memo.go
+14
-0
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+1
-0
memo.d.ts
web/src/types/modules/memo.d.ts
+1
-0
No files found.
api/memo.go
View file @
fc5d5cf2
...
@@ -67,6 +67,9 @@ type MemoPatch struct {
...
@@ -67,6 +67,9 @@ type MemoPatch struct {
// Domain specific fields
// Domain specific fields
Content
*
string
`json:"content"`
Content
*
string
`json:"content"`
Visibility
*
Visibility
`json:"visibility"`
Visibility
*
Visibility
`json:"visibility"`
// Related fields
ResourceIDList
[]
int
`json:"resourceIdList"`
}
}
type
MemoFind
struct
{
type
MemoFind
struct
{
...
...
server/memo.go
View file @
fc5d5cf2
...
@@ -116,6 +116,20 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
...
@@ -116,6 +116,20 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to patch memo"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to patch memo"
)
.
SetInternal
(
err
)
}
}
for
_
,
resourceID
:=
range
memoPatch
.
ResourceIDList
{
if
_
,
err
:=
s
.
Store
.
UpsertMemoResource
(
ctx
,
&
api
.
MemoResourceUpsert
{
MemoID
:
memo
.
ID
,
ResourceID
:
resourceID
,
});
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to upsert memo resource"
)
.
SetInternal
(
err
)
}
}
memo
,
err
=
s
.
Store
.
ComposeMemo
(
ctx
,
memo
)
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to compose memo"
)
.
SetInternal
(
err
)
}
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderContentType
,
echo
.
MIMEApplicationJSONCharsetUTF8
)
c
.
Response
()
.
Header
()
.
Set
(
echo
.
HeaderContentType
,
echo
.
MIMEApplicationJSONCharsetUTF8
)
if
err
:=
json
.
NewEncoder
(
c
.
Response
()
.
Writer
)
.
Encode
(
composeResponse
(
memo
));
err
!=
nil
{
if
err
:=
json
.
NewEncoder
(
c
.
Response
()
.
Writer
)
.
Encode
(
composeResponse
(
memo
));
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to encode memo response"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to encode memo response"
)
.
SetInternal
(
err
)
...
...
web/src/components/MemoEditor.tsx
View file @
fc5d5cf2
...
@@ -164,6 +164,7 @@ const MemoEditor: React.FC = () => {
...
@@ -164,6 +164,7 @@ const MemoEditor: React.FC = () => {
await
memoService
.
patchMemo
({
await
memoService
.
patchMemo
({
id
:
prevMemo
.
id
,
id
:
prevMemo
.
id
,
content
,
content
,
resourceIdList
:
state
.
resourceList
.
map
((
resource
)
=>
resource
.
id
),
});
});
}
}
editorStateService
.
clearEditMemo
();
editorStateService
.
clearEditMemo
();
...
...
web/src/types/modules/memo.d.ts
View file @
fc5d5cf2
...
@@ -30,6 +30,7 @@ interface MemoPatch {
...
@@ -30,6 +30,7 @@ interface MemoPatch {
createdTs
?:
TimeStamp
;
createdTs
?:
TimeStamp
;
rowStatus
?:
RowStatus
;
rowStatus
?:
RowStatus
;
content
?:
string
;
content
?:
string
;
resourceIdList
?:
ResourceId
[];
visibility
?:
Visibility
;
visibility
?:
Visibility
;
}
}
...
...
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