first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:11:03 +03:00
commit 031582ea2c
98 changed files with 13281 additions and 0 deletions

84
API_TEST.md Normal file
View File

@@ -0,0 +1,84 @@
# Image API - Test Senaryoları
## API Test Komutları (cURL)
### 1. Kayıt Ol
```bash
curl -X POST http://localhost:3000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "test12345",
"name": "Test User"
}'
```
### 2. Login
```bash
curl -X POST http://localhost:3000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "test12345"
}'
```
Yanıttan `accessToken` değerini alın ve aşağıdaki komutlarda kullanın:
```bash
export TOKEN="buraya_token_yapistirin"
```
### 3. Resim Yükle
```bash
curl -X POST http://localhost:3000/api/v1/images/upload \
-H "Authorization: Bearer $TOKEN" \
-F "file=@/path/to/image.jpg" \
-F "width=800" \
-F "height=600" \
-F "quality=90" \
-F "format=webp"
```
### 4. Resimleri Listele
```bash
curl -X GET http://localhost:3000/api/v1/images \
-H "Authorization: Bearer $TOKEN"
```
### 5. Resim Sil
```bash
export IMAGE_ID="buraya_image_id_yapistirin"
curl -X DELETE http://localhost:3000/api/v1/images/$IMAGE_ID \
-H "Authorization: Bearer $TOKEN"
```
## Test Flow
1. Önce register olun ve token alın
2. Token ile resim yükleyin
3. Yüklenen resimleri listeleyin
4. Bir resmi silin
5. Tekrar listeleyin ve silindiğini doğrulayın
## Hata Testleri
### Geçersiz Token
```bash
curl -X GET http://localhost:3000/api/v1/images \
-H "Authorization: Bearer invalid_token"
```
### Token Olmadan
```bash
curl -X GET http://localhost:3000/api/v1/images
```
### Geçersiz Login
```bash
curl -X POST http://localhost:3000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "yanlis_sifre"
}'
```