1 package fr.tiogars.chat.domains.task.repositories;
2
3 import java.util.List;
4 import java.util.Optional;
5
6 import org.springframework.data.jpa.repository.JpaRepository;
7
8 import fr.tiogars.chat.domains.task.entities.TaskEntity;
9
10 /**
11 * Provides persistence operations for Tasks.
12 *
13 * @since 0.1.0
14 */
15 public interface TaskRepository extends JpaRepository<TaskEntity, Long> {
16
17 /**
18 * Finds all Tasks ordered by code.
19 *
20 * @return Tasks ordered by code in ascending order
21 */
22 List<TaskEntity> findAllByOrderByCodeAsc();
23
24 /**
25 * Finds selected active Tasks ordered by code.
26 *
27 * @param ids persistent identifiers
28 * @return matching active Tasks
29 */
30 List<TaskEntity> findAllByIdInOrderByCodeAsc(List<Long> ids);
31
32 /**
33 * Finds a Task by its code.
34 *
35 * @param code Task code
36 * @return matching Task, or an empty optional when none exists
37 */
38 Optional<TaskEntity> findByCode(String code);
39 }