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