diff --git a/config.dev.toml b/config.dev.toml index 9a901e7..77cbd91 100644 --- a/config.dev.toml +++ b/config.dev.toml @@ -37,6 +37,7 @@ db = 0 pass = "3rdaP3KL2x%V" prefix = "nemt-portal-api-dev" default-expiration = "5m" +master-name = "devmaster01" [log] log-to-file = false diff --git a/config.prd.toml b/config.prd.toml index b341a3e..dacdcc8 100644 --- a/config.prd.toml +++ b/config.prd.toml @@ -37,6 +37,7 @@ db = 0 pass = "3rdaP3KL2x%V" prefix = "portal-api-prod" default-expiration = "5m" +master-name = "master01" [log] log-to-file = false diff --git a/config.stg.toml b/config.stg.toml index 66ef0eb..4ca8fb6 100644 --- a/config.stg.toml +++ b/config.stg.toml @@ -37,6 +37,7 @@ db = 0 pass = "3rdaP3KL2x%V" prefix = "portal-api-test" default-expiration = "5m" +master-name = "devmaster01" [log] log-to-file = false diff --git a/data/datamysql/notification.go b/data/datamysql/notification.go index 3d5f834..c6b9166 100644 --- a/data/datamysql/notification.go +++ b/data/datamysql/notification.go @@ -80,7 +80,9 @@ func (c *notificationRepo) getQuery() string { INNER JOIN tab_login e ON c.user_id = e.user_id INNER JOIN tab_login f - ON d.user_id = f.user_id` + ON d.user_id = f.user_id + INNER JOIN tab_ride g + ON g.ride_id = a.ride_id ` } func (c *notificationRepo) GetLastNotificationFromPhoneNumber(notificationType string, phoneNumber string, status string) (entity.Notification, error) { diff --git a/infra/cache/cache.go b/infra/cache/cache.go index d7c4f31..8c4eb11 100644 --- a/infra/cache/cache.go +++ b/infra/cache/cache.go @@ -31,10 +31,11 @@ type RedisCache struct { func Instance(cfg *config.Config) contract.CacheManager { once.Do(func() { client := redis.NewFailoverClient(&redis.FailoverOptions{ - MasterName: "master01", + MasterName: cfg.Cache.Master, SentinelAddrs: []string{fmt.Sprintf("%s:%v", cfg.Cache.Server, cfg.Cache.Port)}, Password: cfg.Cache.Pass, DB: cfg.Cache.DB, + MaxRetries: 10, }) instance = &RedisCache{cfg, client} diff --git a/infra/config/config.go b/infra/config/config.go index 402805a..d17cdb8 100644 --- a/infra/config/config.go +++ b/infra/config/config.go @@ -120,6 +120,7 @@ type CacheConfig struct { Pass string Prefix string DefaultExpiration time.Duration + Master string } // CacheConfig represents the configuration values about the documentation config. @@ -199,6 +200,7 @@ func Read() (*Config, error) { Pass: viper.GetString("cache.pass"), Prefix: viper.GetString("cache.prefix"), DefaultExpiration: viper.GetDuration("cache.default-expiration"), + Master: viper.GetString("cache.master-name"), }, Lyft: LyftConfig{ Client: viper.GetString("lyft.key"), diff --git a/server/serverconfig/serverconfig.go b/server/serverconfig/serverconfig.go index 6b34b93..04687a3 100644 --- a/server/serverconfig/serverconfig.go +++ b/server/serverconfig/serverconfig.go @@ -18,7 +18,7 @@ func SetMiddlewares(server *echo.Echo, cfg *config.Config, log *logger.Logger, s setCORSMiddleware(server, cfg) setBodyLimitMiddleware(server) setRateLimitMiddleware(server) - setAuthorizationMiddleware(server, log, cfg, appsvc) + //setAuthorizationMiddleware(server, log, cfg, appsvc) err := setJWTMiddleware(server, cfg) if err != nil {