113 lines
4.4 KiB
Markdown
113 lines
4.4 KiB
Markdown
# Yeni Modul Ekleme
|
||
|
||
`abp new Kurs.Notification -t module --no-ui -m none --database-provider ef --version 7.2.2 --old`
|
||
|
||
# Code Format
|
||
|
||
`dotnet format --include .\modules\Kurs.Notification\ --folder`
|
||
|
||
# Migrations
|
||
|
||
- Yeni migration ekleme
|
||
`EntityFrameworkCore projesine gir`
|
||
`dotnet ef migrations add ""`
|
||
`dotnet ef database update`
|
||
|
||
- Son migrationi siler ve snapshot revert eder
|
||
`dotnet ef migrations remove`
|
||
`dotnet ef database update "20240822114716_ABP_822"`
|
||
|
||
- SQL Veritabanını Entity Class oluştur.
|
||
`dotnet ef dbcontext scaffold "Server=SERVERNAME;Database=DBNAME;User ID=USERNAME;Password=PASSWORD;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer --context MyDbContext --output-dir Models --data-annotations --force`
|
||
|
||
# Public Api
|
||
|
||
```
|
||
Token İsteği Örnek:
|
||
POST /connect/token HTTP/1.1
|
||
Host: localhost:44344
|
||
Content-Type: application/x-www-form-urlencoded
|
||
|
||
username=system%40sozsoft.com
|
||
&password=...
|
||
&grant_type=password
|
||
&client_id=Platform_PublicApi
|
||
&scope=offline_access%20Platform
|
||
```
|
||
|
||
## Whatsapp Ayarları
|
||
|
||
- Normal facebook üyeliği yapılır.
|
||
- https://developers.facebook.com/ sitesinden yeni developer üyeliği oluşturulur. Developer üyeliği seçilir.
|
||
- CreateApp butonu ile yeni uygulama oluşturulur. Uygulama adı belirlenir. 'Kurs Messenger'
|
||
- AppType olarak İşletme seçilir ve App oluşturulur.
|
||
- Add Products kısmında WhatsApp seçilir ve Business Account oluşturulur.
|
||
- 3 noktadan (menüden) WhatsApp Manager sayfasına gidilir. Manage Templates seçilir, istenirse yeni template oluşturulur. 'hello_world'
|
||
- WhatsApp Manager üzerinde menüden Settings -> Users -> System Users eklenir. Kullanıcı adı 'admin' ve Role ise 'Admin' seçilir.
|
||
- Eklenen 'admin' kullanıcısında 'Assign Assets' seçilir ve full yetki verilir.
|
||
- admin kullanıcısı üzerinden 'Generate Token' seçilir ve aşağıdaki yetkiler verilir.
|
||
|
||
```
|
||
- whatsapp_business_management'
|
||
- 'whatsapp_business_messaging'
|
||
```
|
||
|
||
- WhatsApp -> API Setup kısmından "From" kısmında yeni telefon numarası eklenir.
|
||
- WhatsApp -> API Setup kısmından Generate Access Token oluşturulur.
|
||
|
||
- token: EAASM83pDJf0BO0ZCYBr3Fx4SES0ox8XiZCgP3FIteprYpwawZCkGYjpMlKk4OZCWgRNZC2Ttofgf8amMf929ZBuDcgYIOsXkPMGBNmVxm2czipzq63LmtbYfyCWsKVy0q1jtay0nRoeDuO2FKhqCfLLtNn9cSWjINVLcz26ptK8a2Oko83cZBzrNsp3cpIECnzqRfEjHdEz1U73y3ZB1MZBOhHilax7yZALf4ZA1Tmk
|
||
- WhatsApp telefon numarasını Register etmek için aşağıdaki postman Curl gönderilir.
|
||
|
||
```
|
||
curl --location 'https://graph.facebook.com/v21.0/521106361082067/register' \
|
||
--header 'Content-Type: application/json' \
|
||
--header 'Authorization: Bearer <access token>' \
|
||
--data '{
|
||
"messaging_product": "whatsapp",
|
||
"pin": "238567"
|
||
}'
|
||
```
|
||
|
||
- Message göndermek için url : https://graph.facebook.com/v21.0/521106361082067/messages
|
||
|
||
```
|
||
{
|
||
"messaging_product": "whatsapp",
|
||
"to": "{+gönderilecek gsm numarası}",
|
||
"type": "template",
|
||
"template": {
|
||
"name": "{message_template_name}",
|
||
"language": {
|
||
"code": "en"
|
||
},
|
||
"components": [
|
||
{
|
||
"type": "body",
|
||
"parameters": [
|
||
{
|
||
"type": "text",
|
||
"text": "Test mesajı"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
# ABP Update
|
||
- https://abp.io/docs/latest/release-info/upgrading
|
||
- https://abp.io/docs/9.0/release-info/migration-guides/abp-9-0
|
||
- https://learn.microsoft.com/en-us/aspnet/core/migration/80-90?view=aspnetcore-9.0&tabs=visual-studio-code
|
||
- Adımlar:
|
||
- abp cli güncellenir dotnet tool update --global Volo.Abp.Cli
|
||
- abp update ile sln içindeki referanslar update edilir
|
||
- modules/ klasörü *.csproj içinde ara&düzenle ile update edilir (örn. 8.3.4 -> 9.0.2)
|
||
- .net sürümü arttıysa Microsoft'un dotnet upgrade dokümanı takip edilir
|
||
- Yeni dotnet sdk kurulumu yapılır (örn dotnet 9 sdk)
|
||
- ef tools güncellenir (dotnet tool update --global dotnet-ef)
|
||
- Dockerfile dosyalarındaki base imajlar yeni dotnet sürümüne güncellenir
|
||
- Abp upgrade dokümanı takip edilir
|
||
- Proje build olmuyorsa hatalar çözülür
|
||
- Yeni migration eklenir (varsa). Migration boş çıkıyorsa kaldırılır. (Örn dotnet ef migrations add Abp902 ve dotnet ef migrations remove)
|
||
- Migration boş değilse çalıştırılır (dotnet ef database update)
|