feat: add UserRepository and CardRepository

This commit is contained in:
2026-02-22 18:32:48 +03:00
parent 12a695d0e2
commit f4b01cfefa
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package com.example.bankcards.repository;
import com.example.bankcards.entity.Card;
import com.example.bankcards.entity.CardStatus;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CardRepository extends JpaRepository<Card, Long> {
Page<Card> findByOwnerId(Long ownerId, Pageable pageable);
Page<Card> findByOwnerIdAndStatus(
Long ownerId,
CardStatus status,
Pageable pageable
);
}

View File

@@ -0,0 +1,11 @@
package com.example.bankcards.repository;
import com.example.bankcards.entity.User;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findByUsername(String username);
boolean existsByUsername(String username);
boolean existsByEmail(String email);
}