Last change
on this file since b2e6513 was 9dd526f, checked in by andrejTavchioski <andrej.tavchioski@…>, 3 years ago |
backend refactoring
|
-
Property mode
set to
100644
|
File size:
727 bytes
|
Rev | Line | |
---|
[ce6ad22] | 1 | package parkup.repositories;
|
---|
| 2 |
|
---|
| 3 | import java.util.Optional;
|
---|
| 4 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
[97fbc67] | 5 | import org.springframework.data.jpa.repository.Modifying;
|
---|
| 6 | import org.springframework.data.jpa.repository.Query;
|
---|
| 7 | import org.springframework.stereotype.Repository;
|
---|
[9dd526f] | 8 | import parkup.entities.Worker;
|
---|
[ce6ad22] | 9 |
|
---|
[97fbc67] | 10 | import javax.transaction.Transactional;
|
---|
| 11 |
|
---|
| 12 | @Repository
|
---|
[9dd526f] | 13 | public interface WorkerRepository extends JpaRepository<Worker, Integer> {
|
---|
| 14 | Worker findByWorkerId(int id);
|
---|
[ce6ad22] | 15 |
|
---|
[9dd526f] | 16 | void deleteByWorkerId(int id);
|
---|
[ce6ad22] | 17 |
|
---|
[9dd526f] | 18 | Optional<Worker> findWorkerByEmail(String email);
|
---|
[97fbc67] | 19 |
|
---|
| 20 | @Transactional
|
---|
| 21 | @Modifying
|
---|
[9dd526f] | 22 | @Query("UPDATE Worker a " +
|
---|
| 23 | "SET a.enabled = TRUE WHERE a.email = ?1")
|
---|
| 24 | int enableWorker(String email);
|
---|
[ce6ad22] | 25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.