iOS: Shops (Bezugsquellen) verwalten

Die iOS-Stammdaten hatten keinen Punkt fuer Shops – die "gekauft bei"-Liste war
nur im Web pflegbar. Jetzt gibt es unter Verwaltung > Stammdaten "Shops" mit
Anlegen, Bearbeiten (Name + optionale Website) und Loeschen, analog zum Web.
Client um createShop/updateShop/deleteShop samt Request-Models ergaenzt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-26 12:32:17 +02:00
parent 2a507851d9
commit 6b597313d5
3 changed files with 126 additions and 0 deletions

View File

@@ -259,6 +259,22 @@ actor APIClient {
try await send(try makeRequest("/shops"), as: [ShopItem].self)
}
func createShop(_ payload: NewShopRequest) async throws -> ShopItem {
var request = try makeRequest("/shops", method: "POST")
try jsonBody(&request, payload)
return try await send(request, as: ShopItem.self)
}
func updateShop(id: Int, _ payload: ShopUpdateRequest) async throws -> ShopItem {
var request = try makeRequest("/shops/\(id)", method: "PATCH")
try jsonBody(&request, payload)
return try await send(request, as: ShopItem.self)
}
func deleteShop(id: Int) async throws {
try await sendNoContent(try makeRequest("/shops/\(id)", method: "DELETE"))
}
/// Effektive (vererbte) Felder einer Kategorie fuer das Artikelformular.
func categoryFields(categoryId: Int) async throws -> [FieldDefinition] {
try await send(try makeRequest("/categories/\(categoryId)/fields"), as: [FieldDefinition].self)