Skip to content
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

๐Ÿ”€ :: (#561) ์™๋ฎค ์ถ”์ฒœ ํ”Œ๋ ˆ์ด๋ฆฌ์ŠคํŠธ ํ™”๋ฉด์„ ๋งŒ๋“ค์–ด์š”. #574

Merged
merged 41 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b554fba
:zap: :: ์™๋ฎค ์ถ”์ฒœ ํ”Œ๋ฆฌ ๋ทฐ์ปจ
yongbeomkwak Jun 3, 2024
4519333
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
850e4e0
:zap: :: ์™๋ฎค ์ถ”์ฒœ ๋ฆฌ์•กํ„ฐ ์ƒ์„ฑ
yongbeomkwak Jun 3, 2024
23da871
:art: ๋ชจํ‚น์„ ์œ„ํ•œ Testing ์—ฐ๊ฒฐ
yongbeomkwak Jun 3, 2024
99748ae
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
58c16dc
:art: :: ๋ชจํ‚น ๋ฐ์ดํ„ฐ ๋ชจ๋“ˆ ์—ฐ๊ฒฐ
yongbeomkwak Jun 3, 2024
75fd96e
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
8284e60
:art: :: ์ด์ „ PR ๋ฆฌ๋ทฐ ๋ฐ˜์˜
yongbeomkwak Jun 3, 2024
aea8d72
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
387dcb6
:art: :: ์—๋Ÿฌ ๋ชจ๋“ˆ์„ ๋ฒ ์ด์Šค ๋„๋ฉ”์ธ ์ธํ„ฐํŽ˜์ด์Šค์— ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.
yongbeomkwak Jun 4, 2024
19dff83
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 4, 2024
84569cb
:art: :: ์ปฌ๋ ‰์…˜ ๋ทฐ ์ปดํฌ์ง€์…”๋„ ๋ ˆ์ด์•„์›ƒ ๋ฐฐ์น˜
yongbeomkwak Jun 4, 2024
409a0a2
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 4, 2024
329a39f
:zap: :: api ๋ฆฌํ„ดํƒ€์ž… ๋ณ€๊ฒฝ
yongbeomkwak Jun 5, 2024
6d4c278
:zap: :: ์™๋ฎค ์ถ”์ฒœ ํ”Œ๋ฆฌ ๋ทฐ์ปจ
yongbeomkwak Jun 3, 2024
2bfd872
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
e51b2db
:zap: :: ์™๋ฎค ์ถ”์ฒœ ๋ฆฌ์•กํ„ฐ ์ƒ์„ฑ
yongbeomkwak Jun 3, 2024
55aeaa0
:art: ๋ชจํ‚น์„ ์œ„ํ•œ Testing ์—ฐ๊ฒฐ
yongbeomkwak Jun 3, 2024
be0a5c0
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
6ffea11
:art: :: ๋ชจํ‚น ๋ฐ์ดํ„ฐ ๋ชจ๋“ˆ ์—ฐ๊ฒฐ
yongbeomkwak Jun 3, 2024
94713b6
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
b2ef455
:art: :: ์ด์ „ PR ๋ฆฌ๋ทฐ ๋ฐ˜์˜
yongbeomkwak Jun 3, 2024
70b92d5
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 3, 2024
6b53a37
:art: :: ์—๋Ÿฌ ๋ชจ๋“ˆ์„ ๋ฒ ์ด์Šค ๋„๋ฉ”์ธ ์ธํ„ฐํŽ˜์ด์Šค์— ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.
yongbeomkwak Jun 4, 2024
fda4fd0
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 4, 2024
80eebb7
:art: :: ์ปฌ๋ ‰์…˜ ๋ทฐ ์ปดํฌ์ง€์…”๋„ ๋ ˆ์ด์•„์›ƒ ๋ฐฐ์น˜
yongbeomkwak Jun 4, 2024
ec4543a
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 4, 2024
08848cf
:zap: :: api ๋ฆฌํ„ดํƒ€์ž… ๋ณ€๊ฒฝ
yongbeomkwak Jun 5, 2024
7d480e8
:sparkles: :: ํ”Œ๋ ˆ์ด๋ฆฌ์ŠคํŠธ ๋””ํ…Œ์ผ ์—ฐ๊ฒฐ
yongbeomkwak Jun 5, 2024
e7d59ce
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 5, 2024
4dc978b
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 5, 2024
6f69e43
Merge branch '561-develop-wakmuRecommendList' of https://github.com/wโ€ฆ
yongbeomkwak Jun 5, 2024
f531287
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 5, 2024
54a7239
๐Ÿšš :: Spy -> Stub ๋„ค์ด๋ฐ ๋ณ€๊ฒฝ
yongbeomkwak Jun 5, 2024
c53c5f5
:zap :: ๋กœ๋”ฉ ์œ„์น˜ ๋ณ€๊ฒฝ
yongbeomkwak Jun 5, 2024
220d800
:zap: :: ์ค„๋ฐ”๊ฟˆ
yongbeomkwak Jun 5, 2024
03794e1
:zap: :: ๊ฐ€๋…์„ฑ ๊ฐœ์„ 
yongbeomkwak Jun 5, 2024
ad40ee0
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 5, 2024
2253c0a
:zap: :: ์ด๋ฏธ์ง€ radius ๊นจ์ง์— ์˜ํ•œ ์ธ์…‹ ๋ณ€๊ฒฝ
yongbeomkwak Jun 5, 2024
07d5351
๐ŸŽจ :: ์ฝ”๋“œ Formatting ์ ์šฉ
yongbeomkwak Jun 5, 2024
8ea0ee6
Merge branch 'develop' into 561-develop-wakmuRecommendList
yongbeomkwak Jun 10, 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
4 changes: 2 additions & 2 deletions Projects/Domains/BaseDomain/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ let project = Project.module(
.interface(
module: .domain(.BaseDomain),
dependencies: [
.Project.Module.ThirdPartyLib
.Project.Module.ThirdPartyLib,
.Project.Module.ErrorModule,
]
),
.implements(
module: .domain(.BaseDomain),
dependencies: [
.Project.Module.Utility,
.Project.Module.ErrorModule,
.Project.Module.KeychainModule,
.domain(target: .BaseDomain, type: .interface)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public protocol RemotePlayListDataSource {
func fetchPlaylistSongs(id: String) -> Single<[SongEntity]>
func updatePlaylist(key: String, songs: [String]) -> Completable
func addSongIntoPlayList(key: String, songs: [String]) -> Single<AddSongEntity>
func removeSongs(key: String, songs: [String]) -> Single<BaseEntity>
func removeSongs(key: String, songs: [String]) -> Completable
func uploadImage(key: String, model: UploadImageType) -> Single<BaseImageEntity>
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
//
// AddSongEntity.swift
// DomainModule
//
// Created by yongbeomkwak on 2023/03/14.
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import Foundation

public struct AddSongEntity: Equatable {
public init(
added_songs_length: Int,
addedSongCount: Int,
duplicated: Bool
) {
self.added_songs_length = added_songs_length
self.addedSongCount = addedSongCount
self.duplicated = duplicated
}

public let added_songs_length: Int
public let addedSongCount: Int
public let duplicated: Bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct RecommendPlayListEntity: Equatable {
public struct RecommendPlayListEntity: Hashable, Equatable {
public init(
key: String,
title: String,
Expand All @@ -26,4 +26,13 @@ public struct RecommendPlayListEntity: Equatable {
public let key, title, image: String
public let `private`: Bool
public let count: Int
private let id = UUID()

public func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

public static func == (_ lhs: Self, _ rhs: Self) -> Bool {
lhs.id == rhs.id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public protocol PlayListRepository {
func fetchPlaylistSongs(id: String) -> Single<[SongEntity]>
func updatePlayList(key: String, songs: [String]) -> Completable
func addSongIntoPlayList(key: String, songs: [String]) -> Single<AddSongEntity>
func removeSongs(key: String, songs: [String]) -> Single<BaseEntity>
func removeSongs(key: String, songs: [String]) -> Completable
func uploadImage(key: String, model: UploadImageType) -> Single<BaseImageEntity>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Foundation
import RxSwift

public protocol RemoveSongsUseCase {
func execute(key: String, songs: [String]) -> Single<BaseEntity>
func execute(key: String, songs: [String]) -> Completable
}
5 changes: 4 additions & 1 deletion Projects/Domains/PlayListDomain/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ let project = Project.module(
.tests(
module: .domain(.PlayListDomain),
dependencies: [.domain(target: .PlayListDomain)]
)
),
.testing(module: .domain(.PlayListDomain), dependencies: [
.domain(target: .PlayListDomain, type: .interface)
])
]
)
13 changes: 4 additions & 9 deletions Projects/Domains/PlayListDomain/Sources/API/PlayListAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ extension PlayListAPI: WMAPI {
return "/create"

case let .fetchPlaylistSongs(key: key), let .addSongIntoPlayList(key: key, _), let .updatePlaylist(key: key, _),
let .removeSongs(
key: key,
_
):
let .removeSongs(key: key, _):
return "/\(key)/songs"

case let .uploadImage(key: key, _):
Expand Down Expand Up @@ -117,19 +114,17 @@ extension PlayListAPI: WMAPI {
switch model {
case let .default(imageName: data):
datas.append(MultipartFormData(
provider: .data("default".data(using: .utf8)!),
name: "type",
fileName: "ใ……"
provider: .data("default".data(using: .utf8)!), name: "type"
))

datas.append(MultipartFormData(provider: .data(data.data(using: .utf8)!), name: "imageName"))

case let .custom(imageName: data):
datas.append(MultipartFormData(provider: .data("custom".data(using: .utf8)!), name: "type"))
datas.append(MultipartFormData(
provider: .data(data),
name: "imageFile",
fileName: "image.jpeg",
mimeType: "image/jpeg, image/jpg, image/png"
fileName: "image.jpeg"
))
}
return .uploadMultipart(datas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ public final class RemotePlayListDataSourceImpl: BaseRemoteDataSource<PlayListAP
.map { $0.toDomain() }
}

public func removeSongs(key: String, songs: [String]) -> Single<BaseEntity> {
public func removeSongs(key: String, songs: [String]) -> Completable {
request(.removeSongs(key: key, songs: songs))
.map(BaseResponseDTO.self)
.map { $0.toDomain() }
.asCompletable()
}

public func uploadImage(key: String, model: UploadImageType) -> Single<BaseImageEntity> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class PlayListRepositoryImpl: PlayListRepository {
remotePlayListDataSource.addSongIntoPlayList(key: key, songs: songs)
}

public func removeSongs(key: String, songs: [String]) -> RxSwift.Single<BaseEntity> {
public func removeSongs(key: String, songs: [String]) -> Completable {
remotePlayListDataSource.removeSongs(key: key, songs: songs)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct AddSongResponseDTO: Decodable {
public extension AddSongResponseDTO {
func toDomain() -> AddSongEntity {
AddSongEntity(
added_songs_length: addedSongCount,
addedSongCount: addedSongCount,
duplicated: isDuplicatedSongsExist
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct RemoveSongsUseCaseImpl: RemoveSongsUseCase {
self.playListRepository = playListRepository
}

public func execute(key: String, songs: [String]) -> Single<BaseEntity> {
public func execute(key: String, songs: [String]) -> Completable {
return playListRepository.removeSongs(key: key, songs: songs)
}
}
145 changes: 145 additions & 0 deletions Projects/Domains/PlayListDomain/Testing/Testing.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import PlayListDomainInterface
import RxSwift

final class FetchPlayListUseCaseSpy: FetchRecommendPlayListUseCase {
var fetchData = [
yongbeomkwak marked this conversation as resolved.
Show resolved Hide resolved
RecommendPlayListEntity(
key: "best",
title: "๋ฒ ์ŠคํŠธ",
image: "https://cdn.wakmusic.xyz/playlist/best_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "carol",
title: "์บ๋กค",
image: "https://cdn.wakmusic.xyz/playlist/carol_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "competition",
title: "๊ฒฝ์Ÿ",
image: "https://cdn.wakmusic.xyz/playlist/competition_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "best",
title: "๋ฒ ์ŠคํŠธ",
image: "https://cdn.wakmusic.xyz/playlist/best_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "carol",
title: "์บ๋กค",
image: "https://cdn.wakmusic.xyz/playlist/carol_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "competition",
title: "๊ฒฝ์Ÿ",
image: "https://cdn.wakmusic.xyz/playlist/competition_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "best",
title: "๋ฒ ์ŠคํŠธ",
image: "https://cdn.wakmusic.xyz/playlist/best_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "carol",
title: "์บ๋กค",
image: "https://cdn.wakmusic.xyz/playlist/carol_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "competition",
title: "๊ฒฝ์Ÿ",
image: "https://cdn.wakmusic.xyz/playlist/competition_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "best",
title: "๋ฒ ์ŠคํŠธ",
image: "https://cdn.wakmusic.xyz/playlist/best_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "carol",
title: "์บ๋กค",
image: "https://cdn.wakmusic.xyz/playlist/carol_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "competition",
title: "๊ฒฝ์Ÿ",
image: "https://cdn.wakmusic.xyz/playlist/competition_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "best",
title: "๋ฒ ์ŠคํŠธ",
image: "https://cdn.wakmusic.xyz/playlist/best_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "carol",
title: "์บ๋กค",
image: "https://cdn.wakmusic.xyz/playlist/carol_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "competition",
title: "๊ฒฝ์Ÿ",
image: "https://cdn.wakmusic.xyz/playlist/competition_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "best",
title: "๋ฒ ์ŠคํŠธ",
image: "https://cdn.wakmusic.xyz/playlist/best_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "carol",
title: "์บ๋กค",
image: "https://cdn.wakmusic.xyz/playlist/carol_1.png",
private: false,
count: 0
),
RecommendPlayListEntity(
key: "competition",
title: "๊ฒฝ์Ÿ",
image: "https://cdn.wakmusic.xyz/playlist/competition_1.png",
private: false,
count: 0
)
]

func execute() -> Single<[RecommendPlayListEntity]> {
return Single.create { [weak self] single in

guard let self else {
return Disposables.create()
}

single(.success(self.fetchData))
return Disposables.create()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public final class ContainSongsViewModel: ViewModelType {
if entity.duplicated {
return BaseEntity(
status: 200,
description: "\(entity.added_songs_length)๊ณก์ด ๋‚ด ๋ฆฌ์ŠคํŠธ์— ๋‹ด๊ฒผ์Šต๋‹ˆ๋‹ค. ์ค‘๋ณต ๊ณก์€ ์ œ์™ธ๋ฉ๋‹ˆ๋‹ค."
description: "\(entity.addedSongCount)๊ณก์ด ๋‚ด ๋ฆฌ์ŠคํŠธ์— ๋‹ด๊ฒผ์Šต๋‹ˆ๋‹ค. ์ค‘๋ณต ๊ณก์€ ์ œ์™ธ๋ฉ๋‹ˆ๋‹ค."
)
} else {
return BaseEntity(status: 200, description: "\(entity.added_songs_length)๊ณก์ด ๋‚ด ๋ฆฌ์ŠคํŠธ์— ๋‹ด๊ฒผ์Šต๋‹ˆ๋‹ค.")
return BaseEntity(status: 200, description: "\(entity.addedSongCount)๊ณก์ด ๋‚ด ๋ฆฌ์ŠคํŠธ์— ๋‹ด๊ฒผ์Šต๋‹ˆ๋‹ค.")
}
}
.bind(to: output.showToastMessage)
Expand Down
Loading
Loading