Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bff, bookmark): fix rpc DeleteBookmark request #149

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bff/apollo-gateway/src/app/bookmark/bookmark.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class BookmarkService {

async deleteBookmark(input: DeleteBookmarkInput): Promise<boolean> {
const req = new DeleteBookmarkRequest();
req.setId(input.bookmarkId);
req.setBookmarkId(input.bookmarkId);
req.setUserId(input.userId);

return new Promise((resolve, reject) => {
Expand Down
6 changes: 3 additions & 3 deletions bff/apollo-gateway/src/grpc/bookmark/bookmark_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export namespace CreateBookmarkRequest {
}

export class DeleteBookmarkRequest extends jspb.Message {
getId(): string;
setId(value: string): DeleteBookmarkRequest;
getBookmarkId(): string;
setBookmarkId(value: string): DeleteBookmarkRequest;
getUserId(): string;
setUserId(value: string): DeleteBookmarkRequest;

Expand All @@ -158,7 +158,7 @@ export class DeleteBookmarkRequest extends jspb.Message {

export namespace DeleteBookmarkRequest {
export type AsObject = {
id: string,
bookmarkId: string,
userId: string,
}
}
Expand Down
12 changes: 6 additions & 6 deletions bff/apollo-gateway/src/grpc/bookmark/bookmark_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.toObject = function
*/
proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
bookmarkId: jspb.Message.getFieldWithDefault(msg, 1, ""),
userId: jspb.Message.getFieldWithDefault(msg, 2, "")
};

Expand Down Expand Up @@ -1225,7 +1225,7 @@ proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.deserializeBinaryFromReader =
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setId(value);
msg.setBookmarkId(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
Expand Down Expand Up @@ -1260,7 +1260,7 @@ proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.serializeBinary = f
*/
proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
f = message.getBookmarkId();
if (f.length > 0) {
writer.writeString(
1,
Expand All @@ -1278,10 +1278,10 @@ proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.serializeBinaryToWriter = fun


/**
* optional string id = 1;
* optional string bookmark_id = 1;
* @return {string}
*/
proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.getId = function() {
proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.getBookmarkId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};

Expand All @@ -1290,7 +1290,7 @@ proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.getId = function()
* @param {string} value
* @return {!proto.checkpicks.bookmark.v1.DeleteBookmarkRequest} returns this
*/
proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.setId = function(value) {
proto.checkpicks.bookmark.v1.DeleteBookmarkRequest.prototype.setBookmarkId = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};

Expand Down
2 changes: 1 addition & 1 deletion bff/apollo-gateway/src/proto/bookmark/bookmark.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ message CreateBookmarkRequest {
}

message DeleteBookmarkRequest {
string id = 1;
string bookmark_id = 1;
string user_id = 2;
}

Expand Down
143 changes: 72 additions & 71 deletions micro-service/bookmark-service/grpc/bookmark/bookmark.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (bu *bookmarkUseCase) CreateBookmark(ctx context.Context, req *bpb.CreateBo
}

func (bu *bookmarkUseCase) DeleteBookmark(ctx context.Context, req *bpb.DeleteBookmarkRequest) (*emptypb.Empty, error) {
if err := bu.bookmarkAdapter.DeleteBookmark(ctx, req.GetId(), req.GetUserId()); err != nil {
if err := bu.bookmarkAdapter.DeleteBookmark(ctx, req.GetBookmarkId(), req.GetUserId()); err != nil {
return &emptypb.Empty{}, err
}
return &emptypb.Empty{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ func Test_UseCase_DeleteBookmark(t *testing.T) {
},
},
arg: &bpb.DeleteBookmarkRequest{
Id: bookmarkID.String(),
UserId: userID1,
BookmarkId: bookmarkID.String(),
UserId: userID1,
},
want: &emptypb.Empty{},
},
Expand All @@ -433,8 +433,8 @@ func Test_UseCase_DeleteBookmark(t *testing.T) {
},
},
arg: &bpb.DeleteBookmarkRequest{
Id: differentBookmarkID.String(),
UserId: userID1,
BookmarkId: differentBookmarkID.String(),
UserId: userID1,
},
want: &emptypb.Empty{},
wantErr: "entity: failed to synchronize data after insert",
Expand Down Expand Up @@ -462,8 +462,8 @@ func Test_UseCase_DeleteBookmark(t *testing.T) {
},
},
arg: &bpb.DeleteBookmarkRequest{
Id: bookmarkID.String(),
UserId: differentUserID.String(),
BookmarkId: bookmarkID.String(),
UserId: differentUserID.String(),
},
want: &emptypb.Empty{},
wantErr: "entity: failed to synchronize data after insert",
Expand Down
Loading
Loading