✨ Satt opp initiell database og tester
Co-authored-by: Amalie Mansåker <amalie.erdal.mansaker@nav.no> Co-authored-by: Hege Haavaldsen <hege.haavaldsen@nav.no> Co-authored-by: Helene Arnesen <helene.arnesen@nav.no>
This commit is contained in:
parent
eba022a416
commit
30a0ba6acc
6 changed files with 84 additions and 14 deletions
|
@ -0,0 +1,17 @@
|
|||
package no.nav.helse.sprik.db
|
||||
|
||||
import org.jetbrains.exposed.sql.insert
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
|
||||
class FeilmeldingRepository {
|
||||
fun lagre(tittel: String, beskrivelse: String){
|
||||
transaction {
|
||||
FeilmeldingTable.run {
|
||||
insert {
|
||||
it[FeilmeldingTable.tittel] = tittel
|
||||
it[FeilmeldingTable.beskrivelse] = beskrivelse
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package no.nav.helse.sprik.db
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
|
||||
object FeilmeldingTable : Table("feilmelding") {
|
||||
val tittel = text("tittel")
|
||||
val beskrivelse = text("beskrivelse")
|
||||
}
|
|
@ -18,6 +18,7 @@ import java.time.LocalDate
|
|||
class Feilmelding(
|
||||
val tittel: String,
|
||||
val beskrivelse: String,
|
||||
|
||||
@Serializable(LocalDateSerializer::class)
|
||||
val dato: LocalDate? = null, //Krever en spesiallaget serialiserer i KotlinX
|
||||
val tags: ArrayList<String> = arrayListOf<String>()
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
CREATE TABLE feilmelding (
|
||||
tittel VARCHAR NOT NULL,
|
||||
beskrivelse VARCHAR NOT NULL
|
||||
)
|
Reference in a new issue