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

Audio #88

Closed
wants to merge 166 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
324496a
feat: Page로직 구현을 위한 엔티티 추가
iceHood Nov 25, 2024
2d77243
chore: Page 린트 수정
iceHood Nov 26, 2024
0095076
feat: Book 엔티티 만들기
iceHood Nov 26, 2024
ec3fcc9
refactor: Entity 기존 컨벤션에 맞게 수정
iceHood Nov 26, 2024
0da53c1
refactor: MediaType이 String을 rawValue로 가짐
iceHood Nov 26, 2024
cad4f14
feat: 추후 CoreData를 위한 DTO추상화
iceHood Nov 26, 2024
4404356
feat: Book, Page 스토리지 CRUD 프로토콜 생성
iceHood Nov 26, 2024
1c0745d
feat: CoreData에 Book추가
iceHood Nov 26, 2024
08781ec
feat: BookRepository 생성
iceHood Nov 26, 2024
26d3b48
refactor: PageStroage 없어도 될듯
iceHood Nov 26, 2024
d680ab2
feat: 파일 저장 Storage-MHFileManager생성
iceHood Nov 26, 2024
464ffc4
feat: BookStroage생성
iceHood Nov 26, 2024
fbc49b2
feat: MHError유형 추가
iceHood Nov 26, 2024
4b1329c
refactor: Book을 id로 가져오게 설정
iceHood Nov 26, 2024
2ee6924
feat: Test임시 추가
iceHood Nov 26, 2024
ead3b39
feat: BookStorageTest 작성
iceHood Nov 26, 2024
1204d36
chore: 린트 경고 수정
iceHood Nov 26, 2024
cc21bd0
feat: UIAlertController 생성에 용이한 편의 생성자 구현
Kyxxn Nov 26, 2024
f995ed3
feat: 카테고리 생성 수정 삭제에 대한 로직 구현
Kyxxn Nov 26, 2024
f06003f
feat: 카테고리 컨트롤러에서 뷰모델과 바인딩하여 뷰 새로 갱신 로직 구현
Kyxxn Nov 26, 2024
41fa8dc
reafactor: 리뷰 반영
iceHood Nov 26, 2024
73e45c7
refactor: Test가 동작하도록 수정
iceHood Nov 26, 2024
6b5a11c
chore: UserHouse -> MemorialHouse 파일명 변경
Kyxxn Nov 26, 2024
5f082ab
fix: MemorialHouse 모델에서 카테고리 제거
Kyxxn Nov 26, 2024
611cb44
feat: 카테고리 CRUD 프로토콜 구현
Kyxxn Nov 26, 2024
5c7b869
refactor: 결국 갖은 오류끝에 Data로 변경
iceHood Nov 26, 2024
4f6bc8c
feat: FIleManager테스트 추가
iceHood Nov 26, 2024
d4a6e59
feat: MediaRepository 프로토콜 추가
iceHood Nov 26, 2024
7e2eb39
feat: 카테고리 CRUD 구현체 틀 작성
Kyxxn Nov 26, 2024
1dabe04
feat: 홈화면에서 카테고리 불러오는 로직 분리 및 에러처리
Kyxxn Nov 26, 2024
a4e76c9
fix: 데이터 로드 전에 뷰가 그려지는 문제 해결
Kyxxn Nov 26, 2024
d1cedb0
refactor: Fetch할 때 Result 리턴으로 변경
Kyxxn Nov 26, 2024
48d256f
feat: 편집모드 비 편집모드 구현
Kyxxn Nov 26, 2024
38ffefb
refactor: UIAlertController 편의 생성자 2개로 분리
Kyxxn Nov 26, 2024
51991f4
feat: DIContainer 의존성 주입 및 연결
Kyxxn Nov 26, 2024
291f971
Merge branch 'develop' into feature/creat-book-page-domain
iceHood Nov 27, 2024
0109995
feat: dto 매퍼 이름 수정
iceHood Nov 27, 2024
5f88920
chore: 파일 명 수정
Kyxxn Nov 27, 2024
cb0202e
Merge branch 'feature/edit-category-sheet' of https://github.com/boos…
Kyxxn Nov 27, 2024
10f59e4
refactor: FileStroage필요한 함수 및 설명 추가
iceHood Nov 27, 2024
768f42f
feat: FileManage 신규 함수 추가
iceHood Nov 27, 2024
56e89d3
feat: LocalMediaRepository 작성
iceHood Nov 27, 2024
d9f5a6a
feat: 에러 추가
iceHood Nov 27, 2024
0518b74
refactor: Repository에서 result로 반환하도록 설정
iceHood Nov 27, 2024
e251e11
refactor: 새로운 로직에 대응
iceHood Nov 27, 2024
64c4887
refactor: Decodable대신 CoreData사용
iceHood Nov 27, 2024
c7a74bd
chore: Lint경고 안나오도록 수정
iceHood Nov 27, 2024
3bd8735
feat: 책 보기 layout 생성
k2645 Nov 27, 2024
019e666
Merge branch 'develop' into feature/book-view-layout
k2645 Nov 27, 2024
031059d
feat: BookView와 PageView 각각의 ViewModel 생성
k2645 Nov 27, 2024
de9cb43
refactor: UIAlertController 하나로 통일
Kyxxn Nov 27, 2024
8b3c7c2
refactor: 변경된 UIAlertController에 따른 로직 수정
Kyxxn Nov 27, 2024
c670b42
refactor: Home에서 카테고리 관련 CRUD 아예 삭제
Kyxxn Nov 27, 2024
67e5b4f
Merge branch 'develop' into feature/creat-book-page-domain
iceHood Nov 27, 2024
7e6a62e
refactor: DTO에 public init 추가
iceHood Nov 27, 2024
a659e2c
feat: add audio controller
yuncheol-AHN Nov 27, 2024
d98fa6b
feat: filename change Date to UUID & audio file delete when cancel bu…
yuncheol-AHN Nov 27, 2024
44d80d2
feat: request mic permission
yuncheol-AHN Nov 27, 2024
551dd18
refactor: MHError -> MHCoreError / MHDataError
iceHood Nov 27, 2024
ab06643
chore: Lint경고 수정
iceHood Nov 27, 2024
4d11009
fix: layout error
yuncheol-AHN Nov 27, 2024
335e990
chore: 불필요한 코드 제거
Kyxxn Nov 27, 2024
02d6543
feat: MediaDescription에 attribute추가
iceHood Nov 27, 2024
731c81d
fix: CoreData동시성 문제 해결
iceHood Nov 27, 2024
b8abbc9
refactor: 에러 유형 추가/구체화
iceHood Nov 27, 2024
adba77b
Revert "feat: request mic permission"
yuncheol-AHN Nov 27, 2024
c23d906
refactor: Error유형 변경
iceHood Nov 27, 2024
88e0341
refactor: 쓸모없는 strong self삭제
iceHood Nov 27, 2024
5a4f073
feat: CoreDataBookCover도 스레드 세이프...
iceHood Nov 27, 2024
42332f7
chore: 잘못 올라간거 삭제
iceHood Nov 27, 2024
400d57a
refactor: PageViewController 네이밍 수정
k2645 Nov 27, 2024
c2fe234
Merge pull request #87 from boostcampwm-2024/feature/book-view-layout
k2645 Nov 27, 2024
6ec39e6
fix: 레이아웃이 제대로 보이지 않는 문제 임시 해결
Kyxxn Nov 27, 2024
3ee147b
Merge branch 'develop' into feature/creat-book-page-domain
iceHood Nov 27, 2024
dafc31a
chore: 불필요한 코드 제거
Kyxxn Nov 27, 2024
d466ea7
refactor: BookCoverDTO도 다른 것에 컨벤션 맞춤
iceHood Nov 27, 2024
dcdc9cb
Merge pull request #89 from boostcampwm-2024/feature/edit-category-sheet
Kyxxn Nov 27, 2024
07ea62f
chore: 린트 수정
iceHood Nov 27, 2024
1ab46a8
Merge branch 'develop' into feature/creat-book-page-domain
iceHood Nov 27, 2024
3f198e9
refactor: 코어오류 따르도록 수정
iceHood Nov 27, 2024
f33f745
Merge pull request #82 from boostcampwm-2024/feature/creat-book-page-…
iceHood Nov 27, 2024
05d3ee0
Merge branch 'develop' into feature/load-page-data
k2645 Nov 27, 2024
ed679d3
fix: HomeViewModel 사용하지 않는 useCase 제거
Kyxxn Nov 27, 2024
72c6f0d
fix: HomeViewModel 테스트 수정
Kyxxn Nov 27, 2024
79b829f
fix: Home UseCase 테스트 수정
Kyxxn Nov 27, 2024
998b432
Merge pull request #92 from boostcampwm-2024/feature/fix-home-test
Kyxxn Nov 28, 2024
4c0322a
feat: Book 관련 UseCase 구현
k2645 Nov 28, 2024
99dc370
feat: Storage 및 UseCase DIConatiner에 register
k2645 Nov 28, 2024
bd5b741
feat: BookViewModelFactory 생성
k2645 Nov 28, 2024
78ef857
feat: BookViewModel DIContainer 등록
k2645 Nov 28, 2024
f03a713
feat: Book 엔티티에 Title 추가 및 모델의 identifier 프로퍼티 id로 변경
k2645 Nov 28, 2024
60930fa
refactor: toABC() -> convertToABC()로 변경
Kyxxn Nov 28, 2024
196b2a7
docs: CoreDataStorage 설명하는 주석 추가
Kyxxn Nov 28, 2024
945cefc
feat: BookCategory 엔티티와 DTO 추가
Kyxxn Nov 28, 2024
ec1a4a3
chore: 주석 추가
Kyxxn Nov 28, 2024
4ae65ef
feat: ReadPage ViewModelFactory 구현 및 DIContainer 등록
k2645 Nov 28, 2024
d0b950e
feat: BookCategoryEntity 코어데이터 모델 추가
Kyxxn Nov 28, 2024
fb8d717
refactor: BookCategoryEntity 코어데이터 네이밍 수정
Kyxxn Nov 28, 2024
32a81e6
Merge branch 'develop' into feature/crud-coredata-category
Kyxxn Nov 28, 2024
7f809c8
feat: Error 코드 추가
Kyxxn Nov 28, 2024
38275e1
feat: BookCategory에 대한 Storage 작업 완료
Kyxxn Nov 28, 2024
53db6b7
refactor: Category에서 BookCategory 네이밍 변경
Kyxxn Nov 28, 2024
bc048cc
chore: 불필요한 코드 제거
Kyxxn Nov 28, 2024
67fd189
feat: BookCategory 관련 의존성 주입
Kyxxn Nov 28, 2024
a6cde7c
docs: 리드미 갱신
Kyxxn Nov 28, 2024
1e7f9c4
docs: 리드미 갱신
Kyxxn Nov 28, 2024
d55bfc1
docs: 리드미 갱신
Kyxxn Nov 28, 2024
3b557b0
docs: 리드미 기술스택 추가
Kyxxn Nov 28, 2024
a68e096
Merge pull request #96 from boostcampwm-2024/feature/update-docs
Kyxxn Nov 28, 2024
257e926
release: version 0.4로 업데이트
k2645 Nov 28, 2024
b198a85
Merge pull request #97 from boostcampwm-2024/feature/release-0.4
k2645 Nov 28, 2024
d7dacc8
feat: BookCategory Fetch UseCase 추가
Kyxxn Nov 28, 2024
0ad5b0f
chore: 네이밍 변경
Kyxxn Nov 28, 2024
9237ecc
refactor: 카테고리 삭제할 때만 String 넘겨주고, 나머지는 BookCategory로 변경
Kyxxn Nov 28, 2024
0e49823
refactor: BookCategoryViewModel에서 카테고리를 문자열이 아닌 BookCategory로 변경
Kyxxn Nov 28, 2024
ffed81a
chore: TODO 추가
Kyxxn Nov 28, 2024
d6adc76
fix: CoreData: error: Failed to load model named 에러 해결
Kyxxn Nov 28, 2024
ccf78f0
chore: 불필요한 코드 제거
Kyxxn Nov 28, 2024
8032520
fix: 동시성 문제 임시해결
Kyxxn Nov 28, 2024
d0e1c74
fix: 전체, 즐겨찾기 추가
Kyxxn Nov 29, 2024
aa25a64
refactor: 커스텀 Detent에서 medium으로 변경
Kyxxn Nov 29, 2024
5456b0a
fix: 카테고리 Update 안되는 문제 해결
Kyxxn Nov 29, 2024
9478ab8
refactor: UIAlertController 편의 생성자에 취소 액션 추가
Kyxxn Nov 29, 2024
02cc76e
chore: 불필요한 코드 제거
Kyxxn Nov 29, 2024
22cc775
fix: 삭제 버튼 클릭 시 카테고리 이름이 제대로 보이지 않는 문제 해결
Kyxxn Nov 29, 2024
a187d3c
feat: 카테고리 CRUD 테스트 코드 작성
Kyxxn Nov 29, 2024
2ee700d
refactor: 에러 명시글 수정
Kyxxn Nov 29, 2024
d27f9fd
refactor: NSPersistentContainer의 lazy 제거
Kyxxn Nov 29, 2024
6e8201f
Merge pull request #99 from boostcampwm-2024/feature/crud-coredata-ca…
Kyxxn Nov 29, 2024
65aac5d
chore: Merge branch 'develop' into feature/load-page-data
k2645 Nov 29, 2024
b04333b
feat: Repository 및 UseCase, Entity Sendable 채택
k2645 Nov 29, 2024
d4b4d6c
fix: CoreDataBookStorage dto change 메서드 매개변수 추가
k2645 Nov 29, 2024
f753762
feat: ReadPageViewController, ReadPageViewModel 수정
k2645 Nov 29, 2024
b3d7d16
feat: BookViewController, BookViewModel 기능 구현
k2645 Nov 29, 2024
178ca5b
feat: HomeViewController의 Cell과 BookViewController 연결
k2645 Nov 29, 2024
c5b6e0c
refactor: performDatabaseTask를 CoreDataStorage의 internal 메서드로 변경
k2645 Nov 29, 2024
e70fab9
refactor: 120줄 넘은 메소드 인덴트 변경
Kyxxn Nov 29, 2024
0ec93c4
feat: 드래그 앤 드랍으로 모델 위치 바꾸기 구현
Kyxxn Nov 29, 2024
fa83564
Merge pull request #101 from boostcampwm-2024/feature/load-page-data
k2645 Nov 30, 2024
54ce9b7
feat: BookCover 모델에 order 프로퍼티 추가
Kyxxn Nov 30, 2024
aeb381d
feat: 드래그앤 드랍 시 뷰모델에게 input 전송
Kyxxn Nov 30, 2024
04713a6
feat: 카테고리 드래그앤드랍 인덱스 연산 처리
Kyxxn Nov 30, 2024
4922f1c
refactor: 메소드 가독성 증가
Kyxxn Nov 30, 2024
8d3c727
refactor: Lint 해결
Kyxxn Nov 30, 2024
a835a59
fix: order 프로퍼티 추가에 따른 테스트 해결
Kyxxn Nov 30, 2024
9554aa0
Merge branch 'develop' into feature/dragdrop-home-bookcover
Kyxxn Nov 30, 2024
66638c9
chore: 공통되는 코드 합치기
Kyxxn Nov 30, 2024
181f6aa
Merge pull request #103 from boostcampwm-2024/feature/dragdrop-home-b…
Kyxxn Nov 30, 2024
121bb3a
feat: view, view model seperated
yuncheol-AHN Nov 30, 2024
5b883d9
comment: delete annotation
yuncheol-AHN Nov 30, 2024
fbc9819
chore: delete unnecessary code
yuncheol-AHN Nov 30, 2024
98892a4
chore: use function
yuncheol-AHN Nov 30, 2024
10d2d4a
feat: add audio controller
yuncheol-AHN Nov 27, 2024
cade054
feat: filename change Date to UUID & audio file delete when cancel bu…
yuncheol-AHN Nov 27, 2024
0a32ece
feat: request mic permission
yuncheol-AHN Nov 27, 2024
8a88ead
fix: layout error
yuncheol-AHN Nov 27, 2024
5b85d61
Revert "feat: request mic permission"
yuncheol-AHN Nov 27, 2024
2a0a065
feat: view, view model seperated
yuncheol-AHN Nov 30, 2024
194fc72
comment: delete annotation
yuncheol-AHN Nov 30, 2024
fccaf56
chore: delete unnecessary code
yuncheol-AHN Nov 30, 2024
c99618d
chore: use function
yuncheol-AHN Nov 30, 2024
8f1755e
Merge remote-tracking branch 'origin/feature/add-audio' into feature/…
yuncheol-AHN Nov 30, 2024
059ab69
chore: apply feedback
yuncheol-AHN Nov 30, 2024
ef17050
feat: view, view model seperated
yuncheol-AHN Nov 30, 2024
f115e4b
comment: delete annotation
yuncheol-AHN Nov 30, 2024
3a3749b
chore: delete unnecessary code
yuncheol-AHN Nov 30, 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
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1;
MARKETING_VERSION = 0.4;
PRODUCT_BUNDLE_IDENTIFIER = kr.codesquad.boostcamp9.MemorialHouse;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down Expand Up @@ -279,7 +279,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.1;
MARKETING_VERSION = 0.4;
PRODUCT_BUNDLE_IDENTIFIER = kr.codesquad.boostcamp9.MemorialHouse;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down
151 changes: 134 additions & 17 deletions MemorialHouse/MHApplication/MHApplication/Source/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,143 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {

func registerDependency() {
do {
DIContainer.shared.register(
MemorialHouseRepository.self,
object: DefaultMemorialHouseRepository()
)

let memorialHouseRepository = try DIContainer.shared.resolve(MemorialHouseRepository.self)
DIContainer.shared.register(
FetchMemorialHouseUseCase.self,
object: DefaultFetchMemorialHouseUseCase(repository: memorialHouseRepository)
)

let fetchMemorialHouseUseCase = try DIContainer.shared.resolve(FetchMemorialHouseUseCase.self)
DIContainer.shared.register(
HomeViewModelFactory.self,
object: HomeViewModelFactory(fetchMemorialHouseUseCase: fetchMemorialHouseUseCase)
)
} catch let error as MHError {
try registerStorageDepedency()
try registerRepositoryDependency()
try registerUseCaseDependency()
try registerViewModelFactoryDependency()
} catch let error as MHCoreError {
MHLogger.error("\(error.description)")
} catch {
MHLogger.error("\(error.localizedDescription)")
}
}

private func registerStorageDepedency() throws {
DIContainer.shared.register(CoreDataStorage.self, object: CoreDataStorage())

let coreDataStorage = try DIContainer.shared.resolve(CoreDataStorage.self)
DIContainer.shared.register(
BookCategoryStorage.self,
object: CoreDataBookCategoryStorage(coreDataStorage: coreDataStorage)
)
DIContainer.shared.register(
BookCoverStorage.self,
object: CoreDataBookCoverStorage(coreDataStorage: coreDataStorage)
)
DIContainer.shared.register(
BookStorage.self,
object: CoreDataBookStorage(coreDataStorage: coreDataStorage)
)
}

private func registerRepositoryDependency() throws {
DIContainer.shared.register(
MemorialHouseRepository.self,
object: DefaultMemorialHouseRepository()
)

let bookCategoryStorage = try DIContainer.shared.resolve(BookCategoryStorage.self)
DIContainer.shared.register(
BookCategoryRepository.self,
object: LocalBookCategoryRepository(storage: bookCategoryStorage)
)
let bookCoverStorage = try DIContainer.shared.resolve(BookCoverStorage.self)
DIContainer.shared.register(
BookCoverRepository.self,
object: LocalBookCoverRepository(storage: bookCoverStorage)
)
let bookStorage = try DIContainer.shared.resolve(BookStorage.self)
DIContainer.shared.register(
BookRepository.self,
object: LocalBookRepository(storage: bookStorage)
)
}

private func registerUseCaseDependency() throws {
// MARK: MemorialHouse UseCase
let memorialHouseRepository = try DIContainer.shared.resolve(MemorialHouseRepository.self)
DIContainer.shared.register(
FetchMemorialHouseUseCase.self,
object: DefaultFetchMemorialHouseUseCase(repository: memorialHouseRepository)
)

// MARK: Category UseCase
let bookCategoryRepository = try DIContainer.shared.resolve(BookCategoryRepository.self)
DIContainer.shared.register(
CreateBookCategoryUseCase.self,
object: DefaultCreateBookCategoryUseCase(repository: bookCategoryRepository)
)
DIContainer.shared.register(
FetchBookCategoriesUseCase.self,
object: DefaultFetchBookCategoriesUseCase(repository: bookCategoryRepository)
)
DIContainer.shared.register(
UpdateBookCategoryUseCase.self,
object: DefaultUpdateBookCategoryUseCase(repository: bookCategoryRepository)
)
DIContainer.shared.register(
DeleteBookCategoryUseCase.self,
object: DefaultDeleteBookCategoryUseCase(repository: bookCategoryRepository)
)

// MARK: - Book UseCase
let bookRepository = try DIContainer.shared.resolve(BookRepository.self)
DIContainer.shared.register(
CreateBookUseCase.self,
object: DefaultCreateBookUseCase(repository: bookRepository)
)
DIContainer.shared.register(
FetchBookUseCase.self,
object: DefaultFetchBookUseCase(repository: bookRepository)
)
DIContainer.shared.register(
UpdateBookUseCase.self,
object: DefaultUpdateBookUseCase(repository: bookRepository)
)
DIContainer.shared.register(
DeleteBookUseCase.self,
object: DefaultDeleteBookUseCase(repository: bookRepository)
)
}

private func registerViewModelFactoryDependency() throws {
// MARK: MemorialHouse ViewModel
let fetchMemorialHouseUseCase = try DIContainer.shared.resolve(FetchMemorialHouseUseCase.self)
let fetchBookCategoryUseCase = try DIContainer.shared.resolve(FetchBookCategoriesUseCase.self)
DIContainer.shared.register(
HomeViewModelFactory.self,
object: HomeViewModelFactory(
fetchMemorialHouseUseCase: fetchMemorialHouseUseCase,
fetchCategoryUseCase: fetchBookCategoryUseCase
)
)

// MARK: Category ViewModel
let createBookCategoryUseCase = try DIContainer.shared.resolve(CreateBookCategoryUseCase.self)
let fetchBookCategoriesUseCase = try DIContainer.shared.resolve(FetchBookCategoriesUseCase.self)
let updateBookCategoryUseCase = try DIContainer.shared.resolve(UpdateBookCategoryUseCase.self)
let deleteBookCategoryUseCase = try DIContainer.shared.resolve(DeleteBookCategoryUseCase.self)
DIContainer.shared.register(
BookCategoryViewModelFactory.self,
object: BookCategoryViewModelFactory(
createBookCategoryUseCase: createBookCategoryUseCase,
fetchBookCategoriesUseCase: fetchBookCategoriesUseCase,
updateBookCategoryUseCase: updateBookCategoryUseCase,
deleteBookCategoryUseCase: deleteBookCategoryUseCase
)
)

// MARK: - Book ViewModel
let fetchBookUseCase = try DIContainer.shared.resolve(FetchBookUseCase.self)
DIContainer.shared.register(
BookViewModelFactory.self,
object: BookViewModelFactory(fetchBookUseCase: fetchBookUseCase)
)

// MARK: - Page ViewModel
DIContainer.shared.register(
ReadPageViewModelFactory.self,
object: ReadPageViewModelFactory()
)
}
}
2 changes: 1 addition & 1 deletion MemorialHouse/MHCore/MHCore/DIContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public final class DIContainer {
let key = String(describing: type)
guard let object = objects[key] as? T else {
MHLogger.error("\(#function): \(key)에 해당하는 object 없음")
throw MHError.DIContainerResolveFailure(key: key)
throw MHCoreError.DIContainerResolveFailure(key: key)
}
return object
}
Expand Down
12 changes: 12 additions & 0 deletions MemorialHouse/MHCore/MHCore/MHCoreError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import MHFoundation

