|  |  | @ -50,29 +50,35 @@ fun configureRouting(): ApplicationEngine = embeddedServer(CIO, applicationEngin | 
			
		
	
		
		
			
				
					
					|  |  |  |                 call.respondText("READY") |  |  |  |                 call.respondText("READY") | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             get("/api/hentallefeil"){ |  |  |  |             get("/api/hentallefeil"){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val testMelding = feilmeldingRepository.hentAlleFeilmeldinger() |  |  |  |                 val feilmeldinger = feilmeldingRepository.hentAlleFeilmeldinger() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 call.respond(status = HttpStatusCode.Created, message = testMelding) |  |  |  |                 call.respond(status = HttpStatusCode.OK, message = feilmeldinger) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             get("/api/hentsok/{sokestreng}"){ |  |  |  |             get("/api/hentsok/{sokestreng}"){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val sokestreng = call.parameters["sokestreng"] |  |  |  |                 val sokestreng = call.parameters["sokestreng"] | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ?: return@get call.respond(HttpStatusCode.BadRequest, "Sokestreng må være definert") |  |  |  |                     ?: return@get call.respond(HttpStatusCode.BadRequest, "Søkestreng må være definert") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 val sokeresultat = feilmeldingRepository.hentSokteFeilmeldinger(sokestreng) |  |  |  |                 val sokeresultat = feilmeldingRepository.hentSokteFeilmeldinger(sokestreng) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 call.respond(status = HttpStatusCode.Created, message = sokeresultat) |  |  |  |                 call.respond(status = HttpStatusCode.OK, message = sokeresultat) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             post("/api/nyfeil") { |  |  |  |             post("/api/nyfeil") { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val feilmelding = call.receive<Feilmelding>() |  |  |  |                 val feilmelding = call.receive<Feilmelding>() | 
			
		
	
		
		
			
				
					
					|  |  |  |                 feilmeldingRepository.lagre(feilmelding) |  |  |  |                 feilmeldingRepository.lagre(feilmelding) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 call.respond(status = HttpStatusCode.Created, message = "Feilmelding motatt og sendt til database") |  |  |  |                 call.respond(status = HttpStatusCode.Created, message = "Feilmelding motatt og lagret") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             put("/api/oppdaterfeil") { |  |  |  |             put("/api/oppdaterfeil") { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val oppdatertFeilmelding = call.receive<Feilmelding>() |  |  |  |                 val oppdatertFeilmelding = call.receive<Feilmelding>() | 
			
		
	
		
		
			
				
					
					|  |  |  |                 feilmeldingRepository.oppdaterFeilmelding(oppdatertFeilmelding) |  |  |  |                 feilmeldingRepository.oppdaterFeilmelding(oppdatertFeilmelding) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 call.respond(status = HttpStatusCode.Created, message = "Feilmelding oppdatert") |  |  |  |                 call.respond(status = HttpStatusCode.OK, message = "Feilmelding oppdatert") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             put("/api/oppdaterkommentar") { |  |  |  |             put("/api/oppdaterkommentar") { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val innkommendeKommentar = call.receive<InnkommendeKommentar>() |  |  |  |                 val innkommendeKommentar = call.receive<InnkommendeKommentar>() | 
			
		
	
		
		
			
				
					
					|  |  |  |                 feilmeldingRepository.oppdaterKommentar(innkommendeKommentar.id, innkommendeKommentar.kommentar) |  |  |  |                 feilmeldingRepository.oppdaterKommentar(innkommendeKommentar.id, innkommendeKommentar.kommentar) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 call.respond(status = HttpStatusCode.Created, message = "Feilmelding oppdatert") |  |  |  |                 call.respond(status = HttpStatusCode.OK, message = "Kommentar oppdatert") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             delete("api/slettfeilmelding/{id}") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 val id = call.parameters["id"] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 checkNotNull(id) {"Id kan ikke være null"} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 feilmeldingRepository.slettFeilmelding(id.toInt()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 call.respond(status = HttpStatusCode.OK, message = "Feilmelding slettet") | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             delete("api/slettfeilmelding/{id}") { |  |  |  |             delete("api/slettfeilmelding/{id}") { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 val id = call.parameters["id"] |  |  |  |                 val id = call.parameters["id"] | 
			
		
	
	
		
		
			
				
					|  |  | 
 |