Skip to content

Instantly share code, notes, and snippets.

@danfunk
Created January 13, 2015 22:02
Show Gist options
  • Select an option

  • Save danfunk/dec358d78873bc4f5eb4 to your computer and use it in GitHub Desktop.

Select an option

Save danfunk/dec358d78873bc4f5eb4 to your computer and use it in GitHub Desktop.
} ~
path("products" / "bulk") {
logger.debug("Products Bulk endpoint called.")
put {
logger.debug(" ..... and it got this far with a put." )
entity(as[BulkUpdateCommand]) { bulkUpdateCommand =>
logger.debug(" ..... and it got this far with " + bulkUpdateCommand)
respondWithStatus(NoContent) {
complete {
productService.bulkAction(bulkUpdateCommand)
}
}
}
}
} ~
path("products" / Segment) { styleId =>
get {
....
"Direct /products/bulk PUT" should {
"modify the activation status on a group of products at once" in {
val bulkUpdate = BulkUpdateCommand("isActive", false, List("1", "2"))
Put("/products/bulk", bulkUpdate) ~>
dbTools.tokenHeader ~>
sealRoute(productRoute) ~>
check {
status === NoContent
dbTools.getProduct("1").isActive === false
dbTools.getProduct("2").isActive === false
}
val bulkUpdate2 = BulkUpdateCommand("isActive", true, List("1", "2"))
Put("/products/bulk", bulkUpdate2) ~>
dbTools.tokenHeader ~>
sealRoute(productRoute) ~>
check {
status === NoContent
dbTools.getProduct("1").isActive === true
dbTools.getProduct("2").isActive === true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment