Interface FavoriteRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Favorite,Long>, org.springframework.data.jpa.repository.JpaRepository<Favorite,Long>, org.springframework.data.repository.ListCrudRepository<Favorite,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Favorite,Long>, org.springframework.data.repository.PagingAndSortingRepository<Favorite,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Favorite>, org.springframework.data.repository.Repository<Favorite,Long>

@Repository public interface FavoriteRepository extends org.springframework.data.jpa.repository.JpaRepository<Favorite,Long>
Repositório para Favoritos de Usuário.

Propósito: Gerenciar a relação entre Usuários e Ativos de interesse.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Remove um favorito específico.
    Lista todos os favoritos de um usuário.
    Busca um favorito específico de um usuário.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByUserAndTicker

      Optional<Favorite> findByUserAndTicker(User user, String ticker)
      Busca um favorito específico de um usuário.
      Parameters:
      user - O usuário dono do favorito.
      ticker - O código do ativo.
      Returns:
      O favorito, se existir.
    • findAllByUser

      List<Favorite> findAllByUser(User user)
      Lista todos os favoritos de um usuário.
      Parameters:
      user - O usuário.
      Returns:
      Lista de favoritos.
    • deleteByUserAndTicker

      void deleteByUserAndTicker(User user, String ticker)
      Remove um favorito específico.
      Parameters:
      user - O usuário.
      ticker - O código do ativo.