This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
intercept { req, resp, cont -> | |
transaction { | |
cont(req, resp) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun HtmlBodyTag.shortOrdersList(customer: CustomerProfile) { | |
val orders = customer.orders.toList().sortBy { -(it.date?.getMillis()?:0.toLong()) } | |
table(s("table table-striped table-condensed")) { | |
for (order in orders.take(5)) { | |
tr { | |
td { | |
order.date?.let { | |
small { | |
+DateTimeFormat.forPattern("dd/MM/yy").print(it)!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post("profile/p") class UpdateProfileDetails(val f: String, val l: String, e: String) : Request({ | |
authorize { | |
update(Account) { | |
firstName = f | |
lastName = l | |
email = e | |
} | |
redirect(ProfilePage(null)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun retrySchedule(attempt: Int): DateTime { | |
return with(DateTime.now()) { | |
when (attempt) { | |
1 -> plusSeconds(3) | |
2 -> plusMinutes(1) | |
else -> plusHours(1) | |
} | |
} | |
} |