added new endpoints, getUser, getUserHistories, getBookmarks

This commit is contained in:
heyethereum
2024-07-20 01:10:28 +08:00
parent f7e592f8ec
commit ee3180dbea
33 changed files with 261 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
package com.safeqr.app.qrcode.service;
import com.safeqr.app.exceptions.CustomNotFoundExceptions;
import com.safeqr.app.qrcode.entity.TextEntity;
import com.safeqr.app.qrcode.repository.TextRepository;
import org.slf4j.Logger;
@@ -7,6 +8,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.UUID;
@Service
public class TextVerificationService {
private final TextRepository textRepository;
@@ -15,6 +18,12 @@ public class TextVerificationService {
public TextVerificationService(TextRepository textRepository) {
this.textRepository = textRepository;
}
public TextEntity getTextEntityByQRCodeId(UUID qrCodeId) {
logger.info("qrCodeId retrieving: {}", qrCodeId);
return textRepository.findByQrCodeId(qrCodeId)
.orElseThrow(() -> new CustomNotFoundExceptions("Text not found for QR Code id: " + qrCodeId));
}
public void insertDB(TextEntity textEntity) {
textRepository.save(textEntity);
}