Skip to content

Commit

Permalink
Merge pull request #329 from OMZigak/feat/#322-meeting-info-delete
Browse files Browse the repository at this point in the history
[feat] 모임 상세 화면 삭제(나가기) 기능 및 바뀐 API 명세 반영하기
  • Loading branch information
JinUng41 authored Aug 24, 2024
2 parents e0dcf87 + a1dc305 commit a2a9717
Show file tree
Hide file tree
Showing 9 changed files with 559 additions and 251 deletions.
16 changes: 16 additions & 0 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@
DEAD45942C6F70FC00395A96 /* ReactorKit in Frameworks */ = {isa = PBXBuildFile; productRef = DEAD45932C6F70FC00395A96 /* ReactorKit */; };
DEBA032F2C3C24F2002ED8F2 /* ModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBA032E2C3C24F2002ED8F2 /* ModelType.swift */; };
DEBA03312C3C2972002ED8F2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBA03302C3C2972002ED8F2 /* ViewController.swift */; };
DEBB8DEF2C77201200C5A528 /* MeetingInfoPromiseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBB8DEE2C77201200C5A528 /* MeetingInfoPromiseModel.swift */; };
DEC8B2892C785FE900D4981F /* MeetingInfoMoreViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC8B2882C785FE900D4981F /* MeetingInfoMoreViewController.swift */; };
DECB84562C43FB990022A003 /* AddPromiseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECB84552C43FB990022A003 /* AddPromiseViewModel.swift */; };
DECB84582C43FBEB0022A003 /* AddPromiseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECB84572C43FBEB0022A003 /* AddPromiseViewController.swift */; };
DECB845A2C43FC140022A003 /* AddPromiseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECB84592C43FC140022A003 /* AddPromiseView.swift */; };
Expand Down Expand Up @@ -428,6 +430,8 @@
DEA932172C3F180800FDF637 /* MeetingPromisesModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingPromisesModel.swift; sourceTree = "<group>"; };
DEBA032E2C3C24F2002ED8F2 /* ModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelType.swift; sourceTree = "<group>"; };
DEBA03302C3C2972002ED8F2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
DEBB8DEE2C77201200C5A528 /* MeetingInfoPromiseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingInfoPromiseModel.swift; sourceTree = "<group>"; };
DEC8B2882C785FE900D4981F /* MeetingInfoMoreViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingInfoMoreViewController.swift; sourceTree = "<group>"; };
DECB84552C43FB990022A003 /* AddPromiseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPromiseViewModel.swift; sourceTree = "<group>"; };
DECB84572C43FBEB0022A003 /* AddPromiseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPromiseViewController.swift; sourceTree = "<group>"; };
DECB84592C43FC140022A003 /* AddPromiseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPromiseView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1384,6 +1388,7 @@
children = (
DE6D4D092C3F14D80005584B /* InvitationCodePopUpViewController.swift */,
DE6D4D0A2C3F14D80005584B /* MeetingInfoViewController.swift */,
DEC8B2882C785FE900D4981F /* MeetingInfoMoreViewController.swift */,
);
path = ViewController;
sourceTree = "<group>";
Expand All @@ -1404,6 +1409,7 @@
DE6D4D082C3F14D80005584B /* View */,
DE6D4D0B2C3F14D80005584B /* ViewController */,
DE6D4D0D2C3F14D80005584B /* ViewModel */,
DEBB8DED2C771FFD00C5A528 /* Model */,
);
path = MeetingInfo;
sourceTree = "<group>";
Expand Down Expand Up @@ -1553,6 +1559,14 @@
path = Protocol;
sourceTree = "<group>";
};
DEBB8DED2C771FFD00C5A528 /* Model */ = {
isa = PBXGroup;
children = (
DEBB8DEE2C77201200C5A528 /* MeetingInfoPromiseModel.swift */,
);
path = Model;
sourceTree = "<group>";
};
DECB844E2C43FB200022A003 /* AddPromise */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1928,6 +1942,7 @@
DE558C5B2C4595A7008DAC4A /* SelectMemberView.swift in Sources */,
DD3072202C3C0D4500416D9F /* MyReadyStatusResponseModel.swift in Sources */,
DD931B6E2C3DA27F00526452 /* ParticipantCollectionViewCell.swift in Sources */,
DEC8B2892C785FE900D4981F /* MeetingInfoMoreViewController.swift in Sources */,
A39F2B192C47BF83008DA5F5 /* SetReadyCompletedView.swift in Sources */,
DD3976882C41C2AD00E2A4C4 /* UpcomingEmptyView.swift in Sources */,
DECB84642C44655A0022A003 /* PlaceListCell.swift in Sources */,
Expand Down Expand Up @@ -1955,6 +1970,7 @@
DECB845C2C4442490022A003 /* FindPlaceViewController.swift in Sources */,
DE3309A72C7099A9003F6E76 /* CustomActionSheetController.swift in Sources */,
DD8626652C4606A300E4F980 /* OurReadyStatusCollectionViewCell.swift in Sources */,
DEBB8DEF2C77201200C5A528 /* MeetingInfoPromiseModel.swift in Sources */,
DDAF1C842C3D5D19008A37D3 /* ViewModelType.swift in Sources */,
DDFA50802C4693BD000A62E2 /* ProfileSetupView.swift in Sources */,
78BD612B2C4550A6005752FD /* Bundle.swift in Sources */,
Expand Down
240 changes: 240 additions & 0 deletions KkuMulKum/Network/Service/MeetingService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import Foundation

