Last active
August 19, 2020 09:03
-
-
Save fevziomurtekin/960d2bd96b0302ecbf029d671b3d3cdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fevziomurtekin.sample.dao | |
import com.fevziomurtekin.sample.data.Covid | |
import com.fevziomurtekin.sample.repository.CovidRepository | |
import org.bson.types.ObjectId | |
import org.springframework.stereotype.Component | |
import java.util.* | |
@Component | |
class CovidDao (private val covidRepository: CovidRepository){ | |
fun getContentByDate(date:String) = covidRepository.findByDateLike(date) | |
fun findAll() = covidRepository.findAll() | |
fun newData(date: String, | |
death:String, | |
recovered:String, | |
test:String) = covidRepository.save(Covid( | |
_id = UUID.randomUUID().toString(), | |
date = date, | |
death = death, | |
recovered =recovered, | |
test = test | |
)) | |
fun deleteData(id: String) = covidRepository.deleteById(id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment