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
63989ab3
Commit
63989ab3
authored
Sep 25, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add location to memo payload
parent
92c41458
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
845 additions
and
594 deletions
+845
-594
memo_service.proto
proto/api/v1/memo_service.proto
+9
-0
memo_service.pb.go
proto/gen/api/v1/memo_service.pb.go
+659
-562
apidocs.swagger.yaml
proto/gen/apidocs.swagger.yaml
+17
-0
memo.pb.go
proto/gen/store/memo.pb.go
+126
-31
memo.proto
proto/store/memo.proto
+8
-1
memo_service.go
server/router/api/v1/memo_service.go
+26
-0
No files found.
proto/api/v1/memo_service.proto
View file @
63989ab3
...
@@ -188,6 +188,9 @@ message Memo {
...
@@ -188,6 +188,9 @@ message Memo {
// The snippet of the memo content. Plain text only.
// The snippet of the memo content. Plain text only.
string
snippet
=
19
;
string
snippet
=
19
;
// The location of the memo.
optional
Location
location
=
20
;
}
}
message
MemoProperty
{
message
MemoProperty
{
...
@@ -198,6 +201,12 @@ message MemoProperty {
...
@@ -198,6 +201,12 @@ message MemoProperty {
bool
has_incomplete_tasks
=
5
;
bool
has_incomplete_tasks
=
5
;
}
}
message
Location
{
string
placeholder
=
1
;
double
latitude
=
2
;
double
longitude
=
3
;
}
message
CreateMemoRequest
{
message
CreateMemoRequest
{
string
content
=
1
;
string
content
=
1
;
...
...
proto/gen/api/v1/memo_service.pb.go
View file @
63989ab3
This source diff could not be displayed because it is too large. You can
view the blob
instead.
proto/gen/apidocs.swagger.yaml
View file @
63989ab3
...
@@ -872,6 +872,9 @@ paths:
...
@@ -872,6 +872,9 @@ paths:
snippet
:
snippet
:
type
:
string
type
:
string
description
:
The snippet of the memo content. Plain text only.
description
:
The snippet of the memo content. Plain text only.
location
:
$ref
:
'
#/definitions/apiv1Location'
description
:
The location of the memo.
tags
:
tags
:
-
MemoService
-
MemoService
/api/v1/{name_1}
:
/api/v1/{name_1}
:
...
@@ -2000,6 +2003,17 @@ definitions:
...
@@ -2000,6 +2003,17 @@ definitions:
-
TYPE_UNSPECIFIED
-
TYPE_UNSPECIFIED
-
OAUTH2
-
OAUTH2
default
:
TYPE_UNSPECIFIED
default
:
TYPE_UNSPECIFIED
apiv1Location
:
type
:
object
properties
:
placeholder
:
type
:
string
latitude
:
type
:
number
format
:
double
longitude
:
type
:
number
format
:
double
apiv1OAuth2Config
:
apiv1OAuth2Config
:
type
:
object
type
:
object
properties
:
properties
:
...
@@ -2697,6 +2711,9 @@ definitions:
...
@@ -2697,6 +2711,9 @@ definitions:
snippet
:
snippet
:
type
:
string
type
:
string
description
:
The snippet of the memo content. Plain text only.
description
:
The snippet of the memo content. Plain text only.
location
:
$ref
:
'
#/definitions/apiv1Location'
description
:
The location of the memo.
v1MemoProperty
:
v1MemoProperty
:
type
:
object
type
:
object
properties
:
properties
:
...
...
proto/gen/store/memo.pb.go
View file @
63989ab3
This diff is collapsed.
Click to expand it.
proto/store/memo.proto
View file @
63989ab3
...
@@ -5,9 +5,10 @@ package memos.store;
...
@@ -5,9 +5,10 @@ package memos.store;
option
go_package
=
"gen/store"
;
option
go_package
=
"gen/store"
;
message
MemoPayload
{
message
MemoPayload
{
// property is the memo's property.
Property
property
=
1
;
Property
property
=
1
;
Location
location
=
2
;
message
Property
{
message
Property
{
repeated
string
tags
=
1
;
repeated
string
tags
=
1
;
bool
has_link
=
2
;
bool
has_link
=
2
;
...
@@ -15,4 +16,10 @@ message MemoPayload {
...
@@ -15,4 +16,10 @@ message MemoPayload {
bool
has_code
=
4
;
bool
has_code
=
4
;
bool
has_incomplete_tasks
=
5
;
bool
has_incomplete_tasks
=
5
;
}
}
message
Location
{
string
placeholder
=
1
;
double
latitude
=
2
;
double
longitude
=
3
;
}
}
}
server/router/api/v1/memo_service.go
View file @
63989ab3
...
@@ -327,6 +327,9 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR
...
@@ -327,6 +327,9 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"failed to set memo relations"
)
return
nil
,
errors
.
Wrap
(
err
,
"failed to set memo relations"
)
}
}
}
else
if
path
==
"location"
{
memo
.
Payload
.
Location
=
convertLocationToStore
(
request
.
Memo
.
Location
)
update
.
Payload
=
memo
.
Payload
}
}
}
}
...
@@ -810,6 +813,7 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem
...
@@ -810,6 +813,7 @@ func (s *APIV1Service) convertMemoFromStore(ctx context.Context, memo *store.Mem
}
}
if
memo
.
Payload
!=
nil
{
if
memo
.
Payload
!=
nil
{
memoMessage
.
Property
=
convertMemoPropertyFromStore
(
memo
.
Payload
.
Property
)
memoMessage
.
Property
=
convertMemoPropertyFromStore
(
memo
.
Payload
.
Property
)
memoMessage
.
Location
=
convertLocationFromStore
(
memo
.
Payload
.
Location
)
}
}
if
memo
.
ParentID
!=
nil
{
if
memo
.
ParentID
!=
nil
{
parent
:=
fmt
.
Sprintf
(
"%s%d"
,
MemoNamePrefix
,
*
memo
.
ParentID
)
parent
:=
fmt
.
Sprintf
(
"%s%d"
,
MemoNamePrefix
,
*
memo
.
ParentID
)
...
@@ -831,6 +835,28 @@ func convertMemoPropertyFromStore(property *storepb.MemoPayload_Property) *v1pb.
...
@@ -831,6 +835,28 @@ func convertMemoPropertyFromStore(property *storepb.MemoPayload_Property) *v1pb.
}
}
}
}
func
convertLocationFromStore
(
location
*
storepb
.
MemoPayload_Location
)
*
v1pb
.
Location
{
if
location
==
nil
{
return
nil
}
return
&
v1pb
.
Location
{
Placeholder
:
location
.
Placeholder
,
Latitude
:
location
.
Latitude
,
Longitude
:
location
.
Longitude
,
}
}
func
convertLocationToStore
(
location
*
v1pb
.
Location
)
*
storepb
.
MemoPayload_Location
{
if
location
==
nil
{
return
nil
}
return
&
storepb
.
MemoPayload_Location
{
Placeholder
:
location
.
Placeholder
,
Latitude
:
location
.
Latitude
,
Longitude
:
location
.
Longitude
,
}
}
func
convertVisibilityFromStore
(
visibility
store
.
Visibility
)
v1pb
.
Visibility
{
func
convertVisibilityFromStore
(
visibility
store
.
Visibility
)
v1pb
.
Visibility
{
switch
visibility
{
switch
visibility
{
case
store
.
Private
:
case
store
.
Private
:
...
...
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