From 43431cb0afc765b6b87f57f1ff01acecee254826 Mon Sep 17 00:00:00 2001
From: uuuunseo <jdbstjoo@gmail.com>
Date: Sat, 17 Aug 2024 16:47:34 +0900
Subject: [PATCH] :recycle: :: [#245] ViolationResponseDTO / rule Type String
 -> ViolationType

---
 .../Interface/Entity/ViolationEntity.swift               | 9 +++++++--
 Projects/Domain/ViolationDomain/Project.swift            | 4 +++-
 .../Sources/DTO/Response/ViolationResponseDTO.swift      | 3 ++-
 .../Tests/FetchMyViolationListUseCaseTests.swift         | 2 +-
 .../ViolationDomain/Tests/ViolationRepositoryTests.swift | 2 +-
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Projects/Domain/ViolationDomain/Interface/Entity/ViolationEntity.swift b/Projects/Domain/ViolationDomain/Interface/Entity/ViolationEntity.swift
index 14b0cec8..9e107f73 100644
--- a/Projects/Domain/ViolationDomain/Interface/Entity/ViolationEntity.swift
+++ b/Projects/Domain/ViolationDomain/Interface/Entity/ViolationEntity.swift
@@ -1,11 +1,16 @@
+import BaseDomainInterface
 import Foundation
 
 public struct ViolationEntity: Equatable {
     public let id: Int
-    public let rule: String
+    public let rule: ViolationType
     public let createDate: Date
 
-    public init(id: Int, rule: String, createDate: Date) {
+    public init(
+        id: Int,
+        rule: ViolationType,
+        createDate: Date
+    ) {
         self.id = id
         self.rule = rule
         self.createDate = createDate
diff --git a/Projects/Domain/ViolationDomain/Project.swift b/Projects/Domain/ViolationDomain/Project.swift
index d90fb6aa..4b54a4ff 100644
--- a/Projects/Domain/ViolationDomain/Project.swift
+++ b/Projects/Domain/ViolationDomain/Project.swift
@@ -5,7 +5,9 @@ import ProjectDescriptionHelpers
 let project = Project.module(
     name: ModulePaths.Domain.ViolationDomain.rawValue,
     targets: [
-        .interface(module: .domain(.ViolationDomain)),
+        .interface(module: .domain(.ViolationDomain), dependencies: [
+            .domain(target: .BaseDomain, type: .interface)
+        ]),
         .implements(module: .domain(.ViolationDomain), dependencies: [
             .domain(target: .ViolationDomain, type: .interface),
             .domain(target: .BaseDomain)
diff --git a/Projects/Domain/ViolationDomain/Sources/DTO/Response/ViolationResponseDTO.swift b/Projects/Domain/ViolationDomain/Sources/DTO/Response/ViolationResponseDTO.swift
index ebc2b80b..955ff3ab 100644
--- a/Projects/Domain/ViolationDomain/Sources/DTO/Response/ViolationResponseDTO.swift
+++ b/Projects/Domain/ViolationDomain/Sources/DTO/Response/ViolationResponseDTO.swift
@@ -1,10 +1,11 @@
+import BaseDomainInterface
 import DateUtility
 import Foundation
 import ViolationDomainInterface
 
 struct ViolationResponseDTO: Decodable {
     let id: Int
-    let rule: String
+    let rule: ViolationType
     let createdDate: String
 }
 
diff --git a/Projects/Domain/ViolationDomain/Tests/FetchMyViolationListUseCaseTests.swift b/Projects/Domain/ViolationDomain/Tests/FetchMyViolationListUseCaseTests.swift
index dae3ef24..13c05314 100644
--- a/Projects/Domain/ViolationDomain/Tests/FetchMyViolationListUseCaseTests.swift
+++ b/Projects/Domain/ViolationDomain/Tests/FetchMyViolationListUseCaseTests.swift
@@ -19,7 +19,7 @@ final class FetchMyViolationListUseCaseTests: XCTestCase {
 
     func test_FetchMyViolationList() async throws {
         let expected: [ViolationModel] = [
-            ViolationModel(id: 1, rule: "기숙사 탈주", createDate: .init())
+            ViolationModel(id: 1, rule: .firearms, createDate: .init())
         ]
         violationRepository.fetchMyViolationListHandler = { expected }
         XCTAssertEqual(violationRepository.fetchMyViolationListCallCount, 0)
diff --git a/Projects/Domain/ViolationDomain/Tests/ViolationRepositoryTests.swift b/Projects/Domain/ViolationDomain/Tests/ViolationRepositoryTests.swift
index 214ff35b..0b5ff65c 100644
--- a/Projects/Domain/ViolationDomain/Tests/ViolationRepositoryTests.swift
+++ b/Projects/Domain/ViolationDomain/Tests/ViolationRepositoryTests.swift
@@ -19,7 +19,7 @@ final class ViolationRepositoryTests: XCTestCase {
 
     func test_FetchMyViolationList() async throws {
         let expected: [ViolationEntity] = [
-            ViolationEntity(id: 1, rule: "기숙사 탈주", createDate: .init())
+            ViolationEntity(id: 1, rule: .firearms, createDate: .init())
         ]
         remoteViolationDataSource.fetchMyViolationListHandler = { expected }
         XCTAssertEqual(remoteViolationDataSource.fetchMyViolationListCallCount, 0)