加上更新功能及跨境請求
This commit is contained in:
parent
525ae4d2b5
commit
c6973a3618
@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class RecordData(
|
||||
val member: Member,
|
||||
var record: MemberRecord
|
||||
var record: MemberRecord?
|
||||
)
|
||||
|
||||
@ -7,11 +7,13 @@ import io.ktor.server.application.*
|
||||
fun Application.configureHTTP() {
|
||||
install(CORS) {
|
||||
allowMethod(HttpMethod.Options)
|
||||
allowMethod(HttpMethod.Get)
|
||||
allowMethod(HttpMethod.Put)
|
||||
allowMethod(HttpMethod.Delete)
|
||||
allowMethod(HttpMethod.Patch)
|
||||
allowHeader(HttpHeaders.Authorization)
|
||||
//allowMethod(HttpMethod.Delete)
|
||||
allowMethod(HttpMethod.Post)
|
||||
allowHeader(HttpHeaders.AccessControlAllowOrigin)
|
||||
allowHeader(HttpHeaders.Accept)
|
||||
allowHeader(HttpHeaders.ContentType)
|
||||
anyHost()
|
||||
allowCredentials = true
|
||||
allowNonSimpleContentTypes = true
|
||||
|
||||
@ -21,6 +21,9 @@ import java.util.*
|
||||
|
||||
fun Application.configureMemberRecordRouting() {
|
||||
routing {
|
||||
options("{...}") {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}
|
||||
route("/api") {
|
||||
route("/record") {
|
||||
get {
|
||||
@ -134,7 +137,7 @@ fun getData(year: Int, month: Int, day: Int): List<RecordData> {
|
||||
memberList.forEach { member ->
|
||||
if (member.createAt!! < startTime && !member.leave) {
|
||||
records.add(
|
||||
RecordData(member = member, MemberRecord())
|
||||
RecordData(member = member, null)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,9 @@ import kotlinx.coroutines.coroutineScope
|
||||
|
||||
fun Application.configureMemberRouting() {
|
||||
routing {
|
||||
options("{...}") {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
}
|
||||
route("/api") {
|
||||
route("/member") {
|
||||
get {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user