Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDLE-000] 요양보호사는 워크넷 공고를 카드로 볼 수 있고 상세정보를 확인할 수 있다. #56

Merged
merged 17 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5562991
[IDLE-000] 센터 공고카드 UI 조정
J0onYEong Sep 5, 2024
b094838
[IDLE-000] 요양보호사 공고카드 UI 조정
J0onYEong Sep 5, 2024
1bd5e34
[IDLE-000] 최초 접속시 무조건 프로필을 요청하도록 변경
J0onYEong Sep 6, 2024
96f36f4
[IDLE-000] WorkerWorknetEmployCard구현
J0onYEong Sep 6, 2024
de66ea7
[IDLE-000] WorkerWorknetEmployCardCell일부 구현
J0onYEong Sep 6, 2024
06495d7
[IDLE-000] CrawlingPostAPI구현
J0onYEong Sep 6, 2024
51b5236
[IDLE-000] WorkerWorknetEmployCardCell구현및 적용(테스트 전)
J0onYEong Sep 6, 2024
c768472
[IDLE-000] WorkerWorknetEmployCardCell 모킹 테스트 완료
J0onYEong Sep 6, 2024
cb245af
[IDLE-000] estimatedCellHeight 설정
J0onYEong Sep 6, 2024
8ca71c2
[IDLE-000] 워크넷 공고 상세조회 UseCase/Repository
J0onYEong Sep 6, 2024
8fc2592
[IDLE-000] 워크넷 공고 상세조회 WorknetPostDetailForWorkerVC구현(테스트 전)
J0onYEong Sep 6, 2024
cd8d928
[IDLE-000] 워크넷 공고 상세조회 WorknetPostDetailForWorkerVC구현(테스트 완료)
J0onYEong Sep 6, 2024
c319c08
[IDLE-000] 공고 상세조회에서 요양보호사 위치 불러오기
J0onYEong Sep 6, 2024
1671469
[IDLE-000] 워크넷 공고페이지로 이동
J0onYEong Sep 6, 2024
a8358d2
[IDLE-000] 워크넷 공고페이지로 이동불가시 alert처리
J0onYEong Sep 7, 2024
6c99d9a
[IDLE-000] 앱내/워크넷 즐겨찾기한 공고 API 수정
J0onYEong Sep 7, 2024
e093cb7
[IDLE-000] 테스트코드 수정
J0onYEong Sep 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import UIKit
import WorkerFeature
import Entity
import BaseFeature
import CenterFeature
import PresentationCore
Expand Down Expand Up @@ -65,13 +66,15 @@ class AppliedAndLikedBoardCoordinator: WorkerRecruitmentBoardCoordinatable {
}

