Skip to content

Conversation

@Daggerpov
Copy link
Owner

#249

As FullUserDTO isn't being used anywhere in the front-end

@Daggerpov Daggerpov requested review from ShaneMander and removed request for ShaneMander March 28, 2025 08:40
@Daggerpov Daggerpov requested a review from ShaneMander March 28, 2025 09:37
Copy link
Collaborator

@ShaneMander ShaneMander left a comment

Choose a reason for hiding this comment

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

Nice stuff, I've just left some comments on methods that can be removed since we no longer have a FullUserDTO

Comment on lines 93 to 102
List<UserDTO> users = userService.getUsersByTagId(tagId);
List<Map<String, Object>> enrichedUsers = new ArrayList<>();

for (UserDTO user : users) {
Map<String, Object> enrichedUser = new HashMap<>();
enrichedUser.put("user", user);
enrichedUser.put("friends", userService.getFriendsByUserId(user.getId()));
enrichedUser.put("friendTags", friendTagService.getFriendTagsByOwnerId(user.getId()));
enrichedUsers.add(enrichedUser);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should probably be service method, no?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or replace it with a call to the new UserService::getUserWithFriendsAndTags

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yea, service method

UserDTO getUserById(UUID id);

FullUserDTO getFullUserById(UUID id);
BaseUserDTO getFullUserById(UUID id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can remove this because we already have IUserService::getBaseUserById

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh nice. Good catch!

UserDTO saveUserWithProfilePicture(UserDTO user, byte[] profilePicture);

FullUserDTO getFullUserByEmail(String email);
BaseUserDTO getFullUserByEmail(String email);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed

BaseUserDTO getFullUserByEmail(String email);

FullUserDTO getFullUserByUserEntity(User user);
BaseUserDTO getFullUserByUserEntity(User user);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed


// Helper
FullUserDTO getFullUserByUser(UserDTO user, Set<UUID> visitedUsers);
BaseUserDTO getFullUserByUser(UserDTO user, Set<UUID> visitedUsers);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method can be removed and each usage of this method can be replaced with calls to UserMapper::toBaseDTO instead

BaseUserDTO getFullUserByUser(UserDTO user, Set<UUID> visitedUsers);

List<FullUserDTO> convertUsersToFullUsers(List<UserDTO> users, Set<UUID> visitedUsers);
List<BaseUserDTO> convertUsersToFullUsers(List<UserDTO> users, Set<UUID> visitedUsers);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed and can replace old calls to this method with a new UserMapper::toBaseDTOList method

boolean existsByEmail(String email);

FullUserDTO getFullUserByUsername(String username);
BaseUserDTO getFullUserByUsername(String username);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed since you've deleted the only usage

private final IUserService userService;
private final IS3Service s3Service;
private final ILogger logger;
private final IFriendTagService friendTagService;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed when you replace the logic in UserController::getUsersByFriendTag with the call to UserService::getUserWithFriendsAndTags

}

@Override
public int hashCode() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might've missed it but where is this being used?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think I was getting warnings that classes are supposed to have either none of those two methods, equals() or hashCode() or both.

Copy link
Owner Author

Choose a reason for hiding this comment

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

java: Not generating hashCode: One of equals or hashCode exists. You should either write both of these or none of these (in the latter case, lombok generates them).

@ShaneMander ShaneMander changed the base branch from main to staging March 29, 2025 21:30
@Daggerpov Daggerpov marked this pull request as draft March 31, 2025 00:37
@Daggerpov Daggerpov marked this pull request as ready for review March 31, 2025 00:41
@Deprecated(since = "Not being used on mobile currently.")
// full path: /api/v1/users/{id}?full=full
@GetMapping("{id}")
public ResponseEntity<AbstractUserDTO> getUser(@PathVariable UUID id, @RequestParam(value = "full", required = false) boolean full) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this endpoint will become useful, especially if we want to enable functionality like clicking on someone's name from a user's friend list, for example, but it is very straightforward to add back when we need so I won't request a change here.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yea, it was just messy with the deprecated full stuff; if we need it, we'll do it again, just as you're saying 👍

@Daggerpov Daggerpov merged commit daf4507 into staging Mar 31, 2025
4 checks passed
@Daggerpov Daggerpov deleted the feature/oauth-base-user-dto branch March 31, 2025 05:37
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