Skip to content

Commit

Permalink
feat: udpate-packages (#40)
Browse files Browse the repository at this point in the history
feat: update packages

fix: readme

chore: update actions

test: 1

test: 2

debug: gock

test: 3

test: 4

test: 5

fix docker compose

fix: actions warnings
  • Loading branch information
AndrewHanasiro authored Oct 11, 2024
1 parent 9342506 commit 17caf57
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 99 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ GOOGLE_APPLICATION_NAME=your-firebase-project-name
MAILGUN_API_KEY=mailgun-api-key
ONESIGNAL_API_KEY=onesignal-api-key
SENDGRID_API_KEY=sendgrid-api-key
TELEGRAM_API_KEY=your-telegram-api-key
TELEGRAM_API_KEY=your-telegram-api-key
TWILIO_ACCOUNT_SID=TWILIO_ACCOUNTSID
TWILIO_AUTH_TOKEN=TWILIO_AUTH_TOKEN
20 changes: 10 additions & 10 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ jobs:
SENDGRID_API_KEY: your-sendgrid-api-key
ONESIGNAL_API_KEY: your-onesignal-api-key
TELEGRAM_API_KEY: your-telegram-api-key
TWILIO_ACCOUNT_SID: ACthismusthavethirtyfourcharacters
TWILIO_AUTH_TOKEN: your-twilio-api-key
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use right version of golang
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "^1.19"
go-version: "^1.23.1"
- name: Create service-account file [TODO:REMOVE]
run: |
touch $GOOGLE_APPLICATION_CREDENTIALS
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Execute test
run: go test ./... -coverpkg=./... -coverprofile=c.out
- name: Code Climate Scan
uses: paambaati/codeclimate-action@v3.2.0
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
with:
Expand All @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run Revive Action by pulling pre-built image
uses: docker://morphy/revive-action:v2
- name: Run Revive Action by building from repository
Expand All @@ -73,10 +73,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use right version of golang
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "^1.19"
go-version: "^1.23.1"
- name: Checking if build
run: go build -o ./build/server ./cmd/http/http_server.go
2 changes: 1 addition & 1 deletion .github/workflows/manual_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use right version of golang
uses: actions/setup-go@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ make clean/docker
go mod download

# run server on local
go run ./cmd/http_server.go
go run ./cmd/http/http_server.go

# run test
go test ./... -v -coverpkg=./... -coverprofile=c.out
Expand Down
30 changes: 1 addition & 29 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
api:
build:
Expand All @@ -8,39 +7,12 @@ services:
ports:
- "5001:5001"
command: tail -f /dev/null
environment:
APP_NAME: auth-plus-notification
APP_PORT: 5001
GO_ENV: development
AWS_ACCESS_KEY_ID: YOUR_AKID
AWS_SECRET_ACCESS_KEY: YOUR_SECRET_KEY
AWS_SESSION_TOKEN: TOKEN
GOOGLE_APPLICATION_CREDENTIALS: /app/service-account-file.json
GOOGLE_APPLICATION_NAME: auth-plus-c2b74
MAILGUN_API_KEY: mailgun-api-key
ONESIGNAL_API_KEY: onesignal-api-key
SENDGRID_API_KEY: sendgrid-api-key
TELEGRAM_API_KEY: your-telegram-api-key
env_file: ".env"
volumes:
- .:/app
restart: always
networks:
- notification-net

database:
container_name: postgres
image: postgres:15.1
restart: always
environment:
POSTGRES_PASSWORD: db_password
POSTGRES_USER: root
POSTGRES_DB: notification
ports:
- '5432:5432'
volumes:
- v-database:/var/lib/postgres
networks:
- notification-net

networks:
notification-net:
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ require (
github.com/gin-contrib/cors v1.7.2
github.com/gin-gonic/gin v1.10.0
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
github.com/prometheus/client_golang v1.20.2
github.com/prometheus/client_golang v1.20.4
github.com/segmentio/kafka-go v0.4.47
github.com/stretchr/testify v1.9.0
github.com/twilio/twilio-go v1.22.3
go.opentelemetry.io/otel v1.29.0
go.opentelemetry.io/otel/exporters/zipkin v1.29.0
go.opentelemetry.io/otel/sdk v1.29.0
github.com/twilio/twilio-go v1.23.2
go.opentelemetry.io/otel v1.30.0
go.opentelemetry.io/otel/exporters/zipkin v1.30.0
go.opentelemetry.io/otel/sdk v1.30.0
go.uber.org/zap v1.27.0
golang.org/x/oauth2 v0.22.0
golang.org/x/oauth2 v0.23.0
gopkg.in/h2non/gock.v1 v1.1.2
)

Expand Down Expand Up @@ -62,13 +62,13 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
36 changes: 18 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
Expand All @@ -129,8 +129,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/twilio/twilio-go v1.22.3 h1:u+h5ywaFd2kGO/36PkizX4N/g5q842cjQQcqZqm6rCo=
github.com/twilio/twilio-go v1.22.3/go.mod h1:zRkMjudW7v7MqQ3cWNZmSoZJ7EBjPZ4OpNh2zm7Q6ko=
github.com/twilio/twilio-go v1.23.2 h1:+lQUbXubEtT9eX9ZOLCfNeH4S6IPP2NAtU8BQcAS/t8=
github.com/twilio/twilio-go v1.23.2/go.mod h1:zRkMjudW7v7MqQ3cWNZmSoZJ7EBjPZ4OpNh2zm7Q6ko=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
Expand All @@ -143,16 +143,16 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw=
go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8=
go.opentelemetry.io/otel/exporters/zipkin v1.29.0 h1:rqaUJdM9ItWf6DGrelaShXnJpb8rd3HTbcZWptvcsWA=
go.opentelemetry.io/otel/exporters/zipkin v1.29.0/go.mod h1:wDIyU6DjrUYqUgnmzjWnh1HOQGZCJ6YXMIJCdMc+T9Y=
go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc=
go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8=
go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo=
go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok=
go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4=
go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ=
go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts=
go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc=
go.opentelemetry.io/otel/exporters/zipkin v1.30.0 h1:1uYaSfxiCLdJATlGEtYjQe4jZYfqCjVwxeSTMXe8VF4=
go.opentelemetry.io/otel/exporters/zipkin v1.30.0/go.mod h1:r/4BhMc3kiKxD61wGh9J3NVQ3/cZ45F2NHkQgVnql48=
go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w=
go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ=
go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE=
go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg=
go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc=
go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
Expand Down Expand Up @@ -181,8 +181,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -199,8 +199,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
2 changes: 0 additions & 2 deletions internal/managers/random.email.manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package managers
import (
d "auth-plus-notification/internal/usecases/driven"
"math/rand"
"time"
)

// RandomEmailManager must contains all provider that could be choosen
Expand Down Expand Up @@ -36,6 +35,5 @@ func (e *RandomEmailManager) ChooseProvider(number float64) (d.SendingEmail, err

// GetInput is a function that generate a random number
func (e *RandomEmailManager) GetInput() (float64, error) {
rand.Seed(time.Now().UnixNano())
return rand.Float64(), nil
}
2 changes: 0 additions & 2 deletions internal/managers/random.push_notification.manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package managers
import (
d "auth-plus-notification/internal/usecases/driven"
"math/rand"
"time"
)

// RandomPushNotificationManager must contains all provider that could be choosen
Expand All @@ -30,6 +29,5 @@ func (e *RandomPushNotificationManager) ChooseProvider(number float64) (d.Sendin

// GetInput is a function that generate a random number
func (e *RandomPushNotificationManager) GetInput() (float64, error) {
rand.Seed(time.Now().UnixNano())
return rand.Float64(), nil
}
2 changes: 0 additions & 2 deletions internal/managers/random.sms.manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package managers
import (
d "auth-plus-notification/internal/usecases/driven"
"math/rand"
"time"
)

// RandomSmsManager must contains all provider that could be choosen
Expand All @@ -30,6 +29,5 @@ func (e *RandomSmsManager) ChooseProvider(number float64) (d.SendingSms, error)

// GetInput is a function that generate a random number
func (e *RandomSmsManager) GetInput() (float64, error) {
rand.Seed(time.Now().UnixNano())
return rand.Float64(), nil
}
2 changes: 1 addition & 1 deletion internal/managers/random.telegram.manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewRandomTelegramManager(telegram d.SendingTelegram) *RandomTelegramManager
}

// ChooseProvider is a function for choosing a provider based on a number
func (e *RandomTelegramManager) ChooseProvider(number float64) (d.SendingTelegram, error) {
func (e *RandomTelegramManager) ChooseProvider(_ float64) (d.SendingTelegram, error) {
return e.telegram, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/managers/random.whatsapp.manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewRandomWhatsappManager(twilio d.SendingWhatsapp) *RandomWhatsappManager {
}

// ChooseProvider is a function for choosing a provider based on a number
func (e *RandomWhatsappManager) ChooseProvider(number float64) (d.SendingWhatsapp, error) {
func (e *RandomWhatsappManager) ChooseProvider(_ float64) (d.SendingWhatsapp, error) {
return e.twilio, nil
}

Expand Down
8 changes: 4 additions & 4 deletions internal/providers/firebase.provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ package providers
import (
"auth-plus-notification/config"
"bytes"
"context"
"encoding/json"
"errors"
"io/ioutil"
"io"
"log"
"net/http"

"go.uber.org/zap"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
)

Expand All @@ -24,7 +24,7 @@ type Firebase struct {
// NewFirebase for instanciate a firebase provider
func NewFirebase() *Firebase {
instance := new(Firebase)
client, err := google.DefaultClient(oauth2.NoContext,
client, err := google.DefaultClient(context.Background(),
"https://www.googleapis.com/auth/firebase.messaging")
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -91,7 +91,7 @@ func (e *Firebase) SendPN(deviceID string, title string, content string) error {
}

func (e *Firebase) getError(resp *http.Response) (string, error) {
respBody, errBody := ioutil.ReadAll(resp.Body)
respBody, errBody := io.ReadAll(resp.Body)
if errBody != nil {
return "", errBody
}
Expand Down
4 changes: 2 additions & 2 deletions internal/providers/mailgun.provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"

"go.uber.org/zap"
Expand Down Expand Up @@ -76,7 +76,7 @@ func (e *Mailgun) SendEmail(email string, subject string, content string) error
}

func (e *Mailgun) getError(resp *http.Response) (string, error) {
respBody, errBody := ioutil.ReadAll(resp.Body)
respBody, errBody := io.ReadAll(resp.Body)
if errBody != nil {
return "", errBody
}
Expand Down
8 changes: 4 additions & 4 deletions internal/providers/onesignal.provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewOneSignal() *OneSignal {

type oneSignalEmailPayload struct {
AppID string `json:"app_id"`
Ids [1]string `json:"include_player_ids"`
IDs [1]string `json:"include_player_ids"`
Subject string `json:"email_subject"`
Body string `json:"email_body"`
}
Expand All @@ -62,7 +62,7 @@ type oneSignalPNPayloadContent struct {

type oneSignalPNPayload struct {
AppID string `json:"app_id"`
Ids [1]string `json:"include_player_ids"`
IDs [1]string `json:"include_player_ids"`
Data map[string]interface{} `json:"data"`
Content oneSignalPNPayloadContent `json:"contents"`
}
Expand All @@ -72,8 +72,8 @@ func (e *OneSignal) SendPN(deviceID string, title string, content string) error
idList := [1]string{deviceID}
pnPayload := oneSignalPNPayload{
AppID: e.appID,
Ids: idList,
Data: map[string]interface{}{"foo": "bar"},
IDs: idList,
Data: map[string]interface{}{"title": title, "content": content},
Content: oneSignalPNPayloadContent{En: content},
}

Expand Down
Loading

0 comments on commit 17caf57

Please sign in to comment.