File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
src/main/java/site/udtk/sentenceapi/repository Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 4
4
5
5
- traditional korean proverbs, more than 4,000
6
6
- 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)
8
9
- maxim (soon)
9
10
10
11
---
28
29
### 3. ` https://sentence.udtk.site/language?language=&count= `
29
30
30
31
- ** description** : return random sentences in chosen language
31
- - request parameter : language, count
32
+ - request parameter : ` language ` , ` count `
32
33
- language : ` kor ` , ` eng `
33
34
- default : ` kor `
34
35
- count : number of sentences to get
45
46
- range : 1 ~ 20
46
47
- default : 1
47
48
48
- ---
49
-
50
49
### response example
51
50
52
51
ex) https://sentence.udtk.site/random?count=2
@@ -67,8 +66,8 @@ ex) https://sentence.udtk.site/random?count=2
67
66
### ❗️request limit
68
67
69
68
- ** <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 `
72
71
73
72
---
74
73
Original file line number Diff line number Diff line change 1
1
package site .udtk .sentenceapi .repository ;
2
2
3
+ import java .util .List ;
4
+ import java .util .Optional ;
5
+
6
+ import org .springframework .data .jpa .repository .EntityGraph ;
3
7
import org .springframework .data .jpa .repository .JpaRepository ;
8
+ import org .springframework .data .jpa .repository .Query ;
4
9
import org .springframework .stereotype .Repository ;
5
10
11
+ import io .micrometer .common .lang .NonNullApi ;
6
12
import site .udtk .sentenceapi .domain .Sentence ;
7
13
8
14
@ Repository
15
+ @ NonNullApi
9
16
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 );
10
23
}
You can’t perform that action at this time.
0 commit comments