Skip to content

Commit 3903428

Browse files
dadachiclaude
andcommitted
Remove unused shop reset functionality
- Removes `ShopRepository.reset(id:)` and its `ShopRepositoryProtocol` declaration - Drops the corresponding `ShopsService.resetShop` and `ResetShopRequest` networking layer - Cleans up reset stubs in `DemoShopRepository`, `TestShopRepository`, and `DemoShopRepositoryTest` Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9e115d9 commit 3903428

7 files changed

Lines changed: 0 additions & 60 deletions

File tree

NativeAppTemplate/Data/Repositories/ShopRepository.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,4 @@ import SwiftUI
109109
throw error
110110
}
111111
}
112-
113-
func reset(id: String) async throws {
114-
do {
115-
try await shopsService.resetShop(id: id)
116-
} catch {
117-
Failure
118-
.destroy(from: Self.self, reason: error.codedDescription)
119-
.log()
120-
throw error
121-
}
122-
}
123112
}

NativeAppTemplate/Data/Repositories/ShopRepositoryProtocol.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ import SwiftUI
2020
func create(shop: Shop) async throws -> Shop
2121
func update(id: String, shop: Shop) async throws -> Shop
2222
func destroy(id: String) async throws
23-
func reset(id: String) async throws
2423
}

NativeAppTemplate/Networking/Requests/ShopsRequest.swift

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -183,30 +183,3 @@ struct DestroyShopRequest: Request {
183183

184184
func handle(response: Data) throws {}
185185
}
186-
187-
struct ResetShopRequest: Request {
188-
typealias Response = Void
189-
190-
// MARK: - Properties
191-
192-
var method: HTTPMethod {
193-
.DELETE
194-
}
195-
196-
var path: String {
197-
"/shopkeeper/shops/\(id)/reset"
198-
}
199-
200-
var additionalHeaders: [String: String] = [:]
201-
var body: Data? {
202-
nil
203-
}
204-
205-
// MARK: - Parameters
206-
207-
let id: String
208-
209-
// MARK: - Internal
210-
211-
func handle(response: Data) throws {}
212-
}

NativeAppTemplate/Networking/Services/ShopsService.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,4 @@ extension ShopsService {
3131
let request = MakeShopRequest(shop: shop)
3232
return try await makeRequest(request: request)
3333
}
34-
35-
func resetShop(id: String) async throws -> ResetShopRequest.Response {
36-
try await makeRequest(request: ResetShopRequest(id: id))
37-
}
3834
}

NativeAppTemplateTests/Demo/Data/Repositories/DemoShopRepository.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ final class DemoShopRepository: ShopRepositoryProtocol {
5656
shops.removeAll { $0.id == id }
5757
}
5858

59-
func reset(id: String) async throws {}
60-
6159
// MARK: - Helpers
6260

6361
private func mockShop(id: String = UUID().uuidString, name: String = "Mock Shop") -> Shop {

NativeAppTemplateTests/Demo/Data/Repositories/DemoShopRepositoryTest.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,5 @@ struct DemoShopRepositoryTest {
7373
try await repository.destroy(id: "1")
7474
#expect(!repository.shops.contains { $0.id == "1" })
7575
}
76-
77-
@Test
78-
func reset() async throws {
79-
repository.reload()
80-
81-
await #expect(throws: Never.self) {
82-
try await repository.reset(id: "1")
83-
}
84-
}
8576
}
8677
}

NativeAppTemplateTests/Testing/Repositories/TestShopRepository.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ final class TestShopRepository: ShopRepositoryProtocol {
8181
shops.removeAll { $0.id == id }
8282
}
8383

84-
func reset(id: String) async throws {
85-
guard error == nil else {
86-
throw error!
87-
}
88-
}
89-
9084
/// A test-only
9185
func setShops(shops: [Shop]) {
9286
self.shops = shops

0 commit comments

Comments
 (0)