add Player model
This commit is contained in:
34
Sources/stella/Controllers/Api/ToolController.swift
Normal file
34
Sources/stella/Controllers/Api/ToolController.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
import Vapor
|
||||
import SwiftMsgpack
|
||||
import JWT
|
||||
|
||||
struct ToolController: RouteCollection {
|
||||
func boot(routes: any RoutesBuilder) throws {
|
||||
let group = routes.grouped("tool")
|
||||
group.post("signup", use: self.signup)
|
||||
|
||||
}
|
||||
|
||||
@Sendable
|
||||
func signup(req: Request) async throws -> Response {
|
||||
let body = try req.content.decode(SignupReq.self, using: MsgPackDecoder())
|
||||
|
||||
let session = try await req.jwt.verify(body.access_token, as: SessionPayload.self)
|
||||
guard session.type == SessionType.ZAT.rawValue else {
|
||||
throw Abort(.forbidden, reason: "Invalid access token")
|
||||
}
|
||||
|
||||
|
||||
throw Abort(.notImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
struct SignupReq: Content {
|
||||
let app_secret: String
|
||||
let access_token: String
|
||||
let storage_directory_path: String
|
||||
let app_admin: String
|
||||
let kakao_pid: String
|
||||
let device_id: Double
|
||||
let idp_code: String
|
||||
}
|
Reference in New Issue
Block a user