Skip to content

Commit

Permalink
#15 #18 Get Funds
Browse files Browse the repository at this point in the history
  • Loading branch information
José Antonio Córdoba Gómez committed Jan 8, 2021
1 parent bace0dc commit 880e10b
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.pepe.rest.resteasyjackson
import javax.inject.Inject
import javax.enterprise.inject.Default
import javax.enterprise.context.ApplicationScoped
import javax.ws.rs.core.Response.*
import javax.ws.rs.core.Response
import mu.KotlinLogging


import java.util.*
import java.time.LocalDateTime

import javax.ws.rs.GET
import javax.ws.rs.POST
import javax.ws.rs.DELETE
import javax.ws.rs.Path
import javax.ws.rs.PathParam
import javax.ws.rs.Produces
import javax.ws.rs.core.MediaType

private val logger = KotlinLogging.logger {}

// ./mvnw compile quarkus:dev
@ApplicationScoped
class FundService {

private val funds = Collections.newSetFromMap(Collections.synchronizedMap(LinkedHashMap<Fund, Boolean>()))


fun greeting(name: String): String {
return "hello $name"
}

fun getFunds(): Set<Fund>{
return funds
}


}

@Path("/")
class FundResource {

@Inject
@field: Default
lateinit var service: FundService

// Get all funds
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/funds")
fun list(): Set<Fund> {
logger.debug { "GET -> returning funds" }
println("GET -> returning funds")
return service.getFunds()
}

}

0 comments on commit 880e10b

Please sign in to comment.