Skip to content

Commit

Permalink
Merge pull request #4 from underthekey/dev
Browse files Browse the repository at this point in the history
merge: dev to main
  • Loading branch information
takealook97 authored Sep 8, 2024
2 parents d1a6542 + 465cab9 commit a3fa809
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

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

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

- **description** : return random sentences in chosen language
- request parameter : language, count
- request parameter : `language`, `count`
- language : `kor`, `eng`
- default : `kor`
- count : number of sentences to get
Expand All @@ -45,8 +46,6 @@
- range : 1 ~ 20
- default : 1

---

### response example

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

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

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
package site.udtk.sentenceapi.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import io.micrometer.common.lang.NonNullApi;
import site.udtk.sentenceapi.domain.Sentence;

@Repository
@NonNullApi
public interface SentenceRepository extends JpaRepository<Sentence, Long> {
@EntityGraph(attributePaths = {"category"})
Optional<Sentence> findById(Long id);

@EntityGraph(attributePaths = {"category"})
@Query("SELECT s FROM Sentence s WHERE s.id IN :ids")
List<Sentence> findAllById(List<Long> ids);
}

0 comments on commit a3fa809

Please sign in to comment.