Created
August 29, 2020 14:39
-
-
Save itsgokhanyilmaz/6dc4517666815a36edc9ef2efd0fe351 to your computer and use it in GitHub Desktop.
UserRepositoryImpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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