39 lines
1.3 KiB
Java
39 lines
1.3 KiB
Java
package cryptosky.me.pricing.graphql.queries;
|
|
|
|
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
|
|
import cryptosky.me.pricing.models.entities.BtcPriceModel;
|
|
import cryptosky.me.pricing.models.entities.CryptoPriceModel;
|
|
import cryptosky.me.pricing.service.PriceService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.List;
|
|
import java.util.Optional;
|
|
|
|
@Component
|
|
public class BtcPriceQuery implements GraphQLQueryResolver {
|
|
|
|
@Autowired
|
|
private PriceService priceService;
|
|
|
|
public List<BtcPriceModel> getAllPrices(final int count ) {
|
|
return this.priceService.getAllPrices(count);
|
|
}
|
|
|
|
public List<BtcPriceModel> getPricesBetweenCounts( final int startCount, final int endCount ) {
|
|
return this.priceService.getPricesBetweenCounts(startCount, endCount);
|
|
}
|
|
|
|
public Optional<BtcPriceModel> getLatest() {
|
|
return this.priceService.getLatest();
|
|
}
|
|
|
|
public Optional<BtcPriceModel> getPriceForCreatedDate( final String createdDate ) {
|
|
return this.priceService.getPriceForCreatedDate(createdDate);
|
|
}
|
|
|
|
public List<BtcPriceModel> getPriceBetweenDates(final String startDate, final String endDate ) {
|
|
return this.priceService.getPriceBetweenDates(startDate, endDate);
|
|
}
|
|
}
|