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
8e0ce4d6
Commit
8e0ce4d6
authored
Jan 14, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: list memos with pinned
parent
45cf1585
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
20 deletions
+10
-20
memo_service.go
api/v2/memo_service.go
+2
-0
memo.go
store/db/mysql/memo.go
+2
-6
memo.go
store/db/postgres/memo.go
+2
-6
memo.go
store/db/sqlite/memo.go
+2
-6
Explore.tsx
web/src/pages/Explore.tsx
+1
-1
Home.tsx
web/src/pages/Home.tsx
+1
-1
No files found.
api/v2/memo_service.go
View file @
8e0ce4d6
...
@@ -130,6 +130,8 @@ func (s *APIV2Service) ListMemos(ctx context.Context, request *apiv2pb.ListMemos
...
@@ -130,6 +130,8 @@ func (s *APIV2Service) ListMemos(ctx context.Context, request *apiv2pb.ListMemos
if
filter
.
RowStatus
!=
nil
{
if
filter
.
RowStatus
!=
nil
{
memoFind
.
RowStatus
=
filter
.
RowStatus
memoFind
.
RowStatus
=
filter
.
RowStatus
}
}
}
else
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"filter is required"
)
}
}
user
,
_
:=
getCurrentUser
(
ctx
,
s
.
Store
)
user
,
_
:=
getCurrentUser
(
ctx
,
s
.
Store
)
...
...
store/db/mysql/memo.go
View file @
8e0ce4d6
...
@@ -90,7 +90,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -90,7 +90,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
"UNIX_TIMESTAMP(`memo`.`updated_ts`) AS `updated_ts`"
,
"UNIX_TIMESTAMP(`memo`.`updated_ts`) AS `updated_ts`"
,
"`memo`.`row_status` AS `row_status`"
,
"`memo`.`row_status` AS `row_status`"
,
"`memo`.`visibility` AS `visibility`"
,
"`memo`.`visibility` AS `visibility`"
,
"
`memo_organizer`.`pinned`
AS `pinned`"
,
"
IFNULL(`memo_organizer`.`pinned`, 0)
AS `pinned`"
,
"`memo_relation`.`related_memo_id` AS `parent_id`"
,
"`memo_relation`.`related_memo_id` AS `parent_id`"
,
}
}
if
!
find
.
ExcludeContent
{
if
!
find
.
ExcludeContent
{
...
@@ -114,7 +114,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -114,7 +114,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
list
:=
make
([]
*
store
.
Memo
,
0
)
list
:=
make
([]
*
store
.
Memo
,
0
)
for
rows
.
Next
()
{
for
rows
.
Next
()
{
var
memo
store
.
Memo
var
memo
store
.
Memo
pinned
:=
sql
.
NullBool
{}
dests
:=
[]
any
{
dests
:=
[]
any
{
&
memo
.
ID
,
&
memo
.
ID
,
&
memo
.
CreatorID
,
&
memo
.
CreatorID
,
...
@@ -122,7 +121,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -122,7 +121,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
&
memo
.
UpdatedTs
,
&
memo
.
UpdatedTs
,
&
memo
.
RowStatus
,
&
memo
.
RowStatus
,
&
memo
.
Visibility
,
&
memo
.
Visibility
,
&
p
inned
,
&
memo
.
P
inned
,
&
memo
.
ParentID
,
&
memo
.
ParentID
,
}
}
if
!
find
.
ExcludeContent
{
if
!
find
.
ExcludeContent
{
...
@@ -131,9 +130,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -131,9 +130,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
pinned
.
Valid
{
memo
.
Pinned
=
pinned
.
Bool
}
list
=
append
(
list
,
&
memo
)
list
=
append
(
list
,
&
memo
)
}
}
...
...
store/db/postgres/memo.go
View file @
8e0ce4d6
...
@@ -81,7 +81,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -81,7 +81,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
`memo.updated_ts AS updated_ts`
,
`memo.updated_ts AS updated_ts`
,
`memo.row_status AS row_status`
,
`memo.row_status AS row_status`
,
`memo.visibility AS visibility`
,
`memo.visibility AS visibility`
,
`
memo_organizer.pinned
AS pinned`
,
`
COALESCE(memo_organizer.pinned, 0)
AS pinned`
,
`memo_relation.related_memo_id AS parent_id`
,
`memo_relation.related_memo_id AS parent_id`
,
}
}
if
!
find
.
ExcludeContent
{
if
!
find
.
ExcludeContent
{
...
@@ -110,7 +110,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -110,7 +110,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
list
:=
make
([]
*
store
.
Memo
,
0
)
list
:=
make
([]
*
store
.
Memo
,
0
)
for
rows
.
Next
()
{
for
rows
.
Next
()
{
var
memo
store
.
Memo
var
memo
store
.
Memo
pinned
:=
sql
.
NullBool
{}
dests
:=
[]
any
{
dests
:=
[]
any
{
&
memo
.
ID
,
&
memo
.
ID
,
&
memo
.
CreatorID
,
&
memo
.
CreatorID
,
...
@@ -118,7 +117,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -118,7 +117,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
&
memo
.
UpdatedTs
,
&
memo
.
UpdatedTs
,
&
memo
.
RowStatus
,
&
memo
.
RowStatus
,
&
memo
.
Visibility
,
&
memo
.
Visibility
,
&
p
inned
,
&
memo
.
P
inned
,
&
memo
.
ParentID
,
&
memo
.
ParentID
,
}
}
if
!
find
.
ExcludeContent
{
if
!
find
.
ExcludeContent
{
...
@@ -127,9 +126,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -127,9 +126,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
pinned
.
Valid
{
memo
.
Pinned
=
pinned
.
Bool
}
list
=
append
(
list
,
&
memo
)
list
=
append
(
list
,
&
memo
)
}
}
...
...
store/db/sqlite/memo.go
View file @
8e0ce4d6
...
@@ -80,7 +80,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -80,7 +80,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
`memo.updated_ts AS updated_ts`
,
`memo.updated_ts AS updated_ts`
,
`memo.row_status AS row_status`
,
`memo.row_status AS row_status`
,
`memo.visibility AS visibility`
,
`memo.visibility AS visibility`
,
`
memo_organizer.pinned
AS pinned`
,
`
IFNULL(memo_organizer.pinned, 0)
AS pinned`
,
`memo_relation.related_memo_id AS parent_id`
,
`memo_relation.related_memo_id AS parent_id`
,
}
}
if
!
find
.
ExcludeContent
{
if
!
find
.
ExcludeContent
{
...
@@ -109,7 +109,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -109,7 +109,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
list
:=
make
([]
*
store
.
Memo
,
0
)
list
:=
make
([]
*
store
.
Memo
,
0
)
for
rows
.
Next
()
{
for
rows
.
Next
()
{
var
memo
store
.
Memo
var
memo
store
.
Memo
pinned
:=
sql
.
NullBool
{}
dests
:=
[]
any
{
dests
:=
[]
any
{
&
memo
.
ID
,
&
memo
.
ID
,
&
memo
.
CreatorID
,
&
memo
.
CreatorID
,
...
@@ -117,7 +116,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -117,7 +116,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
&
memo
.
UpdatedTs
,
&
memo
.
UpdatedTs
,
&
memo
.
RowStatus
,
&
memo
.
RowStatus
,
&
memo
.
Visibility
,
&
memo
.
Visibility
,
&
p
inned
,
&
memo
.
P
inned
,
&
memo
.
ParentID
,
&
memo
.
ParentID
,
}
}
if
!
find
.
ExcludeContent
{
if
!
find
.
ExcludeContent
{
...
@@ -126,9 +125,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
...
@@ -126,9 +125,6 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
if
err
:=
rows
.
Scan
(
dests
...
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
pinned
.
Valid
{
memo
.
Pinned
=
pinned
.
Bool
}
list
=
append
(
list
,
&
memo
)
list
=
append
(
list
,
&
memo
)
}
}
...
...
web/src/pages/Explore.tsx
View file @
8e0ce4d6
...
@@ -42,9 +42,9 @@ const Explore = () => {
...
@@ -42,9 +42,9 @@ const Explore = () => {
}
}
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
data
=
await
memoStore
.
fetchMemos
({
const
data
=
await
memoStore
.
fetchMemos
({
filter
:
filters
.
join
(
" && "
),
limit
:
DEFAULT_MEMO_LIMIT
,
limit
:
DEFAULT_MEMO_LIMIT
,
offset
:
memoList
.
size
(),
offset
:
memoList
.
size
(),
filter
:
filters
.
join
(
" && "
),
});
});
setIsRequesting
(
false
);
setIsRequesting
(
false
);
setIsComplete
(
data
.
length
<
DEFAULT_MEMO_LIMIT
);
setIsComplete
(
data
.
length
<
DEFAULT_MEMO_LIMIT
);
...
...
web/src/pages/Home.tsx
View file @
8e0ce4d6
...
@@ -52,9 +52,9 @@ const Home = () => {
...
@@ -52,9 +52,9 @@ const Home = () => {
}
}
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
data
=
await
memoStore
.
fetchMemos
({
const
data
=
await
memoStore
.
fetchMemos
({
filter
:
filters
.
join
(
" && "
),
limit
:
DEFAULT_MEMO_LIMIT
,
limit
:
DEFAULT_MEMO_LIMIT
,
offset
:
memoList
.
size
(),
offset
:
memoList
.
size
(),
filter
:
filters
.
join
(
" && "
),
});
});
setIsRequesting
(
false
);
setIsRequesting
(
false
);
setIsComplete
(
data
.
length
<
DEFAULT_MEMO_LIMIT
);
setIsComplete
(
data
.
length
<
DEFAULT_MEMO_LIMIT
);
...
...
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