Proje: Okul B2B App · Hub: Okul B2B App — Domain

MediaService API Detayları

services/MediaService.ts — Ham medya CRUD operasyonları.

Endpoint’ler (MediaService.ENDPOINTS)

MEDIA: '/customer/media'
MEDIA_BY_ID: (id) => `/customer/media/${id}`
TEMP_MEDIA: '/customer/media/temp'
MOVE_MEDIA: '/customer/media/move'
SORT_MEDIA: '/customer/media/sort'

MediaFilters

interface MediaFilters {
  name?: string;
  row_id?: number;     // School ID
  status?: '0' | '1'; // INACTIVE | ACTIVE
  role_id?: number;    // MEDIA_ROLES.*
}

MediaSortOptions

interface MediaSortOptions {
  field: 'created_at' | 'updated_at' | 'sort';
  direction: 'asc' | 'desc';
}

Galeri sort alanına göre ascending (asc) sıralanır.

getGalleryMedia()

MediaService.getGalleryMedia(schoolId, page, limit)
// → Filters: { row_id: schoolId, role_id: MEDIA_ROLES.GALLERY }
// → Sort: { field: 'sort', direction: 'asc' }

getCoverMedia()

MediaService.getCoverMedia(schoolId)
// → getMediaByRole(schoolId, MEDIA_ROLES.COVER, 1)
// → Sadece ilk sonucu döner (tek kapak fotoğrafı)

uploadMedia() Strateji (Android)

  1. uploadMediaAndroidFileSystem() — expo-file-system MULTIPART
  2. uploadMediaAndroidXHR() — XHR birden fazla format
  3. Standard fetch fallback