import Moya
import RxSwift
import RxMoya

final class MeetingService {
let provider: MoyaProvider<MeetingTargetType>
Expand Down Expand Up @@ -40,6 +42,30 @@ final class MeetingService {
}
}

extension MeetingService: MeetingInfoServiceProtocol {
func fetchMeetingInfo(with meetingID: Int) async throws -> ResponseBodyDTO<MeetingInfoModel>? {
return try await request(with: .fetchMeetingInfo(meetingID: meetingID))
}

func fetchMeetingMemberList(with meetingID: Int) async throws -> ResponseBodyDTO<MeetingMembersModel>? {
return try await request(with: .fetchMeetingMember(meetingID: meetingID))
}

func fetchMeetingPromiseList(with meetingID: Int) async throws -> ResponseBodyDTO<MeetingPromisesModel>? {
return try await request(with: .fetchMeetingPromiseList(meetingID: meetingID))
}

func exitMeeting(with meetingID: Int) -> Single<ResponseBodyDTO<EmptyModel>> {
return provider.rx.request(.exitMeeting(meetingID: meetingID))
.filterSuccessfulStatusCodes()
.map(ResponseBodyDTO<EmptyModel>.self)
.catch { error in
print("에러 발생: \(error.localizedDescription)")
throw error
}
}
}

