57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"ruben/inventory2/domains/accounts"
|
|
etsy_platform "ruben/inventory2/domains/platforms/etsy"
|
|
"ruben/inventory2/domains/raw_events"
|
|
"ruben/inventory2/logging"
|
|
accounts_api "ruben/inventory2/server/api/accounts"
|
|
auth_api "ruben/inventory2/server/api/auth"
|
|
sse_api "ruben/inventory2/server/api/sse"
|
|
"ruben/inventory2/server/api/webhooks"
|
|
etsy_webhooks "ruben/inventory2/server/api/webhooks/etsy"
|
|
"ruben/inventory2/server/auth"
|
|
"ruben/inventory2/server/sse"
|
|
)
|
|
|
|
func Routes(
|
|
r *gin.RouterGroup,
|
|
logger *logging.Logger,
|
|
auth *auth.Service,
|
|
sq *sse.Queue,
|
|
accts *accounts.Store,
|
|
unp *sse.UpdateNotificationPublisher,
|
|
rawEvents *raw_events.Store,
|
|
etsy *etsy_platform.Platform,
|
|
) {
|
|
auth_api.Routes(
|
|
r.Group("/auth"),
|
|
logger.WithGroup("/auth"),
|
|
auth.GetAuthenticator(),
|
|
)
|
|
sse_api.Routes(
|
|
r.Group("/events", auth.Authenticate()),
|
|
logger.WithGroup("/events"),
|
|
sq,
|
|
)
|
|
accounts_api.Routes(
|
|
r.Group("/accounts", auth.Authenticate()),
|
|
logger.WithGroup("/accounts"),
|
|
accts,
|
|
unp.Group("/accounts"),
|
|
)
|
|
webhooks.Routes(
|
|
r.Group("/webhooks"),
|
|
logger.WithGroup("/webhooks"),
|
|
rawEvents,
|
|
etsy,
|
|
webhooks.Config{
|
|
Etsy: etsy_webhooks.Config{
|
|
OAuthRedirectURIWithAcctIDParam: "/oauth/accounts/:acctID/auth_code",
|
|
},
|
|
},
|
|
)
|
|
}
|