Skip to content

Commit

Permalink
refactor/#301 서비스타입 변경사항 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaybei committed Aug 23, 2024
1 parent 7e95f19 commit 659f7b3
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 175 deletions.
25 changes: 12 additions & 13 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
A3DD9C402C41BAD000E58A13 /* MeetingListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */; };
A3DD9C412C41BAD000E58A13 /* MeetingListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C3A2C41BAD000E58A13 /* MeetingListViewModel.swift */; };
A3DD9C682C45C78300E58A13 /* HomeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C672C45C78300E58A13 /* HomeService.swift */; };
A3FB02442C788A790026DE0E /* HomeServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */; };
A3FB184D2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB184C2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift */; };
A3FB184F2C3BF4BC001483E5 /* MakeMeetingsResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB184E2C3BF4BB001483E5 /* MakeMeetingsResponseModel.swift */; };
A3FB18512C3BF531001483E5 /* RegisterMeetingsResquestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB18502C3BF531001483E5 /* RegisterMeetingsResquestModel.swift */; };
Expand Down Expand Up @@ -118,7 +119,6 @@
DD39768A2C41C2AD00E2A4C4 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3976822C41C2AD00E2A4C4 /* HomeViewController.swift */; };
DD39768C2C41C36B00E2A4C4 /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD39768B2C41C36B00E2A4C4 /* Color.xcassets */; };
DD3F9DC62C484DEB008E1FF7 /* PromiseService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DC52C484DEB008E1FF7 /* PromiseService.swift */; };
DD3F9DCC2C485614008E1FF7 /* HomeServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */; };
DD3F9DD02C48571A008E1FF7 /* MeetingListServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DCF2C48571A008E1FF7 /* MeetingListServiceType.swift */; };
DD3F9DD22C485753008E1FF7 /* UtilService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DD12C485753008E1FF7 /* UtilService.swift */; };
DD3F9DD42C4858A3008E1FF7 /* UtilTargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DD32C4858A3008E1FF7 /* UtilTargetType.swift */; };
Expand Down Expand Up @@ -252,7 +252,6 @@
782B407E2C3E44B7008B0CA7 /* WelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = "<group>"; };
782B40812C3E4925008B0CA7 /* NicknameViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameViewModel.swift; sourceTree = "<group>"; };
784824F62C6E1C9900FE07A0 /* AuthServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthServiceProtocol.swift; sourceTree = "<group>"; };
785AE1D02C3B07A600677CA0 /* PrivacyInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = PrivacyInfo.plist; sourceTree = "<group>"; };
789196332C486F6B00FF8CDF /* KeychainAccessible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainAccessible.swift; sourceTree = "<group>"; };
789196352C492F8600FF8CDF /* AuthTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthTargetType.swift; sourceTree = "<group>"; };
789196372C49697B00FF8CDF /* AuthError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthError.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -286,6 +285,7 @@
A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewController.swift; sourceTree = "<group>"; };
A3DD9C3A2C41BAD000E58A13 /* MeetingListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewModel.swift; sourceTree = "<group>"; };
A3DD9C672C45C78300E58A13 /* HomeService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeService.swift; sourceTree = "<group>"; };
A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeServiceProtocol.swift; sourceTree = "<group>"; };
A3FB184C2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingsRequestModel.swift; sourceTree = "<group>"; };
A3FB184E2C3BF4BB001483E5 /* MakeMeetingsResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingsResponseModel.swift; sourceTree = "<group>"; };
A3FB18502C3BF531001483E5 /* RegisterMeetingsResquestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterMeetingsResquestModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -315,7 +315,6 @@
DD3976822C41C2AD00E2A4C4 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
DD39768B2C41C36B00E2A4C4 /* Color.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Color.xcassets; sourceTree = "<group>"; };
DD3F9DC52C484DEB008E1FF7 /* PromiseService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromiseService.swift; sourceTree = "<group>"; };
DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeServiceType.swift; sourceTree = "<group>"; };
DD3F9DCF2C48571A008E1FF7 /* MeetingListServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingListServiceType.swift; sourceTree = "<group>"; };
DD3F9DD12C485753008E1FF7 /* UtilService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilService.swift; sourceTree = "<group>"; };
DD3F9DD32C4858A3008E1FF7 /* UtilTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilTargetType.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -717,6 +716,14 @@
path = Service;
sourceTree = "<group>";
};
A3FB02422C788A520026DE0E /* ServiceProtocol */ = {
isa = PBXGroup;
children = (
A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */,
);
path = ServiceProtocol;
sourceTree = "<group>";
};
DD1FD02C2C5CC6DE00D0A72C /* View */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -817,7 +824,7 @@
DD3976752C41C2AD00E2A4C4 /* Home */ = {
isa = PBXGroup;
children = (
DD3F9DCA2C485606008E1FF7 /* ServiceType */,
A3FB02422C788A520026DE0E /* ServiceProtocol */,
DD3976762C41C2AD00E2A4C4 /* ViewModel */,
DD3976812C41C2AD00E2A4C4 /* ViewController */,
DD39767C2C41C2AD00E2A4C4 /* View */,
Expand Down Expand Up @@ -895,14 +902,6 @@
path = ViewController;
sourceTree = "<group>";
};
DD3F9DCA2C485606008E1FF7 /* ServiceType */ = {
isa = PBXGroup;
children = (
DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */,
);
path = ServiceType;
sourceTree = "<group>";
};
DD3F9DCE2C485700008E1FF7 /* ServiceType */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1754,6 +1753,7 @@
DD30721E2C3C0CC800416D9F /* PromiseInfoResponseModel.swift in Sources */,
DD41BEFF2C41DAA40095A068 /* TardyEmptyView.swift in Sources */,
A3FB18512C3BF531001483E5 /* RegisterMeetingsResquestModel.swift in Sources */,
A3FB02442C788A790026DE0E /* HomeServiceProtocol.swift in Sources */,
DD8626632C4606A300E4F980 /* EnterReadyInfoButtonView.swift in Sources */,
789AD4B32C3C0093002E2688 /* SocialLoginResponseModel.swift in Sources */,
DD43937F2C41357800EC1799 /* InviteCodeViewModel.swift in Sources */,
Expand Down Expand Up @@ -1830,7 +1830,6 @@
DECB845E2C4442AF0022A003 /* FindPlaceView.swift in Sources */,
DE6D4D0F2C3F14D80005584B /* MeetingInfoService.swift in Sources */,
DD3F9DD62C4988E2008E1FF7 /* RegisterMeetingsResponseModel.swift in Sources */,
DD3F9DCC2C485614008E1FF7 /* HomeServiceType.swift in Sources */,
DD39768A2C41C2AD00E2A4C4 /* HomeViewController.swift in Sources */,
DED5DBF42C34539A006ECE7E /* BaseTableViewCell.swift in Sources */,
DDE7D2CA2C47EE81005A921F /* PromiseTargetType.swift in Sources */,
Expand Down
136 changes: 136 additions & 0 deletions KkuMulKum/Network/Service/HomeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,139 @@ final class HomeService {
}
}
}

