Files
kovakyazilim/lib/types.ts
T
Ege Can Komur 7eb0c1acc2 fix(auth): SDK'yı kaldırıp ince REST katmanına geç (lib/appwrite-rest.ts)
Sorun:
- node-appwrite v20-25 hepsi Node 26'da bozuk (node-fetch-native-with-agent polyfill)
- appwrite browser SDK Server Action context'inde 'unexpected response' veriyor
  (büyük olasılıkla browser-only global'ları kontrol ederken)

Çözüm:
- Tüm Appwrite SDK'larını sil (appwrite + node-appwrite)
- lib/appwrite-rest.ts: native fetch üzerinde ~250 satırlık ince REST wrapper
  - account: createEmailPasswordSession, get, deleteSession
  - tablesDB: listRows, getRow, createRow, updateRow, deleteRow
  - storage: listFiles, createFile, deleteFile, fileViewUrl
  - Q helpers: equal, orderAsc/Desc, limit, offset
  - AppwriteError class
- Session secret cookie tabanlı auth korundu (isletmem-kovakcrm'deki desen)
- Tüm CRUD action ve query'ler REST katmanına bağlandı

End-to-end test edildi:
✓ Login (proper 401 hata mesajları, başarılı durumda redirect)
✓ Public read (services, blog, testimonials)
✓ Anonim create (contact form)
✓ Build (24 route)
✓ Sıfır SDK bağımlılığı — Node 26 sorunu yok
2026-05-20 02:29:19 +03:00

82 lines
1.9 KiB
TypeScript

import type { AwRow } from "@/lib/appwrite-rest";
export type Row = AwRow;
export interface ServiceRow extends AwRow {
slug: string;
title: string;
description: string;
icon?: string | null;
order?: number | null;
featured?: boolean | null;
}
export interface ProjectRow extends AwRow {
slug: string;
title: string;
description: string;
image_url?: string | null;
live_url?: string | null;
category?: string | null;
technologies?: string[] | null;
year?: number | null;
featured?: boolean | null;
}
export interface BlogPostRow extends AwRow {
slug: string;
title: string;
excerpt?: string | null;
content?: string | null;
cover_image?: string | null;
cover_file_id?: string | null;
author?: string | null;
status?: "draft" | "published" | null;
published_at?: string | null;
tags?: string[] | null;
seo_title?: string | null;
seo_description?: string | null;
seo_image?: string | null;
}
export interface TestimonialRow extends AwRow {
name: string;
role?: string | null;
company?: string | null;
message: string;
rating?: number | null;
image_url?: string | null;
order?: number | null;
featured?: boolean | null;
}
export interface SeoPageRow extends AwRow {
path: string;
title?: string | null;
description?: string | null;
og_image?: string | null;
canonical?: string | null;
noindex?: boolean | null;
}
export interface SeoSettingsRow extends AwRow {
site_name?: string | null;
site_description?: string | null;
default_og_image?: string | null;
twitter_handle?: string | null;
facebook_url?: string | null;
linkedin_url?: string | null;
instagram_url?: string | null;
google_site_verification?: string | null;
gtm_id?: string | null;
}
export interface ContactMessageRow extends AwRow {
name: string;
email: string;
phone?: string | null;
subject?: string | null;
message: string;
status?: "new" | "read" | "replied" | "archived" | null;
}