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: Implement new protocol definition #32

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

kevinszuchet
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Jan 16, 2025

Pull Request Test Coverage Report for Build 12831901632

Details

  • 72 of 81 (88.89%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 57.775%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/adapters/rpc-server/rpc-server.ts 3 4 75.0%
src/adapters/db.ts 27 35 77.14%
Totals Coverage Status
Change from base Build 12788853035: 0.2%
Covered Lines: 303
Relevant Lines: 521

💛 - Coveralls

Copy link

@aleortega aleortega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left some NITS and doubts.

if (!lastFriendshipAction) {
return {
response: {
$case: 'internalServerError',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to handle this case as an InternalServerError?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It came from the previous definition. We can rethink the error responses.

return async function (
request: GetFriendshipRequestsPayload,
context: RpcServerContext
): Promise<PaginatedFriendshipRequestsResponse> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I'm thinking that maybe we could wrap-up pagination functionality in something like:

Paginated<FriendshipRequestResponse>

And so on for all the things we do need to paginate, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of the functionality, I agree, but the types come from the protocol, which doesn't allowtheo create generics

@@ -2,7 +2,7 @@ import { Action, FriendshipStatus, RpcServerContext, RPCServiceContext } from '.
import {
UpsertFriendshipPayload,
UpsertFriendshipResponse
} from '@dcl/protocol/out-ts/decentraland/social_service_v2/social_service.gen'
} from '@dcl/protocol/out-ts/decentraland/social_service/v3/social_service_v3.gen'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubt, is it okay to also have the v3 at the file name level and not only at route level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, there should be no issue, but since the previous definition filename is "social_service," I attempted to use /v3/social_service.proto. However, it resulted in a compilation error for C#.

Comment on lines 57 to 58
async getFriends(userAddress, { onlyActive, pagination } = { onlyActive: true }) {
const { limit, offset } = getPaginationOrDefaults(pagination)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about placing the default directly on this getFriends function's params instead at getPaginationOrDefaults as we do with onlyActive:true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could be possible that limit is set but not the offset, or vice versa?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants