Skip to content

Instantly share code, notes, and snippets.

@fevziomurtekin
Last active August 19, 2020 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fevziomurtekin/960d2bd96b0302ecbf029d671b3d3cdc to your computer and use it in GitHub Desktop.
Save fevziomurtekin/960d2bd96b0302ecbf029d671b3d3cdc to your computer and use it in GitHub Desktop.
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