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