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
164873b3
Unverified
Commit
164873b3
authored
Jun 14, 2022
by
STEVEN
Committed by
GitHub
Jun 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: find memo by tag (#74)
parent
8df0711f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
memo.go
api/memo.go
+2
-1
memo.go
server/memo.go
+4
-0
webhook.go
server/webhook.go
+9
-0
memo.go
store/memo.go
+3
-0
No files found.
api/memo.go
View file @
164873b3
...
@@ -42,7 +42,8 @@ type MemoFind struct {
...
@@ -42,7 +42,8 @@ type MemoFind struct {
CreatorID
*
int
`json:"creatorId"`
CreatorID
*
int
`json:"creatorId"`
// Domain specific fields
// Domain specific fields
Pinned
*
bool
Pinned
*
bool
Tag
*
string
}
}
type
MemoDelete
struct
{
type
MemoDelete
struct
{
...
...
server/memo.go
View file @
164873b3
...
@@ -75,6 +75,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
...
@@ -75,6 +75,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
pinned
:=
pinnedStr
==
"true"
pinned
:=
pinnedStr
==
"true"
memoFind
.
Pinned
=
&
pinned
memoFind
.
Pinned
=
&
pinned
}
}
tag
:=
c
.
QueryParam
(
"tag"
)
if
tag
!=
""
{
memoFind
.
Tag
=
&
tag
}
list
,
err
:=
s
.
Store
.
FindMemoList
(
memoFind
)
list
,
err
:=
s
.
Store
.
FindMemoList
(
memoFind
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
server/webhook.go
View file @
164873b3
...
@@ -107,6 +107,15 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
...
@@ -107,6 +107,15 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
if
rowStatus
!=
""
{
if
rowStatus
!=
""
{
memoFind
.
RowStatus
=
&
rowStatus
memoFind
.
RowStatus
=
&
rowStatus
}
}
pinnedStr
:=
c
.
QueryParam
(
"pinned"
)
if
pinnedStr
!=
""
{
pinned
:=
pinnedStr
==
"true"
memoFind
.
Pinned
=
&
pinned
}
tag
:=
c
.
QueryParam
(
"tag"
)
if
tag
!=
""
{
memoFind
.
Tag
=
&
tag
}
list
,
err
:=
s
.
Store
.
FindMemoList
(
memoFind
)
list
,
err
:=
s
.
Store
.
FindMemoList
(
memoFind
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
store/memo.go
View file @
164873b3
...
@@ -209,6 +209,9 @@ func findMemoRawList(db *sql.DB, find *api.MemoFind) ([]*memoRaw, error) {
...
@@ -209,6 +209,9 @@ func findMemoRawList(db *sql.DB, find *api.MemoFind) ([]*memoRaw, error) {
if
v
:=
find
.
Pinned
;
v
!=
nil
{
if
v
:=
find
.
Pinned
;
v
!=
nil
{
where
=
append
(
where
,
"id in (SELECT memo_id FROM memo_organizer WHERE pinned = 1 AND user_id = memo.creator_id )"
)
where
=
append
(
where
,
"id in (SELECT memo_id FROM memo_organizer WHERE pinned = 1 AND user_id = memo.creator_id )"
)
}
}
if
v
:=
find
.
Tag
;
v
!=
nil
{
where
,
args
=
append
(
where
,
"content LIKE ?"
),
append
(
args
,
"%#"
+*
v
+
"%"
)
}
rows
,
err
:=
db
.
Query
(
`
rows
,
err
:=
db
.
Query
(
`
SELECT
SELECT
...
...
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