public enum MHCoreError: Error, CustomStringConvertible, Equatable {
case DIContainerResolveFailure(key: String)

public var description: String {
switch self {
case .DIContainerResolveFailure(let key):
"\(key)에 대한 dependency resolve 실패"
}
}
}
54 changes: 54 additions & 0 deletions MemorialHouse/MHCore/MHCore/MHDataError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import MHFoundation

public enum MHDataError: Error, CustomStringConvertible, Equatable {
case noSuchEntity(key: String)
case createEntityFailure
case convertDTOFailure
case fetchEntityFaliure
case updateEntityFailure
case deleteEntityFailure
case findEntityFailure
case saveContextFailure
case directorySettingFailure
case fileCreationFailure
case fileReadingFailure
case fileDeletionFailure
case fileMovingFailure
case fileNotExists
case generalFailure

public var description: String {
switch self {
case let .noSuchEntity(key):
"\(key)에 대한 Entity가 존재하지 않습니다"
case .createEntityFailure:
"Entity 생성 실패"
case .convertDTOFailure:
"Entity에 대한 DTO 변환 실패"
case .fetchEntityFaliure:
"Entity 가져오기 실패"
case .updateEntityFailure:
"Entity 업데이트 실패"
case .deleteEntityFailure:
"Entity 삭제 실패"
case .findEntityFailure:
"Entity 찾기 실패"
case .saveContextFailure:
"Update된 Context 저장 실패"
case .directorySettingFailure:
"디렉토리 설정 실패"
case .fileCreationFailure:
"파일 생성 실패"
case .fileReadingFailure:
"파일 읽기 실패"
case .fileDeletionFailure:
"파일 삭제 실패"
case .fileMovingFailure:
"파일 이동 실패"
case .fileNotExists:
"파일이 존재하지 않습니다"
case .generalFailure:
"알 수 없는 에러입니다."
}
}
}
21 changes: 0 additions & 21 deletions MemorialHouse/MHCore/MHCore/MHError.swift