extension AppliedAndLikedBoardCoordinator {
public func showPostDetail(postId: String) {
public func showPostDetail(postType: RecruitmentPostType, postId: String) {
let coodinator = PostDetailForWorkerCoodinator(
dependency: .init(
postType: postType,
postId: postId,
parent: self,
navigationController: navigationController,
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self)
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self),
workerProfileUseCase: injector.resolve(WorkerProfileUseCase.self)
)
)
addChildCoordinator(coodinator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit
import WorkerFeature
import BaseFeature
import CenterFeature
import Entity
import PresentationCore
import UseCaseInterface

Expand Down Expand Up @@ -54,13 +55,15 @@ class WorkerRecruitmentBoardCoordinator: WorkerRecruitmentBoardCoordinatable {
}

extension WorkerRecruitmentBoardCoordinator {
public func showPostDetail(postId: String) {
public func showPostDetail(postType: RecruitmentPostType, postId: String) {
let coodinator = PostDetailForWorkerCoodinator(
dependency: .init(
postType: postType,
postId: postId,
parent: self,
navigationController: navigationController,
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self)
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self),
workerProfileUseCase: injector.resolve(WorkerProfileUseCase.self)
)
)
addChildCoordinator(coodinator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import Moya
public class DefaultRecruitmentPostRepository: RecruitmentPostRepository {

private var recruitmentPostService: RecruitmentPostService = .init()
private var crawlingPostService: CrawlingPostService = .init()
private var applyService: ApplyService = .init()

public init(_ store: KeyValueStore? = nil) {
if let store {
self.recruitmentPostService = RecruitmentPostService(keyValueStore: store)
self.crawlingPostService = CrawlingPostService(keyValueStore: store)
self.applyService = ApplyService(keyValueStore: store)
}
}
Expand Down Expand Up @@ -91,73 +93,61 @@ public class DefaultRecruitmentPostRepository: RecruitmentPostRepository {
}

// MARK: Worker
public func getPostDetailForWorker(id: String) -> RxSwift.Single<Entity.RecruitmentPostForWorkerBundle> {
public func getNativePostDetailForWorker(id: String) -> RxSwift.Single<Entity.RecruitmentPostForWorkerBundle> {
recruitmentPostService.request(
api: .postDetail(id: id, userType: .worker),
with: .withToken
)
.map(RecruitmentPostDTO.self)
.map { dto in
dto.toEntity()
}
.mapToEntity(NativeRecruitmentPostDetailDTO.self)
}

public func getWorknetPostDetailForWorker(id: String) -> RxSwift.Single<Entity.WorknetRecruitmentPostDetailVO> {
crawlingPostService
.request(api: .getDetail(postId: id), with: .withToken)
.mapToEntity(WorknetRecruitmentPostDetailDTO.self)
}

public func getNativePostListForWorker(nextPageId: String?, requestCnt: Int = 10) -> RxSwift.Single<Entity.RecruitmentPostListForWorkerVO> {

public func getNativePostListForWorker(nextPageId: String?, requestCnt: Int = 10) -> RxSwift.Single<RecruitmentPostListForWorkerVO> {

recruitmentPostService.request(
api: .getOnGoingNativePostListForWorker(nextPageId: nextPageId, requestCnt: String(requestCnt)),
with: .withToken
)
.map(RecruitmentPostListForWorkerDTO.self)
.catch({ error in
if let moyaError = error as? MoyaError, case .objectMapping(let error, _) = moyaError {
#if DEBUG
print("앱용 공고 전체조회 에러:", error.localizedDescription)
#endif
}
return .error(error)
})
.map { dto in
dto.toEntity()
}
.mapToEntity(RecruitmentPostListForWorkerDTO<NativeRecruitmentPostForWorkerDTO>.self)
}

public func getFavoritePostListForWorker(nextPageId: String?, requestCnt: Int) -> RxSwift.Single<Entity.RecruitmentPostListForWorkerVO> {
public func getNativeFavoritePostListForWorker() -> RxSwift.Single<[RecruitmentPostForWorkerRepresentable]> {
recruitmentPostService.request(
api: .getFavoritePostListForWorker(nextPageId: nextPageId, requestCnt: String(requestCnt)),
api: .getNativeFavoritePost,
with: .withToken
)
.map(RecruitmentPostListForWorkerDTO.self)
.catch({ error in
if let moyaError = error as? MoyaError, case .objectMapping(let error, _) = moyaError {
#if DEBUG
print("즐겨찾기한 공고 전체조회 에러:",error.localizedDescription)
#endif
}
return .error(error)
})
.map { dto in
dto.toEntity()
}
.mapToEntity(FavoriteRecruitmentPostListForWorkerDTO<NativeRecruitmentPostForWorkerDTO>.self)
}

public func getAppliedPostListForWorker(nextPageId: String?, requestCnt: Int) -> RxSwift.Single<Entity.RecruitmentPostListForWorkerVO> {
public func getWorknetFavoritePostListForWorker() -> RxSwift.Single<[RecruitmentPostForWorkerRepresentable]> {
crawlingPostService.request(
api: .getWorknetFavoritePost,
with: .withToken
)
.mapToEntity(FavoriteRecruitmentPostListForWorkerDTO<WorkNetRecruitmentPostForWorkerDTO>.self)
}

public func getAppliedPostListForWorker(nextPageId: String?, requestCnt: Int) -> RxSwift.Single<RecruitmentPostListForWorkerVO> {
recruitmentPostService.request(
api: .getAppliedPostListForWorker(nextPageId: nextPageId, requestCnt: String(requestCnt)),
with: .withToken
)
.map(RecruitmentPostListForWorkerDTO.self)
.catch({ error in
if let moyaError = error as? MoyaError, case .objectMapping(let error, _) = moyaError {
#if DEBUG
print("지원한 공고 전체조회 에러:", error.localizedDescription)
#endif
}
return .error(error)
})
.map { dto in
dto.toEntity()
}
.mapToEntity(RecruitmentPostListForWorkerDTO<NativeRecruitmentPostForWorkerDTO>.self)
}

public func getWorknetPostListForWorker(nextPageId: String?, requestCnt: Int) -> RxSwift.Single<RecruitmentPostListForWorkerVO> {
crawlingPostService
.request(
api: .getPostList(nextPageId: nextPageId, requestCnt: requestCnt),
with: .withToken
)
.mapToEntity(RecruitmentPostListForWorkerDTO<WorkNetRecruitmentPostForWorkerDTO>.self)
}

public func applyToPost(postId: String, method: ApplyType) -> Single<Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class SaveUserInfoDataTests: XCTestCase {
expYear: nil,
address: .init(roadAddress: "test", jibunAddress: "test"),
introductionText: "test",
specialty: "test"
specialty: "test",
longitude: 0.0,
latitude: 0.0
)
)

Expand Down
3 changes: 3 additions & 0 deletions project/Projects/Data/DataSource/API/BaseAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum APIType {
case auth
case users
case job_postings
case crawling_job_postings
case external(url: String)
case applys
}
Expand All @@ -36,6 +37,8 @@ public extension BaseAPI {
baseStr += "/users"
case .job_postings:
baseStr += "/job-postings"
case .crawling_job_postings:
baseStr += "/crawling-job-postings"
case .applys:
baseStr += "/applys"
case .external(let url):
Expand Down
78 changes: 78 additions & 0 deletions project/Projects/Data/DataSource/API/CrawlingPostAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// CrawlingPostAPI.swift
// DataSource
//
// Created by choijunios on 9/6/24.
//

import Foundation
import Alamofire
import Moya

public enum CrawlingPostAPI {

case getPostList(nextPageId: String?, requestCnt: Int)
case getDetail(postId: String)
case getWorknetFavoritePost
}

extension CrawlingPostAPI: BaseAPI {
public var apiType: APIType {
.crawling_job_postings
}

public var path: String {
switch self {
case .getPostList:
""
case .getDetail(let postId):
"/\(postId)"
case .getWorknetFavoritePost:
"/my/favorites"
}
}

public var method: Moya.Method {
switch self {
case .getPostList:
.get
case .getDetail:
.get
case .getWorknetFavoritePost:
.get
}
}

var bodyParameters: Parameters? {
var params: Parameters = [:]
switch self {
case .getPostList(let nextPageId, let requestCnt):
if let nextPageId {
params["next"] = nextPageId
}
params["limit"] = requestCnt
default:
break
}

return params
}

var parameterEncoding: ParameterEncoding {
switch self {
case .getPostList:
return URLEncoding.queryString
default:
return JSONEncoding.default
}
}

public var task: Moya.Task {
switch self {
case .getPostList:
.requestParameters(parameters: bodyParameters ?? [:], encoding: parameterEncoding)
default:
.requestPlain
}
}
}
20 changes: 8 additions & 12 deletions project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public enum RcruitmentPostAPI {

// Worker
case getOnGoingNativePostListForWorker(nextPageId: String?, requestCnt: String)
case getFavoritePostListForWorker(nextPageId: String?, requestCnt: String)
case getAppliedPostListForWorker(nextPageId: String?, requestCnt: String)

// Favorite posts
case getNativeFavoritePost
case addFavoritePost(id: String, jobPostingType: RecruitmentPostType)
case removeFavoritePost(id: String)
}
Expand Down Expand Up @@ -73,11 +75,12 @@ extension RcruitmentPostAPI: BaseAPI {

case .getOnGoingNativePostListForWorker:
""
case .getFavoritePostListForWorker:
"/my/favorites"
case .getAppliedPostListForWorker:
"/carer/my/applied"


case .getNativeFavoritePost:
"/my/favorites"
case .addFavoritePost(let id, _):
"/\(id)/favorites"
case .removeFavoritePost(let id):
Expand Down Expand Up @@ -115,11 +118,11 @@ extension RcruitmentPostAPI: BaseAPI {

case .getOnGoingNativePostListForWorker:
.get
case .getFavoritePostListForWorker:
.get
case .getAppliedPostListForWorker:
.get

case .getNativeFavoritePost:
.get
case .addFavoritePost:
.post
case .removeFavoritePost:
Expand All @@ -135,11 +138,6 @@ extension RcruitmentPostAPI: BaseAPI {
params["next"] = nextPageId
}
params["limit"] = requestCnt
case .getFavoritePostListForWorker(let nextPageId, let requestCnt):
if let nextPageId {
params["next"] = nextPageId
}
params["limit"] = requestCnt
case .getAppliedPostListForWorker(let nextPageId, let requestCnt):
if let nextPageId {
params["next"] = nextPageId
Expand All @@ -156,7 +154,6 @@ extension RcruitmentPostAPI: BaseAPI {
var parameterEncoding: ParameterEncoding {
switch self {
case .getOnGoingNativePostListForWorker,
.getFavoritePostListForWorker,
.getAppliedPostListForWorker:
return URLEncoding.queryString
default:
Expand All @@ -167,7 +164,6 @@ extension RcruitmentPostAPI: BaseAPI {
public var task: Moya.Task {
switch self {
case .getOnGoingNativePostListForWorker,
.getFavoritePostListForWorker,
.getAppliedPostListForWorker:
.requestParameters(parameters: bodyParameters ?? [:], encoding: parameterEncoding)
case .registerPost(let bodyData):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RecruitmentPostDetailForWorkerDTO.swift
// NativeRecruitmentPostDetailDTO.swift
// NetworkDataSource
//
// Created by choijunios on 8/15/24.
Expand All @@ -8,7 +8,7 @@
import Foundation
import Entity

public struct RecruitmentPostDTO: Codable {
public struct NativeRecruitmentPostDetailDTO: EntityRepresentable {
public let id: String

public let longitude: String
Expand Down Expand Up @@ -106,8 +106,8 @@ public struct RecruitmentPostDTO: Codable {
)

let jobLocation: LocationInformation = .init(
longitude: Double(longitude)!,
latitude: Double(latitude)!
longitude: Double(longitude) ?? 0.0,
latitude: Double(latitude) ?? 0.0
)

// MARK: Apply date
Expand Down
Loading
Loading