B: Formatting

This commit is contained in:
Preston Baxter 2023-11-18 20:16:44 -06:00
parent 920e203b9d
commit 46f9460a37
8 changed files with 23 additions and 25 deletions

View File

@ -28,7 +28,7 @@ var (
type actionFunc func(*gin.Context, *webhooks.EventDelivery) error
func userIdFromContext(c *gin.Context) (*primitive.ObjectID) {
func userIdFromContext(c *gin.Context) *primitive.ObjectID {
if id, ok := c.Get("user_bson_id"); !ok {
userId := c.Param("userid")

View File

@ -68,7 +68,7 @@ func (api *PcoApiClient) CreateSubscriptions(subscriptions []webhooks.Subscripti
}
// Posts subcription to PCO api and updates the subscription at the pointer that was passed to the fuinction with the server response
func (api *PcoApiClient) CreateSubscription(subscription *webhooks.Subscription) (error) {
func (api *PcoApiClient) CreateSubscription(subscription *webhooks.Subscription) error {
api.Url().Path = "/webhook/v2/subscriptions"
body := bytes.NewBuffer([]byte{})
@ -91,7 +91,6 @@ func (api *PcoApiClient) CreateSubscription(subscription *webhooks.Subscription)
return fmt.Errorf("Failed to retrieve plan with status code: %d", resp.StatusCode)
}
err = jsonapi.UnmarshalPayload(resp.Body, subscription)
if err != nil {
return err

View File

@ -22,7 +22,6 @@ func (db *DB) FindAuditTrailForUser(userId primitive.ObjectID) ([]models.EventRe
wg.Add(2)
errs := make([]error, 2)
events := []models.EventRecieved{}
actions := []models.ActionTaken{}

View File

@ -3,8 +3,8 @@ package models
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
"git.preston-baxter.com/Preston_PLB/capstone/webhook-service/vendors/pco/webhooks"
"go.mongodb.org/mongo-driver/bson/primitive"
)
const PCO_SUBSCRIPTION_TYPE = "pco_subscription"

View File

@ -37,7 +37,7 @@ func (db *DB) FindPcoSubscriptionForUser(userId primitive.ObjectID, eventName st
// Okay so learned something here. Interfaces are determined implemented for the type a method is related to.
// This function is not implemented for DB it is implemented for *DB and that is important
func (db *DB) SaveSubscriptionsForUser(userId primitive.ObjectID, subscriptions ...webhooks.Subscription) (error) {
func (db *DB) SaveSubscriptionsForUser(userId primitive.ObjectID, subscriptions ...webhooks.Subscription) error {
mods := make([]*models.PcoSubscription, 0, len(subscriptions))
for _, sub := range subscriptions {
mods = append(mods, &models.PcoSubscription{