This file was deleted.

22 changes: 22 additions & 0 deletions MemorialHouse/MHData/MHData/DTO/BookCategoryDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import MHFoundation
import MHDomain

public struct BookCategoryDTO {
let order: Int
let name: String

public init(
order: Int,
name: String
) {
self.order = order
self.name = name
}

func convertToBookCategory() -> BookCategory {
BookCategory(
order: order,
name: name
)
}
}
26 changes: 23 additions & 3 deletions MemorialHouse/MHData/MHData/DTO/BookCoverDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,38 @@ import MHFoundation
import MHDomain

public struct BookCoverDTO {
let identifier: UUID
let id: UUID
let order: Int
let title: String
let imageURL: String?
let color: String
let category: String?
let favorite: Bool

func toBookCover() -> BookCover? {
public init(
id: UUID,
order: Int,
title: String,
imageURL: String?,
color: String,
category: String?,
favorite: Bool
) {
self.id = id
self.order = order
self.title = title
self.imageURL = imageURL
self.color = color
self.category = category
self.favorite = favorite
}

func convertToBookCover() -> BookCover? {
guard let color = BookColor(rawValue: self.color) else { return nil }

return BookCover(
identifier: self.identifier,
id: self.id,
order: self.order,
title: self.title,
imageURL: self.imageURL,
color: color,
Expand Down
26 changes: 26 additions & 0 deletions MemorialHouse/MHData/MHData/DTO/BookDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import MHFoundation
import MHDomain

public struct BookDTO {
let id: UUID
let title: String
let pages: [PageDTO]

public init(
id: UUID,
title: String,
pages: [PageDTO]
) {
self.id = id
self.title = title
self.pages = pages
}

func convertToBook() -> Book {
return Book(
id: self.id,
title: self.title,
pages: self.pages.map { $0.convertToPage() }
)
}
}
29 changes: 29 additions & 0 deletions MemorialHouse/MHData/MHData/DTO/MediaDescriptionDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import MHFoundation
import MHDomain

public struct MediaDescriptionDTO {
let id: UUID
let type: String
let attributes: Data?

public init(
id: UUID,
type: String,
attributes: Data?
) {
self.id = id
self.type = type
self.attributes = attributes
}

func convertToMediaDescription() -> MediaDescription? {
guard let type = MediaType(rawValue: self.type) else { return nil }
let attributes = try? JSONSerialization.jsonObject(with: attributes ?? Data(), options: []) as? [String: any Sendable]

Check warning on line 21 in MemorialHouse/MHData/MHData/DTO/MediaDescriptionDTO.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 126 characters (line_length)

Check warning on line 21 in MemorialHouse/MHData/MHData/DTO/MediaDescriptionDTO.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 126 characters (line_length)

Check warning on line 21 in MemorialHouse/MHData/MHData/DTO/MediaDescriptionDTO.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 126 characters (line_length)

Check warning on line 21 in MemorialHouse/MHData/MHData/DTO/MediaDescriptionDTO.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 126 characters (line_length)

return MediaDescription(
id: self.id,
type: type,
attributes: attributes
)
}
}
Loading