Skip to content

Commit a3fa809

Browse files
authored
Merge pull request #4 from underthekey/dev
merge: dev to main
2 parents d1a6542 + 465cab9 commit a3fa809

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
- traditional korean proverbs, more than 4,000
66
- from https://www.krpia.co.kr/product/main?plctId=PLCT00004626#none
7-
- famous saying (soon)
7+
- quotes, more than 200 (more to be added)
8+
- from https://www.goodreads.com/quotes (soon)
89
- maxim (soon)
910

1011
---
@@ -28,7 +29,7 @@
2829
### 3. `https://sentence.udtk.site/language?language=&count=`
2930

3031
- **description** : return random sentences in chosen language
31-
- request parameter : language, count
32+
- request parameter : `language`, `count`
3233
- language : `kor`, `eng`
3334
- default : `kor`
3435
- count : number of sentences to get
@@ -45,8 +46,6 @@
4546
- range : 1 ~ 20
4647
- default : 1
4748

48-
---
49-
5049
### response example
5150

5251
ex) https://sentence.udtk.site/random?count=2
@@ -67,8 +66,8 @@ ex) https://sentence.udtk.site/random?count=2
6766
### ❗️request limit
6867

6968
- **<U>20 requests per 5 minutes</U>**
70-
- when the limit is exceeded, the response will be 429 Too Many Requests
71-
- time left to reset the limit will be included in the response header X-Rate-Limit-Retry-After-Seconds
69+
- when the limit is exceeded, the response will be `429 Too Many Requests`
70+
- time left to reset the limit will be included in the response header `X-Rate-Limit-Retry-After-Seconds`
7271

7372
---
7473

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
package site.udtk.sentenceapi.repository;
22

3+
import java.util.List;
4+
import java.util.Optional;
5+
6+
import org.springframework.data.jpa.repository.EntityGraph;
37
import org.springframework.data.jpa.repository.JpaRepository;
8+
import org.springframework.data.jpa.repository.Query;
49
import org.springframework.stereotype.Repository;
510

11+
import io.micrometer.common.lang.NonNullApi;
612
import site.udtk.sentenceapi.domain.Sentence;
713

814
@Repository
15+
@NonNullApi
916
public interface SentenceRepository extends JpaRepository<Sentence, Long> {
17+
@EntityGraph(attributePaths = {"category"})
18+
Optional<Sentence> findById(Long id);
19+
20+
@EntityGraph(attributePaths = {"category"})
21+
@Query("SELECT s FROM Sentence s WHERE s.id IN :ids")
22+
List<Sentence> findAllById(List<Long> ids);
1023
}

0 commit comments

Comments
 (0)