mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-05 04:17:26 +08:00
[+] Add lazy uid to context
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package icu.samnyan.aqua.sega.general
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import ext.long
|
||||
import ext.parsing
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
|
||||
/**
|
||||
@@ -14,7 +16,9 @@ fun interface BaseHandler {
|
||||
data class RequestContext(
|
||||
val req: HttpServletRequest,
|
||||
val data: Map<String, Any>,
|
||||
)
|
||||
) {
|
||||
val uid by lazy { parsing { data["userId"]!!.long } }
|
||||
}
|
||||
|
||||
typealias SpecialHandler = RequestContext.() -> Any?
|
||||
fun BaseHandler.toSpecial() = { ctx: RequestContext -> handle(ctx.data) }
|
||||
|
||||
Reference in New Issue
Block a user