extension HomeService: HomeServiceProtocol {
func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO<MyReadyStatusModel>? {
return try await request(with: .fetchMyReadyStatus(promiseID: promiseID))
}

func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return try await request(
with: .updatePreparationStatus(promiseID: promiseID)
)
}

func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return try await request(
with: .updateDepartureStatus(promiseID: promiseID)
)
}

func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return try await request(
with: .updateArrivalStatus(promiseID: promiseID)
)
}

func fetchLoginUser() async throws -> ResponseBodyDTO<LoginUserModel>? {
return try await request(with: .fetchLoginUser)
}

func fetchNearestPromise() async throws -> ResponseBodyDTO<NearestPromiseModel>? {
return try await request(with: .fetchNearestPromise)
}

func fetchUpcomingPromise() async throws -> ResponseBodyDTO<UpcomingPromiseListModel>? {
return try await request(with: .fetchUpcomingPromise)
}
}

final class MockHomeService: HomeServiceProtocol {
func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO<MyReadyStatusModel>? {
return nil
}

func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return nil
}

func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return nil
}

func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return nil
}

func fetchLoginUser() async throws -> ResponseBodyDTO<LoginUserModel>? {
let mockData = ResponseBodyDTO<LoginUserModel>(
success: true,
data: LoginUserModel(
userID: 1,
name: "꾸물리안",
level: 4,
promiseCount: 8,
tardyCount: 2,
tardySum: 72,
profileImageURL: ""
),
error: nil
)
return mockData
}

func fetchNearestPromise() async throws -> ResponseBodyDTO<NearestPromiseModel>? {
let mockData = ResponseBodyDTO<NearestPromiseModel>(
success: true,
data: NearestPromiseModel(
promiseID: 1,
dDay: 0,
name: "꾸물이들 대환장 파티",
meetingName: "꾸물이들",
dressUpLevel: "냐미",
time: "PM 8:00",
placeName: "DMC역"
),
error: nil
)
return mockData
}

func fetchUpcomingPromise() async throws -> ResponseBodyDTO<UpcomingPromiseListModel>? {
let mockData = ResponseBodyDTO<UpcomingPromiseListModel>(
success: true,
data: UpcomingPromiseListModel(
promises: [
UpcomingPromise(
promiseID: 1,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
),
UpcomingPromise(
promiseID: 2,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
),
UpcomingPromise(
promiseID: 3,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
),
UpcomingPromise(
promiseID: 4,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
)
]
),
error: nil
)
return mockData
}
}
22 changes: 22 additions & 0 deletions KkuMulKum/Source/Home/ServiceProtocol/HomeServiceProtocol.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// HomeServiceProtocol.swift
// KkuMulKum
//
// Created by 예삐 on 8/23/24.
//

import Foundation

import Moya

protocol HomeServiceProtocol {
func fetchLoginUser() async throws -> ResponseBodyDTO<LoginUserModel>?

func fetchNearestPromise() async throws -> ResponseBodyDTO<NearestPromiseModel>?
func fetchUpcomingPromise() async throws -> ResponseBodyDTO<UpcomingPromiseListModel>?
func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO<MyReadyStatusModel>?

func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
}
Loading

0 comments on commit 659f7b3

Please sign in to comment.