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
b1e196bb
Commit
b1e196bb
authored
Apr 08, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: delete memo reaction
parent
6d10251c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
196 additions
and
245 deletions
+196
-245
memo_service.proto
proto/api/v2/memo_service.proto
+3
-7
README.md
proto/gen/api/v2/README.md
+0
-1
memo_service.pb.go
proto/gen/api/v2/memo_service.pb.go
+168
-180
memo_service.pb.gw.go
proto/gen/api/v2/memo_service.pb.gw.go
+3
-23
apidocs.swagger.yaml
server/route/api/v2/apidocs.swagger.yaml
+21
-29
reaction_service.go
server/route/api/v2/reaction_service.go
+1
-5
No files found.
proto/api/v2/memo_service.proto
View file @
b1e196bb
...
...
@@ -105,8 +105,8 @@ service MemoService {
}
// DeleteMemoReaction deletes a reaction for a memo.
rpc
DeleteMemoReaction
(
DeleteMemoReactionRequest
)
returns
(
DeleteMemoReactionResponse
)
{
option
(
google.api.http
)
=
{
delete
:
"/api/v2/
{name=memos/*}/
reactions/{reaction_id}"
};
option
(
google.api.method_signature
)
=
"
name,
reaction_id"
;
option
(
google.api.http
)
=
{
delete
:
"/api/v2/reactions/{reaction_id}"
};
option
(
google.api.method_signature
)
=
"reaction_id"
;
}
}
...
...
@@ -339,11 +339,7 @@ message UpsertMemoReactionResponse {
}
message
DeleteMemoReactionRequest
{
// The name of the memo.
// Format: memos/{id}
string
name
=
1
;
int32
reaction_id
=
2
;
int32
reaction_id
=
1
;
}
message
DeleteMemoReactionResponse
{}
proto/gen/api/v2/README.md
View file @
b1e196bb
...
...
@@ -1893,7 +1893,6 @@ Used internally for obfuscating the page token.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name |
[
string
](
#string
)
| | The name of the memo. Format: memos/{id} |
| reaction_id |
[
int32
](
#int32
)
| | |
...
...
proto/gen/api/v2/memo_service.pb.go
View file @
b1e196bb
This diff is collapsed.
Click to expand it.
proto/gen/api/v2/memo_service.pb.gw.go
View file @
b1e196bb
...
...
@@ -908,16 +908,6 @@ func request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshaler run
_
=
err
)
val
,
ok
=
pathParams
[
"name"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"name"
)
}
protoReq
.
Name
,
err
=
runtime
.
String
(
val
)
if
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"type mismatch, parameter: %s, error: %v"
,
"name"
,
err
)
}
val
,
ok
=
pathParams
[
"reaction_id"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"reaction_id"
)
...
...
@@ -944,16 +934,6 @@ func local_request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshal
_
=
err
)
val
,
ok
=
pathParams
[
"name"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"name"
)
}
protoReq
.
Name
,
err
=
runtime
.
String
(
val
)
if
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"type mismatch, parameter: %s, error: %v"
,
"name"
,
err
)
}
val
,
ok
=
pathParams
[
"reaction_id"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"reaction_id"
)
...
...
@@ -1383,7 +1363,7 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
inboundMarshaler
,
outboundMarshaler
:=
runtime
.
MarshalerForRequest
(
mux
,
req
)
var
err
error
var
annotatedContext
context
.
Context
annotatedContext
,
err
=
runtime
.
AnnotateIncomingContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.MemoService/DeleteMemoReaction"
,
runtime
.
WithHTTPPathPattern
(
"/api/v2/
{name=memos/*}/
reactions/{reaction_id}"
))
annotatedContext
,
err
=
runtime
.
AnnotateIncomingContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.MemoService/DeleteMemoReaction"
,
runtime
.
WithHTTPPathPattern
(
"/api/v2/reactions/{reaction_id}"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
...
...
@@ -1799,7 +1779,7 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
inboundMarshaler
,
outboundMarshaler
:=
runtime
.
MarshalerForRequest
(
mux
,
req
)
var
err
error
var
annotatedContext
context
.
Context
annotatedContext
,
err
=
runtime
.
AnnotateContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.MemoService/DeleteMemoReaction"
,
runtime
.
WithHTTPPathPattern
(
"/api/v2/
{name=memos/*}/
reactions/{reaction_id}"
))
annotatedContext
,
err
=
runtime
.
AnnotateContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.MemoService/DeleteMemoReaction"
,
runtime
.
WithHTTPPathPattern
(
"/api/v2/reactions/{reaction_id}"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
...
...
@@ -1851,7 +1831,7 @@ var (
pattern_MemoService_UpsertMemoReaction_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
2
,
5
,
3
,
2
,
4
},
[]
string
{
"api"
,
"v2"
,
"memos"
,
"name"
,
"reactions"
},
""
))
pattern_MemoService_DeleteMemoReaction_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
2
,
5
,
3
,
2
,
4
,
1
,
0
,
4
,
1
,
5
,
5
},
[]
string
{
"api"
,
"v2"
,
"memos"
,
"name
"
,
"reactions"
,
"reaction_id"
},
""
))
pattern_MemoService_DeleteMemoReaction_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
1
,
5
,
3
},
[]
string
{
"api"
,
"v2
"
,
"reactions"
,
"reaction_id"
},
""
))
)
var
(
...
...
server/route/api/v2/apidocs.swagger.yaml
View file @
b1e196bb
...
...
@@ -397,6 +397,27 @@ paths:
type: string
tags
:
-
MemoService
/api/v2/reactions/{reactionId}
:
delete
:
summary
:
DeleteMemoReaction deletes a reaction for a memo.
operationId
:
MemoService_DeleteMemoReaction
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v2DeleteMemoReactionResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
reactionId
in
:
path
required
:
true
type
:
integer
format
:
int32
tags
:
-
MemoService
/api/v2/resources
:
get
:
summary
:
ListResources lists all resources.
...
...
@@ -1452,35 +1473,6 @@ paths:
default
:
TYPE_UNSPECIFIED
tags
:
-
MemoService
/api/v2/{name}/reactions/{reactionId}
:
delete
:
summary
:
DeleteMemoReaction deletes a reaction for a memo.
operationId
:
MemoService_DeleteMemoReaction
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v2DeleteMemoReactionResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
name
description
:
|-
The name of the memo.
Format: memos/{id}
in: path
required: true
type: string
pattern: memos/[^/]+
-
name
:
reactionId
in
:
path
required
:
true
type
:
integer
format
:
int32
tags
:
-
MemoService
/api/v2/{name}/relations
:
get
:
summary
:
ListMemoRelations lists relations for a memo.
...
...
server/route/api/v2/reaction_service.go
View file @
b1e196bb
...
...
@@ -57,12 +57,8 @@ func (s *APIV2Service) UpsertMemoReaction(ctx context.Context, request *apiv2pb.
}
func
(
s
*
APIV2Service
)
DeleteMemoReaction
(
ctx
context
.
Context
,
request
*
apiv2pb
.
DeleteMemoReactionRequest
)
(
*
apiv2pb
.
DeleteMemoReactionResponse
,
error
)
{
id
,
err
:=
ExtractMemoIDFromName
(
request
.
Name
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid memo name: %v"
,
err
)
}
if
err
:=
s
.
Store
.
DeleteReaction
(
ctx
,
&
store
.
DeleteReaction
{
ID
:
i
d
,
ID
:
request
.
ReactionI
d
,
});
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to delete reaction"
)
}
...
...
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