Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data CSV export ve Send email endpointleri #141

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ docker run -p 8080:8080 -d deprem-io-backend
make up
```

### Local docker-compose ile ayağa kaldırma

docker-compose-local.yml dosyasinda mongodb ve redis icin 127.0.0.1 yonlendirmesi yapan versiyonlari bulunmaktadir.

```
docker-compose -f docker-compose-local.yml up --build
```

Containerlari ayağa kaldırdıktan sonra asağıdaki gibi localde calışan mongo ve redis
containerlarına uygulamayı bağlayabiliriz.

```.env doyası
MONGOURL="mongodb://127.0.0.1:27017/app"
REDIS_URL="127.0.0.1:6379"
```


## Postman Workspace

https://www.postman.com/minikdev/workspace/depremio
Expand Down Expand Up @@ -126,6 +143,31 @@ localhost:8080/yardimet
}
```

## export (GET)

Ilgili modelleri duz csv dosyasi olarak download eder

```
http://localhost:8080/export?veriTipi=YardimKaydi
```

## exportStream (GET)

Ilgili modelleri stream csv dosyasi olarak download eder

```
http://localhost:8080/exportStream?veriTipi=YardimKaydi
```

## mailExport (POST)

```
{
"veriTipi": "YardimKaydi",
"mailler": ["[email protected]", "[email protected]"]
}
```

## Fields alanını kullanımı

post olarak fields-{burası aalanı adı}: value şeklinde datayı gönderin onunları fields objesi altında birleştirip db ye kayddedecek
Expand All @@ -143,6 +185,18 @@ fields: {
Opsiyonel her türlü yardım isteme ve yardımEt kısmına eklenecek özellikler için
fields alanını kullanın isteidğiniz gibi json objesi post edebilirsiniz

## Local Email Saglayici Ayari

Export E-Mail ozelligi icin email saglayicinin API key degerini .env dosyasina girmeniz gerekmektedir.

Ayrica email atilmasi istediginiz hesaplari (coklu ise virgul ile ayirarak) asagidaki gibi tanimlayiniz.

e.g.
```.env
EMAIL_PROVIDER_API_KEY="EXAMPLEAPIKEY"
EXPORT_EMAILS="[email protected]"
```

## Cache i temizleme

/cache/flushall
Expand Down
2 changes: 2 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ module.exports = {
port: parseInt(process.env.PORT, 10) || 8080,
mongoUrl: process.env.MONGOURL || "",
NODE_ENV: process.env.NODE_ENV || "development",
exportEmails: process.env.EXPORT_EMAILS || "[email protected]",
emailProviderAPIKey: process.env.EMAIL_PROVIDER_API_KEY || "",
};
38 changes: 38 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.9'

services:
app:
restart: always
build: .
ports:
- 8080:8080
environment:
- MONGOURL=mongodb://mongodb:27017
depends_on:
- mongodb

mongodb:
restart: always
image: zcube/bitnami-compat-mongodb
environment:
- MONGO_INITDB_DATABASE=app
halilturkoglucs marked this conversation as resolved.
Show resolved Hide resolved
- MONGO_INITDB_ROOT_USERNAME=rootd
ports:
- "127.0.0.1:27017:27017"
volumes:
- mongodb_data:/bitnami/mongodb

redis:
image: redis:6.2-alpine
restart: always
ports:
- '127.0.0.1:6379:6379'
command: redis-server --save 20 1 --loglevel warning
volumes:
- redis_data:/data

volumes:
mongodb_data:
driver: local
redis_data:
driver: local
71 changes: 71 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@fastify/cors": "^8.2.0",
"@fastify/swagger": "^8.3.1",
"@fastify/swagger-ui": "^1.3.0",
"@sendgrid/mail": "^7.7.0",
"dotenv": "^16.0.3",
"fastify": "^4.13.0",
"mongoose": "^6.9.1",
Expand Down
Loading