Skip to content

[IDLE-000] 요양보호사 공고지원하기 #51

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

Merged
merged 22 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8c4e2de
[IDLE-000] 요양보호사 설정화면에서 내 프로필 보기 구현
J0onYEong Aug 29, 2024
fd867ed
[IDLE-000] 즐겨찾기및 지원한 공고 조회 UseCase/Repository/API
J0onYEong Aug 29, 2024
cb2582e
[IDLE-000] 즐겨찾기및 지원한 공고 조회 페이징 적용
J0onYEong Aug 29, 2024
d3805e6
[IDLE-000] 공고지원 API 구현
J0onYEong Aug 29, 2024
82d9eaf
[IDLE-000] 센터 인증 정보 저장방식 구현
J0onYEong Aug 29, 2024
380b673
[IDLE-000] 디코딩 오탈자 수정
J0onYEong Aug 30, 2024
5e9f23a
[IDLE-000] 요양보호사 진행중인 공고 UI수정
J0onYEong Aug 30, 2024
1e9b677
Merge branch 'feature/worker_set_favorite_post' into feature/auth_center
J0onYEong Sep 2, 2024
6cec4cc
[IDLE-000] 앱내 공고와 외부공고 구분짓는 이름수정
J0onYEong Sep 3, 2024
93c7979
[IDLE-000] 앱내 공고와 외부공고 구분짓는 이름수정(2)
J0onYEong Sep 3, 2024
3a452e4
[IDLE-000] 페이징 내역 새로고침 구현
J0onYEong Sep 3, 2024
5a480a6
[IDLE-000] 공고지원하기 UseCase / Repository
J0onYEong Sep 3, 2024
8ef2600
[IDLE-000] 지원하기 기능 구현
J0onYEong Sep 3, 2024
bd74b80
[IDLE-000] 지원하기 성공시 화면 초기화 구현
J0onYEong Sep 3, 2024
84c7e11
[IDLE-000] DefaultLoadingVC구현
J0onYEong Sep 3, 2024
69926ad
[IDLE-000] 지원하기 및 공고 전체조회에 로딩 애니메이션 설정
J0onYEong Sep 3, 2024
ccc2444
[IDLE-000] 지원한 공고 밑 즐겨찾기한 공고 로딩 추가
J0onYEong Sep 3, 2024
35c5c68
[IDLE-000] 공고 상세화면안에서 지원하기 기능구현
J0onYEong Sep 3, 2024
5fe5493
[IDLE-000] 지원한 공고/ 찜한 공고 페이징 수정
J0onYEong Sep 3, 2024
591d8a0
[IDLE-000] 지원한 공고 지원버튼 비활성화
J0onYEong Sep 3, 2024
ed8533e
[IDLE-000] 지원한 공고 / 찜한 공고 공고 상세보기 활성화
J0onYEong Sep 3, 2024
c244ae6
[IDLE-000] DSKit 예시앱 오탈자 수정
J0onYEong Sep 3, 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 @@ -43,9 +43,11 @@ class AppliedAndLikedBoardCoordinator: WorkerRecruitmentBoardCoordinatable {
public func start() {
let vc = StarredAndAppliedVC()
let appliedVM = AppliedPostBoardVM(
coordinator: self,
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self)
)
let starredVM = StarredPostBoardVM(
coordinator: self,
recruitmentPostUseCase: injector.resolve(RecruitmentPostUseCase.self)
)
vc.bind(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,17 @@ class WorkerSettingCoordinaator: WorkerSettingScreenCoordinatable {
coordinator.parent = self
coordinator.start()
}

public func showMyProfileScreen() {
let coordinator = WorkerProfileCoordinator(
dependency: .init(
profileMode: .myProfile,
navigationController: navigationController,
workerProfileUseCase: injector.resolve(WorkerProfileUseCase.self)
)
)
addChildCoordinator(coordinator)
coordinator.parent = self
coordinator.start()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import Moya

public class DefaultRecruitmentPostRepository: RecruitmentPostRepository {

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

public init(_ store: KeyValueStore? = nil) {
if let store {
self.service = RecruitmentPostService(keyValueStore: store)
self.recruitmentPostService = RecruitmentPostService(keyValueStore: store)
self.applyService = ApplyService(keyValueStore: store)
}
}

Expand All @@ -27,13 +29,13 @@ public class DefaultRecruitmentPostRepository: RecruitmentPostRepository {

let encodedData = try! JSONEncoder().encode(bundle.toDTO())

return service.request(api: .registerPost(postData: encodedData), with: .withToken)
return recruitmentPostService.request(api: .registerPost(postData: encodedData), with: .withToken)
.mapToVoid()
}

public func getPostDetailForCenter(id: String) -> RxSwift.Single<Entity.RegisterRecruitmentPostBundle> {

service.request(api: .postDetail(id: id, userType: .center), with: .withToken)
recruitmentPostService.request(api: .postDetail(id: id, userType: .center), with: .withToken)
.map(RecruitmentPostFetchDTO.self)
.map { dto in
dto.toEntity()
Expand All @@ -44,53 +46,53 @@ public class DefaultRecruitmentPostRepository: RecruitmentPostRepository {

let encodedData = try! JSONEncoder().encode(bundle.toDTO())

return service.request(
return recruitmentPostService.request(
api: .editPost(id: id, postData: encodedData),
with: .withToken
).map { _ in () }
}

public func getOngoingPosts() -> RxSwift.Single<[Entity.RecruitmentPostInfoForCenterVO]> {
return service.request(api: .getOnGoingPosts, with: .withToken)
return recruitmentPostService.request(api: .getOnGoingPosts, with: .withToken)
.map(RecruitmentPostForCenterListDTO.self)
.map({ $0.jobPostings.map { $0.toVO() } })
}

public func getClosedPosts() -> RxSwift.Single<[Entity.RecruitmentPostInfoForCenterVO]> {
return service.request(api: .getClosedPosts, with: .withToken)
return recruitmentPostService.request(api: .getClosedPosts, with: .withToken)
.map(RecruitmentPostForCenterListDTO.self)
.map({ $0.jobPostings.map { $0.toVO() } })
}

public func getPostApplicantCount(id: String) -> RxSwift.Single<Int> {
service.request(api: .getPostApplicantCount(id: id), with: .withToken)
recruitmentPostService.request(api: .getPostApplicantCount(id: id), with: .withToken)
.map(PostApplicantCountDTO.self)
.map { dto in
dto.applicantCount
}
}

public func getPostApplicantScreenData(id: String) -> RxSwift.Single<Entity.PostApplicantScreenVO> {
service.request(api: .getApplicantList(id: id), with: .withToken)
recruitmentPostService.request(api: .getApplicantList(id: id), with: .withToken)
.map(PostApplicantScreenDTO.self)
.map { dto in
dto.toVO()
}
}

public func closePost(id: String) -> RxSwift.Single<Void> {
service.request(api: .closePost(id: id), with: .withToken)
recruitmentPostService.request(api: .closePost(id: id), with: .withToken)
.mapToVoid()
}

public func removePost(id: String) -> RxSwift.Single<Void> {
service.request(api: .removePost(id: id), with: .withToken)
recruitmentPostService.request(api: .removePost(id: id), with: .withToken)
.mapToVoid()
}

// MARK: Worker
public func getPostDetailForWorker(id: String) -> RxSwift.Single<Entity.RecruitmentPostForWorkerBundle> {
service.request(
recruitmentPostService.request(
api: .postDetail(id: id, userType: .worker),
with: .withToken
)
Expand All @@ -102,21 +104,73 @@ public class DefaultRecruitmentPostRepository: RecruitmentPostRepository {

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

service.request(
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 {
print(error.localizedDescription)
#if DEBUG
print("앱용 공고 전체조회 에러:", error.localizedDescription)
#endif
}
return .error(error)
})
.map { dto in
dto.toEntity()
}
}

public func getFavoritePostListForWorker(nextPageId: String?, requestCnt: Int) -> RxSwift.Single<Entity.RecruitmentPostListForWorkerVO> {
recruitmentPostService.request(
api: .getFavoritePostListForWorker(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()
}
}

public func getAppliedPostListForWorker(nextPageId: String?, requestCnt: Int) -> RxSwift.Single<Entity.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()
}
}

public func ApplyToPost(postId: String, method: ApplyType) -> Single<Void> {
applyService
.request(
api: .applys(
jobPostingId: postId,
applyMethodType: method.dtoFormString
),
with: .withToken
)
.mapToVoid()
}
}

// MARK: 공고등록 정보를 DTO로 변환하는 영역
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum UserInfoStorageKey: String, Hashable, CaseIterable {

// Center
case currentCenter = "currentCenter"
case currentCenterAuthState = "currentCenterAuthState"
}

public class DefaultUserInfoLocalRepository: UserInfoLocalRepository {
Expand Down Expand Up @@ -83,6 +84,18 @@ public class DefaultUserInfoLocalRepository: UserInfoLocalRepository {
localStorageService.saveData(key: K.currentCenter.rawValue, value: encoded)
}

public func setCenterAuthState(state: CenterAuthState) {
localStorageService.saveData(key: K.currentCenterAuthState.rawValue, value: state.rawValue)
}

public func getCenterAuthState() -> Entity.CenterAuthState? {
if let centerState: String = localStorageService.fetchData(key: K.currentCenterAuthState.rawValue) {

return CenterAuthState(rawValue: centerState)
}
return nil
}

public func removeAllData() {

UserInfoStorageKey.allCases.forEach { key in
Expand Down
60 changes: 60 additions & 0 deletions project/Projects/Data/DataSource/API/ApplyAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// ApplyAPI.swift
// DataSource
//
// Created by choijunios on 9/3/24.
//

import Foundation
import Moya
import Alamofire
import Entity

public enum ApplyAPI {
case applys(jobPostingId: String, applyMethodType: String)
}

extension ApplyAPI: BaseAPI {

public var apiType: APIType {
.applys
}

public var path: String {
switch self {
case .applys:
""
}
}

public var method: Moya.Method {
switch self {
case .applys:
.post
}
}

var bodyParameters: Parameters? {
var params: Parameters = [:]
switch self {
case .applys(let jobPostingId, let applyMethodType):
params["jobPostingId"] = jobPostingId
params["applyMethodType"] = applyMethodType
return params
}
}

var parameterEncoding: ParameterEncoding {
switch self {
default:
return JSONEncoding.default
}
}

public var task: Moya.Task {
switch self {
case .applys:
return .requestParameters(parameters: bodyParameters ?? [:], encoding: parameterEncoding)
}
}
}
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 @@ -14,6 +14,7 @@ public enum APIType {
case users
case job_postings
case external(url: String)
case applys
}

// MARK: BaseAPI
Expand All @@ -35,6 +36,8 @@ public extension BaseAPI {
baseStr += "/users"
case .job_postings:
baseStr += "/job-postings"
case .applys:
baseStr += "/applys"
case .external(let url):
baseStr = url
}
Expand Down
30 changes: 27 additions & 3 deletions project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ public enum RcruitmentPostAPI {
// - 공고 지원자 관련
case getPostApplicantCount(id: String)


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

extension RcruitmentPostAPI: BaseAPI {
Expand Down Expand Up @@ -70,6 +71,11 @@ extension RcruitmentPostAPI: BaseAPI {

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

}
}

Expand Down Expand Up @@ -103,6 +109,10 @@ extension RcruitmentPostAPI: BaseAPI {

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

Expand All @@ -114,6 +124,16 @@ 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
}
params["limit"] = requestCnt
default:
break
}
Expand All @@ -122,7 +142,9 @@ extension RcruitmentPostAPI: BaseAPI {

var parameterEncoding: ParameterEncoding {
switch self {
case .getOnGoingNativePostListForWorker:
case .getOnGoingNativePostListForWorker,
.getFavoritePostListForWorker,
.getAppliedPostListForWorker:
return URLEncoding.queryString
default:
return JSONEncoding.default
Expand All @@ -131,7 +153,9 @@ extension RcruitmentPostAPI: BaseAPI {

public var task: Moya.Task {
switch self {
case .getOnGoingNativePostListForWorker:
case .getOnGoingNativePostListForWorker,
.getFavoritePostListForWorker,
.getAppliedPostListForWorker:
.requestParameters(parameters: bodyParameters ?? [:], encoding: parameterEncoding)
case .registerPost(let bodyData):
.requestData(bodyData)
Expand Down
Loading
Loading