Skip to content

Commit

Permalink
[#19] feature: Create BestService
Browse files Browse the repository at this point in the history
- BestService 생성
  • Loading branch information
jihye-woo committed Apr 22, 2021
1 parent 9d72584 commit c5e4829
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions backend/src/main/java/com/team15/sidedish/service/BestService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.team15.sidedish.service;

import com.team15.sidedish.domain.Best;
import com.team15.sidedish.domain.BestRepository;
import org.springframework.stereotype.Service;

import java.util.Set;

@Service
public class BestService {

private BestRepository bestRepository;

public BestService(BestRepository bestRepository) {
this.bestRepository = bestRepository;
}

public Set<Best> showAllBestDishes() {
return bestRepository.findAll();
}

public Best showSingleBestDish(Integer categoryId) {
return bestRepository.findById(categoryId).orElseThrow(IllegalArgumentException::new);
}
}

0 comments on commit c5e4829

Please sign in to comment.