Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/CustomerController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ class CustomerController @Inject() (ws: WSClient, config: Configuration) extends
// get /rawcustomers/{customerId}
def getRawCustomer(customerId: String) = Action {
if (null == customerId) throw new InvalidCustomerRequestException
val sqlQuery = "SELECT first_name, last_name FROM customer WHERE id = " + customerId
val sqlQuery = "SELECT first_name, last_name FROM customer WHERE id = :id"
val rawSql = RawSqlBuilder.parse(sqlQuery).create
val query = CustomerController.db.find(classOf[Customer])
query.setRawSql(rawSql)
query.setParameter("id", customerId)
val customer = query.findList.asScala
if (null == customer || customer.isEmpty) throw new CustomerNotFoundException
Ok(Json.toJson(customer))
Expand Down