Ana içeriğe geç

API Spesifikasyonu Özeti

Bu sayfa, Gezen mobil uygulamasının kullandığı backend API yüzeyini özetler.

Runtime Yapılandırması

Uygulama backend URL'lerini .env dosyasından app.config.ts ve app/config/runtimeConfig.ts üzerinden okur. Axios bunları app/services/apiClient.ts içinde kullanır.

Değişken Kullanım Örnek
EXPO_PUBLIC_API_URL Ana backend http://192.168.10.135:8000/api
EXPO_PUBLIC_TASK_PHOTO_API_URL Legacy görev fotoğrafı backend'i http://192.168.10.135:8000/api/v1

Kurallar:

  • Path soneki dahil tam URL kullanın. Uygulama /auth/token gibi göreli yolları EXPO_PUBLIC_API_URL üzerine ekler.
  • Backend URL'lerini app/constants.ts içinde yapılandırmayın; bu dosya legacy'dir ve API çağrılarında kullanılmaz.
  • .env değiştirdikten sonra Metro'yu durdurun ve npx expo start -c ile yeniden başlatın.
  • Testlerde kullanılan örnek üretim değerleri https://sales.iqvizyon.com/api ve https://api.iqv.com.tr/api/v1 olabilir; gerçek değerler kendi .env dosyanızdan gelir.

Kurulum ayrıntıları: setup.md

Kimlik Doğrulama

Korumalı tüm istekler SecureStore'dan alınan Bearer token kullanır:

Authorization: Bearer <token>

Auth endpoint'leri

  • POST /auth/token
  • Form-encoded username ve password ile giriş
  • GET /users/me
  • Mevcut kimliği doğrulanmış kullanıcıyı döndürür

Auth token'ı user_token anahtarında saklanır.

Ana Kaynak Grupları

Fabrikalar

  • GET /factories
  • POST /factories
  • PUT /factories/{factoryId}

Mevcut frontend gerektiğinde tekil fabrika detayını liste yanıtından türetiyor, ayrı bir detail endpoint'e bağlı kalmıyor.

Makineler

  • GET /machines
  • GET /machines/{machineId}
  • POST /machines
  • PUT /machines/{machineId}
  • DELETE /machines/{machineId}
  • GET /machines/{machineId}/images/
  • POST /machines/{machineId}/images/
  • DELETE /machines/{machineId}/images/{imageId}

Makine görsel URL'leri ayrıca ana backend host ve legacy /uploads/machine_images/{machineId}/{fileName} yolu ile client tarafında oluşturulur.

Makine Referans Verileri

  • GET /machine-brands
  • POST /machine-brands
  • GET /machine-models
  • POST /machine-models
  • GET /machine-types
  • POST /machine-types
  • PUT /machine-types/{id}
  • DELETE /machine-types/{id}
  • GET /control-panel-brands
  • POST /control-panel-brands
  • GET /control-panel-models
  • POST /control-panel-models

Görevler

  • GET /tasks
  • GET /tasks/{taskId}
  • POST /tasks
  • PUT /tasks/{taskId}
  • DELETE /tasks/{taskId}
  • PUT /tasks/{taskId}/status
  • POST /tasks/{taskId}/notes

Teklifler

  • GET /devices
  • GET /quotes
  • GET /quotes/{quoteId}
  • POST /quotes
  • PUT /quotes/{quoteId}
  • GET /quotes/{quoteId}/proforma/
  • POST /quotes/{quoteId}/send-proforma/
  • GET /quote-items
  • GET /quote-items/{id}
  • POST /quote-items
  • PUT /quote-items/{id}
  • DELETE /quote-items/{id}
  • POST /quotes/{quoteId}/create-followup-event

Takvim

  • GET /calendar-events
  • GET /calendar-events/{eventId}
  • POST /calendar-events
  • PUT /calendar-events/{eventId}
  • DELETE /calendar-events/{eventId}

Bildirimler

  • GET /notifications
  • GET /notifications/unread-count
  • PUT /notifications/{notificationId}/read
  • PUT /notifications/mark-all-read
  • POST /user/push-token

Üretim Kataloğu

  • GET /sectors
  • POST /sectors
  • GET /production-categories
  • POST /production-categories
  • GET /production-areas
  • POST /production-areas
  • GET /production-modules
  • POST /production-sub-modules

Kullanıcılar

  • GET /users

ROI ve Solution Center

  • POST /simple-roi-analysis/{factoryId}
  • Daha uzun bir client timeout kullanır
  • POST /solution-center

Legacy Görev-Fotoğraf Backend'i

Görev fotoğrafı işlemleri ayrı bir istemci ve base URL üzerinden yürütülür:

  • POST /tasks/{taskId}/photos
  • DELETE /tasks/{taskId}/photos/{photoId}

Bu backend özellikle app/services/taskPhotoService.ts içinde izole edilmiştir.

Frontend Uyum Katmanları

Kod tabanında hâlâ birkaç ince uyumluluk katmanı vardır:

  • app/services/calendarEventApi.ts canonical calendar istemcisini sarar
  • app/services/mobileApi.ts makineler ve fabrikalar için eski liste yardımcılarını sunar
  • app/services/machineApi.ts eski ekranlar tarafından kullanılan küçük bir mobil makine yardımcısı sağlar

Canonical API modülleri artık app/services/api/* altında yer alır.