Skip to content

Instantly share code, notes, and snippets.

@itsgokhanyilmaz
Created August 29, 2020 14:39
Show Gist options
  • Save itsgokhanyilmaz/6dc4517666815a36edc9ef2efd0fe351 to your computer and use it in GitHub Desktop.
Save itsgokhanyilmaz/6dc4517666815a36edc9ef2efd0fe351 to your computer and use it in GitHub Desktop.
UserRepositoryImpl
@RequiredArgsConstructor
@Repository
public class UserRepositoryImpl implements UserRepository {
@NotNull
private final MongoTemplate mongoTemplate;
@Override
public void uploadProfilePicture(String url, ObjectId id) {
UpdateResult updateResult = mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(id)),
new Update().set("profilePictureURL", url), User.class);
if (!updateResult.wasAcknowledged()) {
throw new ProfilePictureUpdateException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment