Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,93 +1,9 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"filename" : "AppIcon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ public struct DataSourceDependencyAssembler: DependencyAssemblerProtocol {
DIContainer.shared.register(type: EmotionRepositoryProtocol.self) { _ in
return EmotionRepository()
}

DIContainer.shared.register(type: RoutineRepositoryProtocol.self) { _ in
return RoutineRepository()
}
}
}
14 changes: 10 additions & 4 deletions Projects/DataSource/Sources/DTO/EmotionResponseDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import Domain
import Foundation

struct EmotionResponseDTO: Decodable {
let type: String
let name: String
let imageUrl: String
let type: String?
let name: String?
let imageUrl: String?

enum CodingKeys: String, CodingKey {
case type = "emotionMarbleType"
Expand All @@ -21,7 +21,13 @@ struct EmotionResponseDTO: Decodable {
}

extension EmotionResponseDTO {
func toEmotionEntity() -> EmotionEntity {
func toEmotionEntity() -> EmotionEntity? {
guard
let type,
let name,
let imageUrl
else { return nil }

return EmotionEntity(
emotionType: type,
emotionName: name,
Expand Down
20 changes: 4 additions & 16 deletions Projects/DataSource/Sources/DTO/RecommendedRoutineDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct RecommendedRoutineDTO: Decodable {
let routineName: String
let routineDescription: String
let routineLevel: String?
let subRoutines: [SubRoutineDTO]
let subRoutines: [RecommendedSubRoutineDTO]

enum CodingKeys: String, CodingKey {
case id = "recommendedRoutineId"
Expand All @@ -21,7 +21,9 @@ struct RecommendedRoutineDTO: Decodable {
case routineLevel = "recommendedRoutineLevel"
case subRoutines = "recommendedSubRoutineSearchResult"
}
}

extension RecommendedRoutineDTO {
func toRecommendedRoutineEntity(category: String? = nil) -> RecommendedRoutineEntity {
var routineCategory: RoutineCategoryType?
if let category {
Expand All @@ -38,20 +40,6 @@ struct RecommendedRoutineDTO: Decodable {
description: routineDescription,
category: routineCategory,
level: level,
subRoutines: subRoutines.compactMap({ $0.toSubRoutineEntity() }))
}
}

struct SubRoutineDTO: Decodable {
let id: Int
let routineName: String

enum CodingKeys: String, CodingKey {
case id = "recommendedSubRoutineId"
case routineName = "recommendedSubRoutineName"
}

func toSubRoutineEntity() -> SubRoutineEntity {
return SubRoutineEntity(id: id, title: routineName)
subRoutines: subRoutines.compactMap({ $0.toRecommendedSubRoutineEntity() }))
}
}
24 changes: 24 additions & 0 deletions Projects/DataSource/Sources/DTO/RecommendedSubRoutineDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// RecommendedSubRoutineDTO.swift
// DataSource
//
// Created by 최정인 on 7/30/25.
//

import Domain

struct RecommendedSubRoutineDTO: Decodable {
let id: Int
let routineName: String

enum CodingKeys: String, CodingKey {
case id = "recommendedSubRoutineId"
case routineName = "recommendedSubRoutineName"
}
}

extension RecommendedSubRoutineDTO {
func toRecommendedSubRoutineEntity() -> RecommendedSubRoutineEntity {
return RecommendedSubRoutineEntity(id: id, title: routineName)
}
}
41 changes: 41 additions & 0 deletions Projects/DataSource/Sources/DTO/RoutineResponseDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// RoutineResponseDTO.swift
// DataSource
//
// Created by 최정인 on 7/30/25.
//

import Domain

struct RoutineDictionaryDTO: Decodable {
let routines: [String: [RoutineResponseDTO]]
}

struct RoutineResponseDTO: Decodable {
let routineId: String
let historySeq: Int
let routineName: String
let repeatDay: [String]?
let executionTime: String
let subRoutineSearchResultDto: [SubRoutineResponseDTO]
let modifiedYn: Bool
let routineCompletionId: Int?
let completeYn: Bool
let routineType: String
}

extension RoutineResponseDTO {
func toRoutineEntity() -> RoutineEntity {
return RoutineEntity(
routineId: routineId,
historySeq: historySeq,
routineName: routineName,
repeatDay: repeatDay,
executionTime: executionTime,
subRoutineSearchResultDto: subRoutineSearchResultDto.map({ $0.toSubRoutineEntity() }),
modifiedYn: modifiedYn,
routineCompletionId: routineCompletionId,
completeYn: completeYn,
routineType: routineType)
}
}
33 changes: 33 additions & 0 deletions Projects/DataSource/Sources/DTO/SubRoutineResponseDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// SubRoutineResponseDTO.swift
// DataSource
//
// Created by 최정인 on 7/30/25.
//

import Domain

struct SubRoutineResponseDTO: Decodable {
let subRoutineId: String
let historySeq: Int
let subRoutineName: String
let modifiedYn: Bool
let sortOrder: Int
let routineCompletionId: Int?
let completeYn: Bool
let routineType: String
}

extension SubRoutineResponseDTO {
func toSubRoutineEntity() -> SubRoutineEntity {
return SubRoutineEntity(
subRoutineId: subRoutineId,
historySeq: historySeq,
subRoutineName: subRoutineName,
modifiedYn: modifiedYn,
sortOrder: sortOrder,
routineCompletionId: routineCompletionId,
completeYn: completeYn,
routineType: routineType)
}
}
10 changes: 10 additions & 0 deletions Projects/DataSource/Sources/DTO/UserDataResponseDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// UserDataResponseDTO.swift
// DataSource
//
// Created by 최정인 on 7/30/25.
//

struct UserDataResponseDTO: Decodable {
let nickname: String
}
13 changes: 12 additions & 1 deletion Projects/DataSource/Sources/Endpoint/EmotionEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

enum EmotionEndpoint {
case fetchEmotions
case fetchEmotion(date: String)
case registerEmotion(emotion: String)
}

Expand All @@ -16,12 +17,20 @@ extension EmotionEndpoint: Endpoint {
}

var path: String {
return baseURL
switch self {
case .fetchEmotions:
return baseURL
case .fetchEmotion(let date):
return baseURL + "/\(date)"
case .registerEmotion(let emotion):
return baseURL
}
}

var method: HTTPMethod {
switch self {
case .fetchEmotions: .get
case .fetchEmotion: .get
case .registerEmotion: .post
}
}
Expand All @@ -42,6 +51,8 @@ extension EmotionEndpoint: Endpoint {
switch self {
case .fetchEmotions:
return [:]
case .fetchEmotion:
return [:]
case .registerEmotion(let emotion):
return ["emotionMarbleType": emotion]
}
Expand Down
53 changes: 53 additions & 0 deletions Projects/DataSource/Sources/Endpoint/RoutineEndpoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// RoutineEndpoint.swift
// DataSource
//
// Created by 최정인 on 7/30/25.
//

enum RoutineEndpoint {
case fetchRoutines(startDate: String, endDate: String)
}

extension RoutineEndpoint: Endpoint {
var baseURL: String {
return AppProperties.baseURL + "/api/v1/routines"
}

var path: String {
switch self {
case .fetchRoutines: baseURL
}
}

var method: HTTPMethod {
switch self {
case .fetchRoutines: .get
}
}

var headers: [String : String] {
let headers: [String: String] = [
"Content-Type": "application/json",
"accept": "*/*"
]
return headers
}

var queryParameters: [String : String] {
switch self {
case .fetchRoutines(let startDate, let endDate):
return [
"startDate": startDate,
"endDate": endDate]
}
}

var bodyParameters: [String : Any] {
return [:]
}

var isAuthorized: Bool {
return true
}
}
Loading
Loading