Skip to content

Commit

Permalink
Merge pull request #55 from dnd-side-project/feat/#47
Browse files Browse the repository at this point in the history
API를 연동하고 데모데이를 준비했어요
  • Loading branch information
seungyooooong authored Feb 20, 2025
2 parents d3a7114 + 40dfa6d commit fd91101
Show file tree
Hide file tree
Showing 61 changed files with 1,097 additions and 529 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 2 additions & 3 deletions dogether/Data/Model/RankingModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import Foundation

struct RankingModel: Codable {
struct RankingModel: Decodable {
let rank: Int
let name: String
let certificationRate: Int
let approvalRate: Int
let certificationRate: Double
}
3 changes: 2 additions & 1 deletion dogether/Data/Model/ReviewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

import Foundation

struct ReviewModel: ReviewInfo, Codable {
struct ReviewModel: Decodable {
let id: Int
let content: String
let mediaUrls: [String]
let todoContent: String
let doer: String
}
20 changes: 10 additions & 10 deletions dogether/Data/Network/Request/CreateGroupRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

import Foundation

struct CreateGroupRequest: GroupInfo, Encodable {
let groupName: String
let memberCount: Int
struct CreateGroupRequest: Encodable {
let name: String
let maximumMemberCount: Int
let startAt: String
let challengeDuration: Int
let dailyTodoLimit: Int
let durationOption: Int
let maximumTodoCount: Int

init(groupName: String, memberCount: Int, startAt: GroupStartAts, challengeDuration: GroupChallengeDurations, dailyTodoLimit: Int) {
self.groupName = groupName
self.memberCount = memberCount
init(name: String, maximumMemberCount: Int, startAt: GroupStartAts, durationOption: GroupChallengeDurations, maximumTodoCount: Int) {
self.name = name
self.maximumMemberCount = maximumMemberCount
self.startAt = startAt.rawValue
self.challengeDuration = challengeDuration.rawValue
self.dailyTodoLimit = dailyTodoLimit
self.durationOption = durationOption.rawValue
self.maximumTodoCount = maximumTodoCount
}
}
11 changes: 7 additions & 4 deletions dogether/Data/Network/Response/GetGroupInfoResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@

import Foundation

struct GetGroupInfoResponse: GroupInfo, Decodable {
let groupName: String
let memberCount: Int
let dailyTodoLimit: Int
struct GetGroupInfoResponse: Decodable {
let name: String
let duration: Int
let joinCode: String
let maximumTodoCount: Int
let endAt: String
let remainingDays: Int
}
12 changes: 12 additions & 0 deletions dogether/Data/Network/Response/GetGroupStatusResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// GetGroupStatusResponse.swift
// dogether
//
// Created by seungyooooong on 2/20/25.
//

import Foundation

struct GetGroupStatusResponse: Decodable {
let status : String
}
12 changes: 12 additions & 0 deletions dogether/Data/Network/Response/GetIsJoiningResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// GetIsJoiningResponse.swift
// dogether
//
// Created by seungyooooong on 2/19/25.
//

import Foundation

struct GetIsJoiningResponse: Decodable {
let isJoining: Bool
}
7 changes: 1 addition & 6 deletions dogether/Data/Network/Response/GetMySummaryResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@

import Foundation

/// 참여중인 그룹의 내 누적 활동 통계 조회
struct GetMySummaryResponse: TotalCount, Decodable {
/// 작성한 전체 투두 개수
struct GetMySummaryResponse: Decodable {
let totalTodoCount: Int
/// 인증한 전체 투두 개수
let totalCertificatedCount: Int
/// 인정받은 투두 개수
let totalApprovedCount: Int
/// 노인정 투두 개수
let totalRejectedCount: Int
}
12 changes: 12 additions & 0 deletions dogether/Data/Network/Response/GetMyTodosResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// GetMyTodosResponse.swift
// dogether
//
// Created by seungyooooong on 2/19/25.
//

import Foundation

struct GetMyTodosResponse: Decodable {
let todos: [TodoInfo]
}
15 changes: 0 additions & 15 deletions dogether/Data/Network/Response/GetReviewResponse.swift

This file was deleted.

5 changes: 1 addition & 4 deletions dogether/Data/Network/Response/GetTeamSummaryResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

import Foundation

struct GetTeamSummaryResponse: TotalCount, Decodable {
let totalTodoCount: Int
let totalCertificatedCount: Int
let totalApprovedCount: Int
struct GetTeamSummaryResponse: Decodable {
let ranking: [RankingModel]
}
17 changes: 17 additions & 0 deletions dogether/Data/Network/Response/JoinGroupResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// JoinGroupResponse.swift
// dogether
//
// Created by seungyooooong on 2/20/25.
//

import Foundation

struct JoinGroupResponse: Decodable {
let name: String
let maximumMemberCount: Int
let startAt: String
let endAt: String
let durationOption: Int
}

13 changes: 12 additions & 1 deletion dogether/Data/Network/Router/GroupsRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ enum GroupsRouter: NetworkEndpoint {
case getGroupInfo
case getMySummary
case getTeamSummary
case getIsJoining
case leaveGroup
case getGroupStatus

var path: String {
switch self {
Expand All @@ -26,15 +29,23 @@ enum GroupsRouter: NetworkEndpoint {
return Path.api + Path.groups + Path.summary + "/my"
case .getTeamSummary:
return Path.api + Path.groups + Path.summary + "/team"
case .getIsJoining:
return Path.api + Path.groups + "/isJoining"
case .leaveGroup:
return Path.api + Path.groups + "/leave"
case .getGroupStatus:
return Path.api + Path.groups + "/my" + "/status"
}
}

var method: NetworkMethod {
switch self {
case .getGroupInfo, .getMySummary, .getTeamSummary:
case .getGroupInfo, .getMySummary, .getTeamSummary, .getIsJoining, .getGroupStatus:
return .get
case .createGroup, .joinGroup:
return .post
case .leaveGroup:
return .delete
}
}

Expand Down
5 changes: 1 addition & 4 deletions dogether/Data/Network/Router/TodoCertificationsRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ import Foundation
enum TodoCertificationsRouter: NetworkEndpoint {
case reviewTodo(todoId: String, reviewTodoRequest: ReviewTodoRequest)
case getReviews
case getReview(todoId: String)

var path: String {
switch self {
case .reviewTodo(let todoId, _):
return Path.api + Path.todoCertifications + "/\(todoId)/review"
case .getReviews:
return Path.api + Path.todoCertifications + "/pending-review"
case .getReview(let todoId):
return Path.api + Path.todoCertifications + "/\(todoId)"
}
}

var method: NetworkMethod {
switch self {
case .getReviews, .getReview:
case .getReviews:
return .get
case .reviewTodo:
return .post
Expand Down
9 changes: 8 additions & 1 deletion dogether/Data/Network/Router/TodosRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
enum TodosRouter: NetworkEndpoint {
case createTodos(createTodosRequest: CreateTodosRequest)
case certifyTodo(todoId: String, certifyTodoRequest: CertifyTodoRequest)
case getMyTodos(date: String, status: TodoStatus?)
case getMyYesterdayTodos

var path: String {
Expand All @@ -18,14 +19,16 @@ enum TodosRouter: NetworkEndpoint {
return Path.api + Path.todos
case .certifyTodo(let todoId, _):
return Path.api + Path.todos + "/\(todoId)/certify"
case .getMyTodos:
return Path.api + Path.todos + "/my"
case .getMyYesterdayTodos:
return Path.api + Path.todos + "/my/yesterday"
}
}

var method: NetworkMethod {
switch self {
case .getMyYesterdayTodos:
case .getMyTodos, .getMyYesterdayTodos:
return .get
case .createTodos, .certifyTodo:
return .post
Expand All @@ -34,6 +37,10 @@ enum TodosRouter: NetworkEndpoint {

var parameters: [URLQueryItem]? {
switch self {
case .getMyTodos(let date, let status):
var parameters: [URLQueryItem] = [.init(name: "date", value: date)]
if let status { parameters.append(.init(name: "status", value: status.rawValue)) }
return parameters
default:
return nil
}
Expand Down
14 changes: 0 additions & 14 deletions dogether/Data/Protocol/GroupInfo.swift

This file was deleted.

15 changes: 0 additions & 15 deletions dogether/Data/Protocol/ReviewInfo.swift

This file was deleted.

14 changes: 0 additions & 14 deletions dogether/Data/Protocol/TotalCount.swift

This file was deleted.

15 changes: 14 additions & 1 deletion dogether/Domain/Entity/FilterTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

enum FilterTypes: String, CaseIterable {
case all = "전체"
case wait = "인증 대기"
case wait = "검사 대기"
case reject = "노인정"
case approve = "인정"

Expand Down Expand Up @@ -63,4 +63,17 @@ enum FilterTypes: String, CaseIterable {
return 66
}
}

var emptyDescription: String {
switch self {
case .wait:
return "검사 대기 중인 투두가 없어요"
case .reject:
return "노인정받은 투두가 없어요"
case .approve:
return "인정받은 투두가 없어요"
default:
return ""
}
}
}
26 changes: 26 additions & 0 deletions dogether/Domain/Entity/GroupInfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// GroupInfo.swift
// dogether
//
// Created by seungyooooong on 2/19/25.
//

import Foundation

struct GroupInfo {
let name: String
let duration: Int
let joinCode: String
let maximumTodoCount: Int
let endAt: String
let remainingDays: Int

init(name: String = "", duration: Int = 0, joinCode: String = "", maximumTodoCount: Int = 0, endAt: String = "", remainingDays: Int = 0) {
self.name = name
self.duration = duration
self.joinCode = joinCode
self.maximumTodoCount = maximumTodoCount
self.endAt = endAt
self.remainingDays = remainingDays
}
}
6 changes: 3 additions & 3 deletions dogether/Domain/Entity/GroupTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import UIKit

enum GroupTypes {
enum GroupTypes: Int {
case join
case create

Expand Down Expand Up @@ -42,9 +42,9 @@ enum GroupTypes {
var completeTitleText: String {
switch self {
case .join:
return "그룹 생성 완료 !\n이제 목표를 실천해보세요"
return "그룹 가입 완료 !\n이제 목표를 실천해보세요"
case .create:
return "그룹 가입 완료 !\n팀원들에게 코드를 공유해보세요"
return "그룹 생성 완료 !\n팀원들에게 코드를 공유해보세요"
}
}

Expand Down
Loading

0 comments on commit fd91101

Please sign in to comment.