Skip to content

Commit

Permalink
✨ :: [#318] TeacherDomain / EndPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuunseo committed Feb 20, 2024
1 parent 6f708c8 commit 37f6eba
Showing 1 changed file with 67 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,68 @@
//
// TeacherEndPoint.swift
// TeacherDomainInterface
//
// Created by 정윤서 on 2/20/24.
// Copyright © 2024 com.msg. All rights reserved.
//
import BaseDomain
import Emdpoint

import Foundation
enum TeacherEndPoint {
case common
case principal
case deputyPrincipal
case director
case homeroom(grade: Int, classNum: Int)
}

extension TeacherEndPoint: SMSEndpoint {
typealias ErrorType = TeacherDomainError

var domain: SMSDomain {
.teacher
}

var route: Route {
switch self {
case .common:
return .post("/common")

case .principal:
return .post("/principal")

case .deputyPrincipal:
return .post("/deputy-principal")

case .director:
return .post("/director")

case .homeroom:
return .post("/homeroom")
}
}

var task: HTTPTask {
switch self {
case .homeroom(let grade, let classNum):
return .requestParameters(body: [
"grade": grade,
"classNum": classNum
])

default:
return .requestPlain
}
}

var jwtTokenType: JwtTokenType {
switch self {
default:
return .accessToken
}
}

var errorMap: [Int : ErrorType]? {
switch self {
default:
return [
400: .invalidRequest,
403: .invalidRequest,
409: .alreadyExistUser
]
}
}
}

0 comments on commit 37f6eba

Please sign in to comment.