extension MeetingService: CreateMeetingServiceProtocol {
func createMeeting(
request: MakeMeetingsRequestModel
Expand All @@ -56,6 +82,220 @@ extension MeetingService: InviteCodeServiceProtocol {
}
}

final class MockMeetingInfoService: MeetingInfoServiceProtocol {
func fetchMeetingInfo(with meetingID: Int) -> ResponseBodyDTO<MeetingInfoModel>? {
let mockData = MeetingInfoModel(
meetingID: 1,
name: "웅웅난진웅",
createdAt: "2024.06.08",
metCount: 3,
invitationCode: "WD56CQ"
)

return ResponseBodyDTO(success: true, data: mockData, error: nil)
}

func fetchMeetingMemberList(with meetingID: Int) -> ResponseBodyDTO<MeetingMembersModel>? {
let mockData = MeetingMembersModel(
memberCount: 14,
members: [
Member(
memberID: 1,
name: "김진웅",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 2,
name: "김수연",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 3,
name: "이지훈",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 4,
name: "이유진",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 5,
name: "이승현",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 6,
name: "허준혁",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 7,
name: "배차은우",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 8,
name: "김윤서",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 9,
name: "정혜진",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 10,
name: "주효은",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 11,
name: "박상준",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 12,
name: "김채원",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 13,
name: "류희재",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
),
Member(
memberID: 14,
name: "김민지",
profileImageURL: "https://reqres.in/img/faces/\(Int.random(in: 1...10))-image.jpg"
)
]
)

return ResponseBodyDTO(success: true, data: mockData, error: nil)
}

func fetchMeetingPromiseList(with meetingID: Int) -> ResponseBodyDTO<MeetingPromisesModel>? {
let mockData = MeetingPromisesModel(
promises: [
MeetingPromise(
promiseID: 1,
name: "꾸물 리프레시 데이",
dDay: 0,
time: "PM 2:00",
placeName: "DMC역"
),
MeetingPromise(
promiseID: 2,
name: "꾸물 잼얘 나이트",
dDay: 10,
time: "PM 6:00",
placeName: "홍대입구"
),
MeetingPromise(
promiseID: 3,
name: "친구 생일 파티",
dDay: 5,
time: "PM 7:00",
placeName: "강남역"
),
MeetingPromise(
promiseID: 4,
name: "주말 산책",
dDay: 3,
time: "AM 10:00",
placeName: "서울숲"
),
MeetingPromise(
promiseID: 5,
name: "프로젝트 미팅",
dDay: 1,
time: "AM 9:00",
placeName: "삼성역"
),
MeetingPromise(
promiseID: 6,
name: "독서 모임",
dDay: 7,
time: "PM 3:00",
placeName: "합정역"
),
MeetingPromise(
promiseID: 7,
name: "헬스클럽 모임",
dDay: 2,
time: "AM 8:00",
placeName: "신촌역"
),
MeetingPromise(
promiseID: 8,
name: "영화 관람",
dDay: 4,
time: "PM 8:00",
placeName: "잠실역"
),
MeetingPromise(
promiseID: 9,
name: "저녁 식사",
dDay: 6,
time: "PM 7:30",
placeName: "이태원역"
),
MeetingPromise(
promiseID: 10,
name: "아침 조깅",
dDay: 14,
time: "AM 6:00",
placeName: "한강공원"
),
MeetingPromise(
promiseID: 11,
name: "커피 브레이크",
dDay: 8,
time: "PM 4:00",
placeName: "을지로입구"
),
MeetingPromise(
promiseID: 12,
name: "스터디 그룹",
dDay: 12,
time: "PM 5:00",
placeName: "강남역"
),
MeetingPromise(
promiseID: 13,
name: "뮤직 페스티벌",
dDay: 9,
time: "PM 2:00",
placeName: "난지공원"
),
MeetingPromise(
promiseID: 14,
name: "낚시 여행",
dDay: 11,
time: "AM 5:00",
placeName: "속초항"
),
MeetingPromise(
promiseID: 15,
name: "가족 모임",
dDay: 13,
time: "PM 1:00",
placeName: "광화문역"
)
]
)

return ResponseBodyDTO(success: true, data: mockData, error: nil)
}

func exitMeeting(with meetingID: Int) -> Single<ResponseBodyDTO<EmptyModel>> {
let falseResponse = ResponseBodyDTO<EmptyModel>(success: false, data: nil, error: nil)
return .just(falseResponse)
}
}


final class MockInviteCodeService: InviteCodeServiceProtocol {
func joinMeeting(with request: RegisterMeetingsModel) -> ResponseBodyDTO<RegisterMeetingsResponseModel>? {
let mockData = RegisterMeetingsResponseModel(
Expand Down
7 changes: 6 additions & 1 deletion KkuMulKum/Network/TargetType/MeetingTargetType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum MeetingTargetType {
case fetchMeetingInfo(meetingID: Int)
case fetchMeetingMember(meetingID: Int)
case fetchMeetingPromiseList(meetingID: Int)
case exitMeeting(meetingID: Int)
}

extension MeetingTargetType: TargetType {
Expand All @@ -42,6 +43,8 @@ extension MeetingTargetType: TargetType {
return "/api/v1/meetings/\(meetingID)/members"
case .fetchMeetingPromiseList(let meetingID):
return "/api/v1/meetings/\(meetingID)/promises"
case .exitMeeting(let meetingID):
return "/api/v1/meetings/\(meetingID)"
}
}

Expand All @@ -51,6 +54,8 @@ extension MeetingTargetType: TargetType {
return .post
case .fetchMeetingList, .fetchMeetingInfo, .fetchMeetingMember, .fetchMeetingPromiseList:
return .get
case .exitMeeting:
return .delete
}
}

Expand All @@ -60,7 +65,7 @@ extension MeetingTargetType: TargetType {
return .requestJSONEncodable(request)
case .joinMeeting(let request):
return .requestJSONEncodable(request)
case .fetchMeetingList, .fetchMeetingInfo, .fetchMeetingMember:
case .fetchMeetingList, .fetchMeetingInfo, .fetchMeetingMember, .exitMeeting:
return .requestPlain
case .fetchMeetingPromiseList:
return .requestParameters(
Expand Down
Loading

0 comments on commit a2a9717

Please sign in to comment.