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
11 changes: 0 additions & 11 deletions NativeAppTemplate/Data/Repositories/ShopRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,4 @@ import SwiftUI
throw error
}
}

func reset(id: String) async throws {
do {
try await shopsService.resetShop(id: id)
} catch {
Failure
.destroy(from: Self.self, reason: error.codedDescription)
.log()
throw error
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ import SwiftUI
func create(shop: Shop) async throws -> Shop
func update(id: String, shop: Shop) async throws -> Shop
func destroy(id: String) async throws
func reset(id: String) async throws
}
27 changes: 0 additions & 27 deletions NativeAppTemplate/Networking/Requests/ShopsRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,30 +183,3 @@ struct DestroyShopRequest: Request {

func handle(response: Data) throws {}
}

struct ResetShopRequest: Request {
typealias Response = Void

// MARK: - Properties

var method: HTTPMethod {
.DELETE
}

var path: String {
"/shopkeeper/shops/\(id)/reset"
}

var additionalHeaders: [String: String] = [:]
var body: Data? {
nil
}

// MARK: - Parameters

let id: String

// MARK: - Internal

func handle(response: Data) throws {}
}
4 changes: 0 additions & 4 deletions NativeAppTemplate/Networking/Services/ShopsService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,4 @@ extension ShopsService {
let request = MakeShopRequest(shop: shop)
return try await makeRequest(request: request)
}

func resetShop(id: String) async throws -> ResetShopRequest.Response {
try await makeRequest(request: ResetShopRequest(id: id))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ final class DemoShopRepository: ShopRepositoryProtocol {
shops.removeAll { $0.id == id }
}

func reset(id: String) async throws {}

// MARK: - Helpers

private func mockShop(id: String = UUID().uuidString, name: String = "Mock Shop") -> Shop {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,5 @@ struct DemoShopRepositoryTest {
try await repository.destroy(id: "1")
#expect(!repository.shops.contains { $0.id == "1" })
}

@Test
func reset() async throws {
repository.reload()

await #expect(throws: Never.self) {
try await repository.reset(id: "1")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ final class TestShopRepository: ShopRepositoryProtocol {
shops.removeAll { $0.id == id }
}

func reset(id: String) async throws {
guard error == nil else {
throw error!
}
}

/// A test-only
func setShops(shops: [Shop]) {
self.shops = shops
Expand Down
Loading