diff --git a/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/AreaResponseDTO.swift b/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/AreaResponseDTO.swift index c7f1fa8e..58434ac4 100644 --- a/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/AreaResponseDTO.swift +++ b/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/AreaResponseDTO.swift @@ -6,23 +6,27 @@ public struct AreaResponseDTO: Decodable { public let tech: [String] public let hiring: Int public let majorTask: String + public let preferentialTreatment: String? public init( id: Int, job: [String], tech: [String], hiring: Int, - majorTask: String + majorTask: String, + preferentialTreatment: String? ) { self.id = id self.job = job self.tech = tech self.hiring = hiring self.majorTask = majorTask + self.preferentialTreatment = preferentialTreatment } enum CodingKeys: String, CodingKey { case id, job, tech, hiring case majorTask = "major_task" + case preferentialTreatment = "preferential_treatment" } } diff --git a/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/RecruitmentDetailResponseDTO.swift b/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/RecruitmentDetailResponseDTO.swift index 18b5b60a..0d368f9e 100644 --- a/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/RecruitmentDetailResponseDTO.swift +++ b/Projects/Domain/RecruitmentsDomain/Interface/DTO/Response/RecruitmentDetailResponseDTO.swift @@ -5,13 +5,12 @@ public struct RecruitmentDetailResponseDTO: Decodable { public let companyProfileUrl: String public let companyName: String public let areas: [AreaResponseDTO] - public let preferentialTreatment: String? public let requiredGrade: Int? - public let workHours: Int + public let startTime, endTime: String public let requiredLicenses: [String]? public let hiringProgress: [InterviewType] public let trainPay: Int - public let pay: Int? + public let pay: String? public let benefits: String? public let military: Bool public let submitDocument: String @@ -23,13 +22,13 @@ public struct RecruitmentDetailResponseDTO: Decodable { companyProfileUrl: String, companyName: String, areas: [AreaResponseDTO], - preferentialTreatment: String?, requiredGrade: Int?, - workHours: Int, + startTime: String, + endTime: String, requiredLicenses: [String]?, hiringProgress: [InterviewType], trainPay: Int, - pay: Int?, + pay: String?, benefits: String?, military: Bool, submitDocument: String, @@ -41,9 +40,9 @@ public struct RecruitmentDetailResponseDTO: Decodable { self.companyProfileUrl = companyProfileUrl self.companyName = companyName self.areas = areas - self.preferentialTreatment = preferentialTreatment self.requiredGrade = requiredGrade - self.workHours = workHours + self.startTime = startTime + self.endTime = endTime self.requiredLicenses = requiredLicenses self.hiringProgress = hiringProgress self.trainPay = trainPay @@ -61,9 +60,9 @@ public struct RecruitmentDetailResponseDTO: Decodable { case companyProfileUrl = "company_profile_url" case companyName = "company_name" case areas - case preferentialTreatment = "preferential_treatment" case requiredGrade = "required_grade" - case workHours = "work_hours" + case startTime = "start_time" + case endTime = "end_time" case requiredLicenses = "required_licenses" case hiringProgress = "hiring_progress" case trainPay = "train_pay" diff --git a/Projects/Domain/RecruitmentsDomain/Interface/DTO/Trasfer/RecruitmentDetailTransfer.swift b/Projects/Domain/RecruitmentsDomain/Interface/DTO/Trasfer/RecruitmentDetailTransfer.swift index 0a2bb29c..f8aa4d5c 100644 --- a/Projects/Domain/RecruitmentsDomain/Interface/DTO/Trasfer/RecruitmentDetailTransfer.swift +++ b/Projects/Domain/RecruitmentsDomain/Interface/DTO/Trasfer/RecruitmentDetailTransfer.swift @@ -3,33 +3,27 @@ import Foundation public extension RecruitmentDetailResponseDTO { func toDomain() -> RecruitmentDetailEntity { var unwrappedRequiredGrade: String? { - if let requiredGrade { - return String(requiredGrade) + "% 이내" - } else { - return nil - } + guard let requiredGrade else { return nil } + return String(requiredGrade) + "% 이내" } - var unwrappedPay: String? { - if let pay { - return String(pay) + " 만원/년" - } else { - return nil - } + var workTime: String { + startTime.toHoursMinutes() + + " ~ " + + endTime.toHoursMinutes() } return RecruitmentDetailEntity( companyID: companyID, companyProfileUrl: companyProfileUrl, companyName: companyName, areas: areas.map { $0.toDomain() }, - preferentialTreatment: preferentialTreatment, requiredGrade: unwrappedRequiredGrade, - workHours: String(workHours), + workTime: workTime, requiredLicenses: requiredLicenses?.joined(separator: ", "), hiringProgress: hiringProgress.enumerated().map { (index, value) in "\(index + 1). \(value.localizedString())" }.joined(separator: "\n"), trainPay: String(trainPay), - pay: unwrappedPay, + pay: pay, benefits: benefits, military: military, submitDocument: submitDocument, @@ -47,7 +41,14 @@ public extension AreaResponseDTO { job: job.joined(separator: ", "), tech: tech, hiring: hiring, - majorTask: majorTask + majorTask: majorTask, + preferentialTreatment: preferentialTreatment ) } } + +extension String { + func toHoursMinutes() -> String { + self.components(separatedBy: ":")[0...1].joined(separator: ":") + } +} diff --git a/Projects/Domain/RecruitmentsDomain/Interface/Entity/AreaEntity.swift b/Projects/Domain/RecruitmentsDomain/Interface/Entity/AreaEntity.swift index 3f67c2a9..dd25df63 100644 --- a/Projects/Domain/RecruitmentsDomain/Interface/Entity/AreaEntity.swift +++ b/Projects/Domain/RecruitmentsDomain/Interface/Entity/AreaEntity.swift @@ -6,18 +6,21 @@ public struct AreaEntity: Equatable, Hashable { public let tech: [String] public let hiring: Int public let majorTask: String + public let preferentialTreatment: String? public init( id: String, job: String, tech: [String], hiring: Int, - majorTask: String + majorTask: String, + preferentialTreatment: String? ) { self.id = id self.job = job self.tech = tech self.hiring = hiring self.majorTask = majorTask + self.preferentialTreatment = preferentialTreatment } } diff --git a/Projects/Domain/RecruitmentsDomain/Interface/Entity/RecruitmentDetailEntity.swift b/Projects/Domain/RecruitmentsDomain/Interface/Entity/RecruitmentDetailEntity.swift index 800e604e..c2dd8e4c 100644 --- a/Projects/Domain/RecruitmentsDomain/Interface/Entity/RecruitmentDetailEntity.swift +++ b/Projects/Domain/RecruitmentsDomain/Interface/Entity/RecruitmentDetailEntity.swift @@ -5,9 +5,8 @@ public struct RecruitmentDetailEntity: Equatable { public let companyProfileUrl: String public let companyName: String public let areas: [AreaEntity] - public let preferentialTreatment: String? public let requiredGrade: String? - public let workHours: String + public let workTime: String public let requiredLicenses: String? public let hiringProgress: String public let trainPay: String @@ -23,9 +22,8 @@ public struct RecruitmentDetailEntity: Equatable { companyProfileUrl: String, companyName: String, areas: [AreaEntity], - preferentialTreatment: String?, requiredGrade: String?, - workHours: String, + workTime: String, requiredLicenses: String?, hiringProgress: String, trainPay: String, @@ -41,9 +39,8 @@ public struct RecruitmentDetailEntity: Equatable { self.companyProfileUrl = companyProfileUrl self.companyName = companyName self.areas = areas - self.preferentialTreatment = preferentialTreatment self.requiredGrade = requiredGrade - self.workHours = workHours + self.workTime = workTime self.requiredLicenses = requiredLicenses self.hiringProgress = hiringProgress self.trainPay = trainPay diff --git a/Projects/Feature/RecruitmentFeature/Sources/Detail/Components/AreaCell.swift b/Projects/Feature/RecruitmentFeature/Sources/Detail/Components/AreaCell.swift index 18b22dff..4090f814 100644 --- a/Projects/Feature/RecruitmentFeature/Sources/Detail/Components/AreaCell.swift +++ b/Projects/Feature/RecruitmentFeature/Sources/Detail/Components/AreaCell.swift @@ -27,6 +27,9 @@ struct AreaCell: View { if isShowDetail { areaInfo(title: "사용기술", content: area.tech.joined(separator: ", ")) + if let preferentialTreatment = area.preferentialTreatment { + areaInfo(title: "우대사항", content: preferentialTreatment) + } } HStack { diff --git a/Projects/Feature/RecruitmentFeature/Sources/Detail/RecruitmentDetailViewModel.swift b/Projects/Feature/RecruitmentFeature/Sources/Detail/RecruitmentDetailViewModel.swift index 2de78ba4..1ec9be28 100644 --- a/Projects/Feature/RecruitmentFeature/Sources/Detail/RecruitmentDetailViewModel.swift +++ b/Projects/Feature/RecruitmentFeature/Sources/Detail/RecruitmentDetailViewModel.swift @@ -91,7 +91,6 @@ final class RecruitmentDetailViewModel: BaseViewModel { ) { [weak self] recruitmentDetail in self?.recruitmentDetail = recruitmentDetail let insertTitles = [ - "우대사항", "자격증", "필수성적", "근무시간", @@ -103,10 +102,9 @@ final class RecruitmentDetailViewModel: BaseViewModel { "기타사항" ] let insertContents = [ - recruitmentDetail.preferentialTreatment, recruitmentDetail.requiredLicenses, recruitmentDetail.requiredGrade, - recruitmentDetail.workHours + " 시간", + recruitmentDetail.workTime, recruitmentDetail.trainPay + " 만원/월", recruitmentDetail.pay, recruitmentDetail.benefits,