2023-07-20 13:27:42 +02:00
import no.nav.helse.sprik.Application
import no.nav.helse.sprik.configureFlyway
import no.nav.helse.sprik.db.Database
2023-07-24 15:13:04 +02:00
import no.nav.helse.sprik.db.FeilmeldingRepository
2023-07-20 13:27:42 +02:00
import no.nav.helse.sprik.dbconfig
2023-07-24 15:13:04 +02:00
import no.nav.helse.sprik.modell.Feilmelding
import java.time.LocalDateTime
import javax.sql.DataSource
import org.jetbrains.exposed.sql.Database as ExposedDatabase
2023-07-20 13:27:42 +02:00
fun main ( ) {
val db = Database ( dbconfig ( ) ) . configureFlyway ( )
val app = Application ( db )
2023-07-24 15:13:04 +02:00
ExposedDatabase . connect ( db . dataSource )
2023-07-25 11:24:53 +02:00
oppretteMockData ( ) // WIP
2023-07-20 15:57:51 +02:00
2023-07-20 13:27:42 +02:00
app . startBlocking ( )
}
2023-07-20 15:57:51 +02:00
2023-07-25 11:24:53 +02:00
private fun oppretteMockData ( ) {
2023-07-20 15:57:51 +02:00
val feilmeldingRepository = FeilmeldingRepository ( )
2023-08-02 10:31:38 +02:00
feilmeldingRepository . lagre ( Feilmelding ( null , " Mangel på hensyn til tariffoppgjør " , " Det har vært ett tariffoppgjør og speil sier sykepengene må tilbakekreves, noe som er feil. (sier vi.. har ikke domenekunnskap) " , LocalDateTime . of ( 2023 , 1 , 1 , 8 , 0 , 0 ) , 0 , false , null ) )
feilmeldingRepository . lagre ( Feilmelding ( null , " Speil sier NAV må tilbakekreve sykepenger på feil grunnlag " , " Beskrivelse Test2 " , LocalDateTime . of ( 2023 , 2 , 1 , 8 , 0 , 0 ) , 1 , true , null ) )
feilmeldingRepository . lagre ( Feilmelding ( null , " Feil A " , " Lorem Ipsum " , LocalDateTime . of ( 2023 , 3 , 1 , 8 , 0 , 0 ) , 2 , false , null ) )
feilmeldingRepository . lagre ( Feilmelding ( null , " Feil B " , " Lorem Ipsum " , LocalDateTime . of ( 2023 , 4 , 1 , 8 , 0 , 0 ) , 1 , true , null ) )
feilmeldingRepository . lagre ( Feilmelding ( null , " Feil C " , " Lorem Ipsum " , LocalDateTime . of ( 2023 , 5 , 1 , 8 , 0 , 0 ) , 1 , true , null ) )
2023-08-02 16:13:06 +02:00
feilmeldingRepository . lagre ( Feilmelding ( null , " Feil D " , " Lorem Ipsum " , LocalDateTime . of ( 2023 , 6 , 1 , 8 , 0 , 0 ) , 0 , false , " Test kommentar " ) )
2023-07-20 16:10:10 +02:00
}