From c2f73a0558600613578652ce8abb96c3f57d55ac Mon Sep 17 00:00:00 2001 From: Taylor Date: Thu, 23 Mar 2023 16:54:42 -0500 Subject: [PATCH 01/45] make mongodb service --- greenlight/greenlight.go | 7 ++++ mongodb/main_test.go | 78 ++++++++++++++++++++++++++++++++++++++++ mongodb/mongodb.go | 55 ++++++++++++++++++++++++++++ mongodb/mongodb_test.go | 1 + signup.go | 8 +++++ 5 files changed, 149 insertions(+) create mode 100644 mongodb/main_test.go create mode 100644 mongodb/mongodb.go create mode 100644 mongodb/mongodb_test.go diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index 078d3c7..8e87534 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -64,6 +64,13 @@ type ( DateTime time.Time `bson:"dateTime"` } `bson:"start"` } + + UserJoinCode struct { + ID string `json:"_id"` + ExpiresAt time.Time `json:"expiresAt"` + UsedAt string `json:"usedAt"` + UserID string `json:"userId"` + } ) // UnmarshalJSON safely handles a GooglePlaces with an empty string value. diff --git a/mongodb/main_test.go b/mongodb/main_test.go new file mode 100644 index 0000000..2970358 --- /dev/null +++ b/mongodb/main_test.go @@ -0,0 +1,78 @@ +package mongodb_test + +import ( + "context" + "fmt" + "log" + "os" + "testing" + + "github.com/ory/dockertest/v3" + "github.com/ory/dockertest/v3/docker" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" +) + +var dbClient *mongo.Client +var dbName = "mongo-test" + +// TestMain will only run if the build tags include "integration". This TestMain will setup a mongoDB instance with dockertest and tear the container down when finished. This setup/teardown process can take 40 seconds or more. +func TestMain(m *testing.M) { + pool, err := dockertest.NewPool("") + if err != nil { + log.Fatalf("Could not connect to docker: %s", err) + } + + // pull mongodb docker image for version 5.0 + resource, err := pool.RunWithOptions(&dockertest.RunOptions{ + Repository: "mongo", + Tag: "5.0", + Env: []string{ + // username and password for mongodb superuser + "MONGO_INITDB_ROOT_USERNAME=root", + "MONGO_INITDB_ROOT_PASSWORD=password", + }, + }, func(config *docker.HostConfig) { + // set AutoRemove to true so that stopped container goes away by itself + config.AutoRemove = true + config.RestartPolicy = docker.RestartPolicy{ + Name: "no", + } + }) + if err != nil { + log.Fatalf("Could not start resource: %s", err) + } + // exponential backoff-retry, because the application in the container might not be ready to accept connections yet + err = pool.Retry(func() error { + var err error + dbClient, err = mongo.Connect( + context.TODO(), + options.Client().ApplyURI( + fmt.Sprintf("mongodb://root:password@localhost:%s", resource.GetPort("27017/tcp")), + ), + ) + if err != nil { + return err + } + return dbClient.Ping(context.TODO(), nil) + }) + + if err != nil { + log.Fatalf("Could not connect to docker: %s", err) + } + + // run tests + code := m.Run() + + // When you're done, kill and remove the container + if err = pool.Purge(resource); err != nil { + log.Fatalf("Could not purge resource: %s", err) + } + + // disconnect mongodb client + if err = dbClient.Disconnect(context.TODO()); err != nil { + panic(err) + } + + os.Exit(code) +} diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go new file mode 100644 index 0000000..3907b9d --- /dev/null +++ b/mongodb/mongodb.go @@ -0,0 +1,55 @@ +package mongodb + +import ( + "context" + "fmt" + "time" + + "github.com/operationspark/service-signup/greenlight" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" +) + +type MongodbService struct { + dbName string + client *mongo.Client +} + +func New(dbName string, client *mongo.Client) *MongodbService { + return &MongodbService{ + dbName: dbName, + client: client, + } +} + +func (m *MongodbService) Create(ctx context.Context, userID, sessionID string) (string, error) { + userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCode") + sessionColl := m.client.Database(m.dbName).Collection("sessions") + + s := sessionColl.FindOne(ctx, bson.M{"_id": sessionID}) + if s.Err() != nil { + return "", fmt.Errorf("findOne: %w", s.Err()) + } + + var session greenlight.Session + if err := s.Decode(&session); err != nil { + return "", fmt.Errorf("decode session: %w", err) + } + + joinData := greenlight.UserJoinCode{ + UserID: userID, + ExpiresAt: session.Times.Start.DateTime.Add(time.Hour * 8), + } + + ior, err := userJoinCodeColl.InsertOne(ctx, joinData) + if err != nil { + return "", fmt.Errorf("insertOne: %w", err) + } + + joinDataID := ior.InsertedID + id, ok := joinDataID.(string) + if !ok { + return "", fmt.Errorf("could not convert join code ID to string: %v", joinDataID) + } + return id, nil +} diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go new file mode 100644 index 0000000..7e7b556 --- /dev/null +++ b/mongodb/mongodb_test.go @@ -0,0 +1 @@ +package mongodb_test diff --git a/signup.go b/signup.go index 5f4c683..990f40e 100644 --- a/signup.go +++ b/signup.go @@ -65,6 +65,12 @@ type ( meetings map[int]string tasks []Task zoomService mutationTask + gldbService codeCreator + } + + // codeCreator creates a join code for a user. + codeCreator interface { + Create(userID, sessionID string) (string, error) } Task interface { @@ -87,6 +93,7 @@ type ( tasks []Task // The Zoom Service needs to mutate the Signup struct with a meeting join URL. Due to this mutation, we need to pull the zoom service out of the task flow and use it before running the tasks. zoomService mutationTask + gldbService codeCreator } Location struct { @@ -282,6 +289,7 @@ func newSignupService(o signupServiceOptions) *SignupService { meetings: o.meetings, tasks: o.tasks, zoomService: o.zoomService, + gldbService: o.gldbService, } } From a547b15c2cec720478830b17b2af0923c59159c6 Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 24 Mar 2023 14:50:22 -0500 Subject: [PATCH 02/45] testing create function --- greenlight/greenlight.go | 10 +++++---- mongodb/mongodb.go | 13 ++++++----- mongodb/mongodb_test.go | 48 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 10 deletions(-) diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index 8e87534..1460d93 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -10,6 +10,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/bsontype" + "go.mongodb.org/mongo-driver/bson/primitive" ) type ( @@ -66,10 +67,11 @@ type ( } UserJoinCode struct { - ID string `json:"_id"` - ExpiresAt time.Time `json:"expiresAt"` - UsedAt string `json:"usedAt"` - UserID string `json:"userId"` + ID primitive.ObjectID `bson:"_id"` // user join code ID + ExpiresAt time.Time `bson:"expiresAt"` // 8 hours after start of session" + UsedAt string `bson:"usedAt"` // "null | Date used" + UserID string `bson:"userId"` // set when user join code is used in greenlight + SessionID string `bson:"sessionId"` // Greenlight session ID } ) diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 3907b9d..82625db 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -7,6 +7,7 @@ import ( "github.com/operationspark/service-signup/greenlight" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" ) @@ -22,7 +23,9 @@ func New(dbName string, client *mongo.Client) *MongodbService { } } -func (m *MongodbService) Create(ctx context.Context, userID, sessionID string) (string, error) { +// Creates a join code document (including SessionID and ExpiresAt) and saves it to the Greenlight database. +// Returns the join code document ID. +func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, error) { userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCode") sessionColl := m.client.Database(m.dbName).Collection("sessions") @@ -37,8 +40,8 @@ func (m *MongodbService) Create(ctx context.Context, userID, sessionID string) ( } joinData := greenlight.UserJoinCode{ - UserID: userID, ExpiresAt: session.Times.Start.DateTime.Add(time.Hour * 8), + SessionID: session.ID, } ior, err := userJoinCodeColl.InsertOne(ctx, joinData) @@ -47,9 +50,7 @@ func (m *MongodbService) Create(ctx context.Context, userID, sessionID string) ( } joinDataID := ior.InsertedID - id, ok := joinDataID.(string) - if !ok { - return "", fmt.Errorf("could not convert join code ID to string: %v", joinDataID) - } + id := joinDataID.(primitive.ObjectID).Hex() + return id, nil } diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index 7e7b556..c7f094f 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -1 +1,49 @@ package mongodb_test + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/operationspark/service-signup/greenlight" + "github.com/operationspark/service-signup/mongodb" + "github.com/stretchr/testify/require" + "go.mongodb.org/mongo-driver/bson" +) + +// test mongodb create function +func TestCreate(t *testing.T) { + // Create a new MongoDB service for testing. + srv := mongodb.New(dbName, dbClient) + + session := greenlight.Session{ + Cohort: "test", + } + + var err error + session.Times.Start.DateTime, err = time.Parse(time.RFC3339, "2023-01-02T15:00:00Z") + require.NoError(t, err) + + s, err := dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), &session) + require.NoError(t, err) + fmt.Printf("%+v\n", s) + fmt.Printf("%+v\n", session) + + joinCodeId, err := srv.Create(context.Background(), session.ID) + require.NoError(t, err) + require.NotEmpty(t, joinCodeId) + fmt.Print(joinCodeId) + + userJoinCodeColl := dbClient.Database(dbName).Collection("userJoinCode") + + joinCode := userJoinCodeColl.FindOne(context.Background(), bson.M{"ID": joinCodeId}) + require.NoError(t, joinCode.Err()) + + var joinCodeDoc greenlight.UserJoinCode + joinCode.Decode(&joinCodeDoc) + + require.Equal(t, session.ID, joinCodeDoc.ID) + // require.Equal(t, ) + +} From af60cc0e2a83fd412ba27399eb2cb53f22c83ae1 Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Fri, 24 Mar 2023 16:09:50 -0400 Subject: [PATCH 03/45] Use randID to create test session IDs --- mongodb/main_test.go | 7 ++++--- mongodb/mongodb_test.go | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/mongodb/main_test.go b/mongodb/main_test.go index 2970358..9b7df7d 100644 --- a/mongodb/main_test.go +++ b/mongodb/main_test.go @@ -45,15 +45,16 @@ func TestMain(m *testing.M) { // exponential backoff-retry, because the application in the container might not be ready to accept connections yet err = pool.Retry(func() error { var err error + dbURL := fmt.Sprintf("mongodb://root:password@localhost:%s", resource.GetPort("27017/tcp")) dbClient, err = mongo.Connect( context.TODO(), - options.Client().ApplyURI( - fmt.Sprintf("mongodb://root:password@localhost:%s", resource.GetPort("27017/tcp")), - ), + options.Client().ApplyURI(dbURL), ) if err != nil { return err } + + fmt.Printf("connected to DB @ %s", dbURL) return dbClient.Ping(context.TODO(), nil) }) diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index c7f094f..e658160 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -3,6 +3,7 @@ package mongodb_test import ( "context" "fmt" + "math/rand" "testing" "time" @@ -18,6 +19,7 @@ func TestCreate(t *testing.T) { srv := mongodb.New(dbName, dbClient) session := greenlight.Session{ + ID: randID(), // Simulate Greenlight IDs (not using ObjectId()) Cohort: "test", } @@ -25,7 +27,7 @@ func TestCreate(t *testing.T) { session.Times.Start.DateTime, err = time.Parse(time.RFC3339, "2023-01-02T15:00:00Z") require.NoError(t, err) - s, err := dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), &session) + s, err := dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), session) require.NoError(t, err) fmt.Printf("%+v\n", s) fmt.Printf("%+v\n", session) @@ -44,6 +46,17 @@ func TestCreate(t *testing.T) { joinCode.Decode(&joinCodeDoc) require.Equal(t, session.ID, joinCodeDoc.ID) - // require.Equal(t, ) } + +// RandID generates a random 17-character string to simulate Meteor's Mongo ID generation. +// Meteor did not originally use Mongo's ObjectID() for document IDs. +func randID() string { + var letters = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + length := 17 + b := make([]rune, length) + for i := range b { + b[i] = letters[rand.Intn(len(letters))] + } + return string(b) +} From 57935d142fce10ea55c2f1b2de4ae2779bd1ab3c Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 24 Mar 2023 15:49:06 -0500 Subject: [PATCH 04/45] create function returns joinCodeId --- greenlight/greenlight.go | 11 +++++------ mongodb/main_test.go | 2 +- mongodb/mongodb_test.go | 23 +++++++++++++---------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index 1460d93..877a659 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -10,7 +10,6 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/bsontype" - "go.mongodb.org/mongo-driver/bson/primitive" ) type ( @@ -67,11 +66,11 @@ type ( } UserJoinCode struct { - ID primitive.ObjectID `bson:"_id"` // user join code ID - ExpiresAt time.Time `bson:"expiresAt"` // 8 hours after start of session" - UsedAt string `bson:"usedAt"` // "null | Date used" - UserID string `bson:"userId"` // set when user join code is used in greenlight - SessionID string `bson:"sessionId"` // Greenlight session ID + // ID primitive.ObjectID `bson:"_id"` // user join code ID + ExpiresAt time.Time `bson:"expiresAt"` // 8 hours after start of session" + UsedAt string `bson:"usedAt"` // "null | Date used" + UserID string `bson:"userId"` // set when user join code is used in greenlight + SessionID string `bson:"sessionId"` // Greenlight session ID } ) diff --git a/mongodb/main_test.go b/mongodb/main_test.go index 9b7df7d..bea62e8 100644 --- a/mongodb/main_test.go +++ b/mongodb/main_test.go @@ -54,7 +54,7 @@ func TestMain(m *testing.M) { return err } - fmt.Printf("connected to DB @ %s", dbURL) + fmt.Printf("connected to DB @ %s\n", dbURL) return dbClient.Ping(context.TODO(), nil) }) diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index e658160..d77d673 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -2,7 +2,6 @@ package mongodb_test import ( "context" - "fmt" "math/rand" "testing" "time" @@ -11,6 +10,7 @@ import ( "github.com/operationspark/service-signup/mongodb" "github.com/stretchr/testify/require" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" ) // test mongodb create function @@ -27,25 +27,28 @@ func TestCreate(t *testing.T) { session.Times.Start.DateTime, err = time.Parse(time.RFC3339, "2023-01-02T15:00:00Z") require.NoError(t, err) - s, err := dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), session) + _, err = dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), session) require.NoError(t, err) - fmt.Printf("%+v\n", s) - fmt.Printf("%+v\n", session) joinCodeId, err := srv.Create(context.Background(), session.ID) require.NoError(t, err) require.NotEmpty(t, joinCodeId) - fmt.Print(joinCodeId) userJoinCodeColl := dbClient.Database(dbName).Collection("userJoinCode") - joinCode := userJoinCodeColl.FindOne(context.Background(), bson.M{"ID": joinCodeId}) - require.NoError(t, joinCode.Err()) + objID, err := primitive.ObjectIDFromHex(joinCodeId) // change string id to mongo ObjectID + require.NoError(t, err) + + joinCodeDoc := userJoinCodeColl.FindOne(context.Background(), bson.M{"_id": objID}) + require.NoError(t, joinCodeDoc.Err()) - var joinCodeDoc greenlight.UserJoinCode - joinCode.Decode(&joinCodeDoc) + var joinCode greenlight.UserJoinCode + joinCodeDoc.Decode(&joinCode) + + wantExpiresAt, err := time.Parse(time.RFC3339, "2023-01-02T23:00:00Z") + require.NoError(t, err) - require.Equal(t, session.ID, joinCodeDoc.ID) + require.Equal(t, wantExpiresAt, joinCode.ExpiresAt) } From 4b94c07a378be880718071f5e14c6e52f5303e2b Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 24 Mar 2023 16:42:36 -0500 Subject: [PATCH 05/45] use create in register function --- .env.sample | 2 ++ function.go | 21 +++++++++++++++++++++ signup.go | 8 +++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index c15c90b..1de6031 100644 --- a/.env.sample +++ b/.env.sample @@ -30,3 +30,5 @@ TWILIO_CONVERSATIONS_SID="[Twilio Conversations SID]" URL_SHORTENER_API_KEY="[Operation Spark URL Shortener API Key]" OS_MESSAGING_SERVICE_URL="[Operation Spark Messenger Service URL (e.g. https://messenger.operationspark.org)]" + +MONGO_URI="mongodb://localhost:27017/greenlight" diff --git a/function.go b/function.go index ee0e9e7..580fca1 100644 --- a/function.go +++ b/function.go @@ -11,6 +11,7 @@ import ( "time" "github.com/GoogleCloudPlatform/functions-framework-go/functions" + "github.com/operationspark/service-signup/mongodb" "github.com/operationspark/service-signup/notify" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" @@ -82,6 +83,18 @@ func checkEnvVars(skip bool) error { return nil } +func getMongoClient() (*mongo.Client, string, error) { + mongoURI := os.Getenv("MONGO_URI") + isCI := os.Getenv("CI") == "true" + parsed, err := url.Parse(mongoURI) + if isCI || (mongoURI == "" || err != nil) { + return nil, "", fmt.Errorf("Invalid 'MONGO_URI' environmental variable: %q\n", mongoURI) + } + dbName := strings.TrimPrefix(parsed.Path, "/") + m, err := mongo.Connect(context.Background(), options.Client().ApplyURI(mongoURI)) + return m, dbName, err +} + func NewNotifyServer() *notify.Server { mongoURI := os.Getenv("MONGO_URI") isCI := os.Getenv("CI") == "true" @@ -160,6 +173,13 @@ func NewSignupServer() *signupServer { conversationsSid: twilioConversationsSid, }) + mongoClient, dbName, err := getMongoClient() + if err != nil { + log.Fatalf("Could not connect to MongoDB: %v", err) + } + + gldbService := mongodb.New(dbName, mongoClient) + registrationService := newSignupService( signupServiceOptions{ meetings: map[int]string{ @@ -168,6 +188,7 @@ func NewSignupServer() *signupServer { }, // registering the user for the Zoom meeting, zoomService: zoomSvc, + gldbService: gldbService, // Registration tasks: // (executed concurrently) tasks: []Task{ diff --git a/signup.go b/signup.go index 990f40e..2a517d7 100644 --- a/signup.go +++ b/signup.go @@ -70,7 +70,7 @@ type ( // codeCreator creates a join code for a user. codeCreator interface { - Create(userID, sessionID string) (string, error) + Create(ctx context.Context, sessionID string) (string, error) } Task interface { @@ -304,6 +304,12 @@ func (sc *SignupService) register(ctx context.Context, su Signup) error { if err != nil { return fmt.Errorf("zoomService.run: %w", err) } + joinCodeID, err := sc.gldbService.Create(ctx, su.SessionID) + if err != nil { + return fmt.Errorf("userJoinCode Create: %w", err) + } + // TODO attach to signup + fmt.Println(joinCodeID) // Run each task in a go routine for concurrent execution g, ctx := errgroup.WithContext(ctx) From bf935cddc53f68db8aa805ad343add4af70623f9 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 14:38:45 -0500 Subject: [PATCH 06/45] give createdAt unixTime type --- greenlight/greenlight.go | 27 ++++++++++++++++++--------- mongodb/mongodb.go | 3 ++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index 877a659..9b1d980 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -35,15 +35,15 @@ type ( } Session struct { - ID string `bson:"_id"` - CreatedAt time.Time `bson:"createdAt"` - Cohort string `bson:"cohort"` - LocationID string `bson:"locationId"` - LocationType string `bson:"locationType"` // TODO: Use enum? - ProgramID string `bson:"programId"` - Name string `bson:"name"` - Students []string `bson:"students"` - Times Times `bson:"times"` // TODO: Check out "inline" struct tag + ID string `bson:"_id"` + CreatedAt UnixTime `bson:"createdAt"` + Cohort string `bson:"cohort"` + LocationID string `bson:"locationId"` + LocationType string `bson:"locationType"` // TODO: Use enum? + ProgramID string `bson:"programId"` + Name string `bson:"name"` + Students []string `bson:"students"` + Times Times `bson:"times"` // TODO: Check out "inline" struct tag } Signup struct { @@ -72,8 +72,17 @@ type ( UserID string `bson:"userId"` // set when user join code is used in greenlight SessionID string `bson:"sessionId"` // Greenlight session ID } + + UnixTime time.Time ) +func (ut *UnixTime) UnmarshalBSONValue(t bsontype.Type, data []byte) error { + rv := bson.RawValue{Type: t, Value: data} + *ut = UnixTime(time.Unix(rv.AsInt64(), 0)) + + return nil +} + // UnmarshalJSON safely handles a GooglePlaces with an empty string value. func (g *GooglePlace) UnmarshalJSON(b []byte) error { var gp GooglePlaceAlias diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 82625db..45c1413 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -9,6 +9,7 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" ) type MongodbService struct { @@ -29,7 +30,7 @@ func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCode") sessionColl := m.client.Database(m.dbName).Collection("sessions") - s := sessionColl.FindOne(ctx, bson.M{"_id": sessionID}) + s := sessionColl.FindOne(ctx, bson.M{"_id": sessionID}, &options.FindOneOptions{Projection: bson.M{"times": 1}}) if s.Err() != nil { return "", fmt.Errorf("findOne: %w", s.Err()) } From de32bb465920adb429994a68b42dd3f3ba7892ba Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 14:44:04 -0500 Subject: [PATCH 07/45] remove createdAt from test session --- notify/info_session_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/notify/info_session_test.go b/notify/info_session_test.go index cafb90b..1245f13 100644 --- a/notify/info_session_test.go +++ b/notify/info_session_test.go @@ -142,7 +142,6 @@ func TestGetUpcomingSessions(t *testing.T) { s := greenlight.Session{ ID: randID(), ProgramID: INFO_SESSION_PROGRAM_ID, - CreatedAt: time.Now(), LocationType: "VIRTUAL", LocationID: locationID, } @@ -292,7 +291,6 @@ func insertFutureSession(t *testing.T, m *MongoService, inFuture time.Duration) s := greenlight.Session{ ID: randID(), ProgramID: INFO_SESSION_PROGRAM_ID, - CreatedAt: time.Now(), LocationType: "HYBRID", LocationID: locationID, } From 2be1ec3e445aae5254c7438efc9c4855c4b9230d Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 15:29:46 -0500 Subject: [PATCH 08/45] testing for params isGmail and greenlighturl --- function.go | 2 +- signup.go | 20 ++++++++++++-------- signup_test.go | 8 +++++++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/function.go b/function.go index 580fca1..00a6093 100644 --- a/function.go +++ b/function.go @@ -175,7 +175,7 @@ func NewSignupServer() *signupServer { mongoClient, dbName, err := getMongoClient() if err != nil { - log.Fatalf("Could not connect to MongoDB: %v", err) + log.Printf("Could not connect to MongoDB: %v", err) } gldbService := mongodb.New(dbName, mongoClient) diff --git a/signup.go b/signup.go index 2a517d7..1910b7f 100644 --- a/signup.go +++ b/signup.go @@ -35,7 +35,9 @@ type ( StartDateTime time.Time `json:"startDateTime,omitempty" schema:"startDateTime"` Token string `json:"token" schema:"token"` // State or country where the person resides. - UserLocation string `json:"userLocation" schema:"userLocation"` + UserLocation string `json:"userLocation" schema:"userLocation"` + + userJoinCode string zoomMeetingID int64 zoomMeetingURL string } @@ -105,13 +107,15 @@ type ( // Request params for the Operation Spark Message Template Renderer service. rendererReqParams struct { - Template osRendererTemplate `json:"template"` - ZoomLink string `json:"zoomLink"` - Date time.Time `json:"date"` - Name string `json:"name"` - LocationType string `json:"locationType"` - Location Location `json:"location"` - JoinCode string `json:"joinCode,omitempty"` + Template osRendererTemplate `json:"template"` + ZoomLink string `json:"zoomLink"` + Date time.Time `json:"date"` + Name string `json:"name"` + LocationType string `json:"locationType"` + Location Location `json:"location"` + JoinCode string `json:"joinCode,omitempty"` + IsGmail bool `json:"isGmail"` + GreenlightURL string `json:"greenlightUrl"` } osRenderer struct { diff --git a/signup_test.go b/signup_test.go index 54d46ee..597fac5 100644 --- a/signup_test.go +++ b/signup_test.go @@ -570,13 +570,14 @@ func TestShortMessagingURL(t *testing.T) { Cell: "555-555-5555", StartDateTime: mustMakeTime(t, time.RFC3339, "2022-03-14T17:00:00.000Z"), Cohort: "is-mar-14-22-12pm", - Email: "yasiin@blackstar.net", + Email: "yasiin@gmail.com", SessionID: "WpkB3jcw6gCw2uEMf", LocationType: "HYBRID", GooglePlace: greenlight.GooglePlace{ Name: "Some Place", Address: "2723 Guess Rd, Durham, NC 27705", }, + userJoinCode: "6421ecaa903dc77763e51829", } wantURLPrefix := "https://sms.operationspark.org/m/" @@ -611,6 +612,10 @@ func TestShortMessagingURL(t *testing.T) { assertEqual(t, gotParams.Location.Line1, "2723 Guess Rd") assertEqual(t, gotParams.Location.CityStateZip, "Durham, NC 27705") assertEqual(t, gotParams.Location.MapURL, "https://www.google.com/maps/place/2723+Guess+Rd%2CDurham%2C+NC+27705") + // should be true because "gmail.com" should be the signup's email address domain + assertEqual(t, gotParams.IsGmail, true) + assertEqual(t, gotParams.GreenlightURL, "https://greenlight.operationspark.org/sessions/WpkB3jcw6gCw2uEMf/?subview=overview&userJoinCode=6421ecaa903dc77763e51829") + }) } @@ -697,4 +702,5 @@ func TestCreateMessageURL(t *testing.T) { require.True(t, bytes.Contains(jsonBytes, []byte(`"locationType":"VIRTUAL"`)), "decoded JSON should contain the VIRTUAL location type") }) + } From cf9923b0f6d35c5c44e8168fd6ea39282022f609 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 15:41:12 -0500 Subject: [PATCH 09/45] add isGmail to req params --- signup.go | 1 + 1 file changed, 1 insertion(+) diff --git a/signup.go b/signup.go index 1910b7f..0a35372 100644 --- a/signup.go +++ b/signup.go @@ -258,6 +258,7 @@ func (su Signup) shortMessagingURL() (string, error) { Name: su.NameFirst, LocationType: su.LocationType, JoinCode: su.JoinCode, + IsGmail: strings.HasSuffix(su.Email, "gmail.com"), Location: Location{ Name: su.GooglePlace.Name, Line1: line1, From 85415999fc2f943249fbfa694b06b2088863a6fe Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 15:48:33 -0500 Subject: [PATCH 10/45] add greenlight url to req params --- signup.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/signup.go b/signup.go index 0a35372..b25514d 100644 --- a/signup.go +++ b/signup.go @@ -252,13 +252,14 @@ func (su Signup) shortMessagingURL() (string, error) { line1, cityStateZip := greenlight.ParseAddress(su.GooglePlace.Address) p := rendererReqParams{ - Template: INFO_SESSION_TEMPLATE, - ZoomLink: su.zoomMeetingURL, - Date: su.StartDateTime, - Name: su.NameFirst, - LocationType: su.LocationType, - JoinCode: su.JoinCode, - IsGmail: strings.HasSuffix(su.Email, "gmail.com"), + Template: INFO_SESSION_TEMPLATE, + ZoomLink: su.zoomMeetingURL, + Date: su.StartDateTime, + Name: su.NameFirst, + LocationType: su.LocationType, + JoinCode: su.JoinCode, + IsGmail: strings.HasSuffix(su.Email, "gmail.com"), + GreenlightURL: fmt.Sprintf("https://greenlight.operationspark.org/sessions/%s/?subview=overview&userJoinCode=%s", su.SessionID, su.userJoinCode), Location: Location{ Name: su.GooglePlace.Name, Line1: line1, From a78b1848dbe61d6d3513dcd653c10972dfdc2dfd Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 15:55:51 -0500 Subject: [PATCH 11/45] add user join code it signup --- signup.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signup.go b/signup.go index b25514d..1daf266 100644 --- a/signup.go +++ b/signup.go @@ -314,8 +314,8 @@ func (sc *SignupService) register(ctx context.Context, su Signup) error { if err != nil { return fmt.Errorf("userJoinCode Create: %w", err) } - // TODO attach to signup - fmt.Println(joinCodeID) + + su.userJoinCode = joinCodeID // Run each task in a go routine for concurrent execution g, ctx := errgroup.WithContext(ctx) From 840ddd853737a3c6b79cb4c55e59b3d1b86a8dcd Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 27 Mar 2023 19:23:53 -0500 Subject: [PATCH 12/45] change collection name to userJoinCodes --- mongodb/mongodb.go | 2 +- mongodb/mongodb_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 45c1413..25e21aa 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -27,7 +27,7 @@ func New(dbName string, client *mongo.Client) *MongodbService { // Creates a join code document (including SessionID and ExpiresAt) and saves it to the Greenlight database. // Returns the join code document ID. func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, error) { - userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCode") + userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCodes") sessionColl := m.client.Database(m.dbName).Collection("sessions") s := sessionColl.FindOne(ctx, bson.M{"_id": sessionID}, &options.FindOneOptions{Projection: bson.M{"times": 1}}) diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index d77d673..85f9ca5 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -34,7 +34,7 @@ func TestCreate(t *testing.T) { require.NoError(t, err) require.NotEmpty(t, joinCodeId) - userJoinCodeColl := dbClient.Database(dbName).Collection("userJoinCode") + userJoinCodeColl := dbClient.Database(dbName).Collection("userJoinCodes") objID, err := primitive.ObjectIDFromHex(joinCodeId) // change string id to mongo ObjectID require.NoError(t, err) From 50809683b53d60968985f55bef21e67d30d0b9b5 Mon Sep 17 00:00:00 2001 From: Taylor Date: Tue, 28 Mar 2023 16:07:45 -0500 Subject: [PATCH 13/45] check decode error --- mongodb/mongodb_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index 85f9ca5..52a4508 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -43,7 +43,8 @@ func TestCreate(t *testing.T) { require.NoError(t, joinCodeDoc.Err()) var joinCode greenlight.UserJoinCode - joinCodeDoc.Decode(&joinCode) + err = joinCodeDoc.Decode(&joinCode) + require.NoError(t, err) wantExpiresAt, err := time.Parse(time.RFC3339, "2023-01-02T23:00:00Z") require.NoError(t, err) From 1b8bce5d4001f4844b1f9c71396953c6e298786c Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Thu, 6 Apr 2023 12:11:36 -0400 Subject: [PATCH 14/45] Server startup log --- cmd/server/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/server/main.go b/cmd/server/main.go index f2e8f2f..023c444 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -20,6 +20,7 @@ func main() { if envPort := os.Getenv("PORT"); envPort != "" { port = envPort } + log.Printf("server starting on port: %s\n", port) if err := funcframework.Start(port); err != nil { log.Fatalf("funcframework.Start: %v\n", err) } From 5e4010b64b1ea5995769f9e93924f26b79f9f10d Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Thu, 6 Apr 2023 12:17:59 -0400 Subject: [PATCH 15/45] Fix tests --- signup_test.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/signup_test.go b/signup_test.go index 597fac5..9efd757 100644 --- a/signup_test.go +++ b/signup_test.go @@ -46,6 +46,12 @@ func (*MockZoomService) name() string { return "mock zoom service" } +type MockGreenlightDBService struct{} + +func (m *MockGreenlightDBService) Create(ctx context.Context, sessionID string) (string, error) { + return "", nil +} + func TestRegisterUser(t *testing.T) { t.Run("triggers an 'Welcome Email'", func(t *testing.T) { signup := Signup{ @@ -64,13 +70,12 @@ func TestRegisterUser(t *testing.T) { }, } - zoomService := &MockZoomService{} - signupService := newSignupService(signupServiceOptions{ tasks: []Task{mailService}, - zoomService: zoomService, + zoomService: &MockZoomService{}, // zoom meeting id for 12 central - meetings: map[int]string{12: "983782"}, + meetings: map[int]string{12: "983782"}, + gldbService: &MockGreenlightDBService{}, }) err := signupService.register(context.Background(), signup) @@ -105,6 +110,7 @@ func TestRegisterUser(t *testing.T) { signupService := newSignupService(signupServiceOptions{ tasks: []Task{mailService}, zoomService: zoomService, + gldbService: &MockGreenlightDBService{}, }) err := signupService.register(context.Background(), signup) @@ -404,11 +410,13 @@ https://oprk.org/kRds5MKvKI` func TestStructToBase64(t *testing.T) { t.Run("serializes a struct to base 64 encoding", func(t *testing.T) { params := rendererReqParams{ - Template: "InfoSession", - ZoomLink: "https://us06web.zoom.us/j/12345678910", - Date: mustMakeTime(t, time.RFC3339, "2022-10-05T17:00:00.000Z"), - Name: "FirstName", - LocationType: "Hybrid", + Template: "InfoSession", + ZoomLink: "https://us06web.zoom.us/j/12345678910", + Date: mustMakeTime(t, time.RFC3339, "2022-10-05T17:00:00.000Z"), + Name: "FirstName", + IsGmail: false, + LocationType: "Hybrid", + GreenlightURL: "https://greenlight.operationspark.org/sessions/kyvYitLoFfTickbP2/?userJoinCode=123415&joinCode=12314", Location: Location{ Name: "Some Place", Line1: "123 Main St", @@ -417,7 +425,7 @@ func TestStructToBase64(t *testing.T) { }, } - want := "eyJ0ZW1wbGF0ZSI6IkluZm9TZXNzaW9uIiwiem9vbUxpbmsiOiJodHRwczovL3VzMDZ3ZWIuem9vbS51cy9qLzEyMzQ1Njc4OTEwIiwiZGF0ZSI6IjIwMjItMTAtMDVUMTc6MDA6MDBaIiwibmFtZSI6IkZpcnN0TmFtZSIsImxvY2F0aW9uVHlwZSI6Ikh5YnJpZCIsImxvY2F0aW9uIjp7Im5hbWUiOiJTb21lIFBsYWNlIiwibGluZTEiOiIxMjMgTWFpbiBTdCIsImNpdHlTdGF0ZVppcCI6IkNpdHksIFN0YXRlIDEyMzQ1IiwibWFwVXJsIjoiaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS9tYXBzL3BsYWNlLzEyMytNYWluK1N0LCtDaXR5LCtTdGF0ZSsxMjM0NSJ9fQ==" + want := "eyJ0ZW1wbGF0ZSI6IkluZm9TZXNzaW9uIiwiem9vbUxpbmsiOiJodHRwczovL3VzMDZ3ZWIuem9vbS51cy9qLzEyMzQ1Njc4OTEwIiwiZGF0ZSI6IjIwMjItMTAtMDVUMTc6MDA6MDBaIiwibmFtZSI6IkZpcnN0TmFtZSIsImxvY2F0aW9uVHlwZSI6Ikh5YnJpZCIsImxvY2F0aW9uIjp7Im5hbWUiOiJTb21lIFBsYWNlIiwibGluZTEiOiIxMjMgTWFpbiBTdCIsImNpdHlTdGF0ZVppcCI6IkNpdHksIFN0YXRlIDEyMzQ1IiwibWFwVXJsIjoiaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS9tYXBzL3BsYWNlLzEyMytNYWluK1N0LCtDaXR5LCtTdGF0ZSsxMjM0NSJ9LCJpc0dtYWlsIjpmYWxzZSwiZ3JlZW5saWdodFVybCI6Imh0dHBzOi8vZ3JlZW5saWdodC5vcGVyYXRpb25zcGFyay5vcmcvc2Vzc2lvbnMva3l2WWl0TG9GZlRpY2tiUDIvP3VzZXJKb2luQ29kZT0xMjM0MTVcdTAwMjZqb2luQ29kZT0xMjMxNCJ9" got, err := params.toBase64() if err != nil { @@ -653,9 +661,7 @@ func TestCreateMessageURL(t *testing.T) { // Decode the base64 encoded data from the generated URL encoded := strings.TrimPrefix(u.Path, "/m/") d := base64.NewDecoder(base64.StdEncoding, strings.NewReader(encoded)) - decodedJson := make([]byte, 420) - n, err := d.Read(decodedJson) - require.Greater(t, n, 0) + decodedJson, err := io.ReadAll(d) require.NoError(t, err) // Unmarshal the decoded JSON into a messaging request params struct From ec61f54c2c6ba547713dc96d8d2ec25bbb86c387 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 6 Apr 2023 16:21:18 +0000 Subject: [PATCH 16/45] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b025991..f0d597c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Session Sign Up Service -![Coverage](https://img.shields.io/badge/Coverage-55.2%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-55.9%25-yellow) When someone signs up for an Info Session on [operationspark.org](https://operationspark.org), this service runs a series of tasks: From 0ae7284051e73db2537a2506a9b12879bdfde981 Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 7 Apr 2023 15:24:23 -0500 Subject: [PATCH 17/45] print error instead of panic --- function.go | 4 ++-- server.go | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/function.go b/function.go index 00a6093..1a6b78b 100644 --- a/function.go +++ b/function.go @@ -88,7 +88,7 @@ func getMongoClient() (*mongo.Client, string, error) { isCI := os.Getenv("CI") == "true" parsed, err := url.Parse(mongoURI) if isCI || (mongoURI == "" || err != nil) { - return nil, "", fmt.Errorf("Invalid 'MONGO_URI' environmental variable: %q\n", mongoURI) + return nil, "", fmt.Errorf("invalid 'MONGO_URI' environmental variable: %q", mongoURI) } dbName := strings.TrimPrefix(parsed.Path, "/") m, err := mongo.Connect(context.Background(), options.Client().ApplyURI(mongoURI)) @@ -175,7 +175,7 @@ func NewSignupServer() *signupServer { mongoClient, dbName, err := getMongoClient() if err != nil { - log.Printf("Could not connect to MongoDB: %v", err) + log.Printf("Could not connect to MongoDB: %v\n", err) } gldbService := mongodb.New(dbName, mongoClient) diff --git a/server.go b/server.go index 1828f8c..83aff39 100644 --- a/server.go +++ b/server.go @@ -38,14 +38,16 @@ func (ss *signupServer) HandleSignUp(w http.ResponseWriter, r *http.Request) { err := handleJson(&su, r.Body) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) - panic(err) + fmt.Fprintf(os.Stderr, "handleJson: %v", err) + return } case "application/x-www-form-urlencoded": err := handleForm(&su, r) if err != nil { http.Error(w, "Error reading Form Body", http.StatusBadRequest) - panic(err) + fmt.Fprintf(os.Stderr, "handleForm: %v", err) + return } default: From 0ca51e1367c5889a1155dcfbac10f327582422b5 Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 7 Apr 2023 16:20:19 -0500 Subject: [PATCH 18/45] send joinCode with join --- greenlight/greenlight.go | 1 + mongodb/mongodb.go | 14 +++++++------- mongodb/mongodb_test.go | 8 +++++--- signup.go | 5 +++-- signup_test.go | 4 ++-- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index 9b1d980..9d944d1 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -44,6 +44,7 @@ type ( Name string `bson:"name"` Students []string `bson:"students"` Times Times `bson:"times"` // TODO: Check out "inline" struct tag + JoinCode string `bson:"code"` } Signup struct { diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 25e21aa..c768fa8 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -25,19 +25,19 @@ func New(dbName string, client *mongo.Client) *MongodbService { } // Creates a join code document (including SessionID and ExpiresAt) and saves it to the Greenlight database. -// Returns the join code document ID. -func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, error) { +// Returns the join code document ID and the session join code. +func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, string, error) { userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCodes") sessionColl := m.client.Database(m.dbName).Collection("sessions") - s := sessionColl.FindOne(ctx, bson.M{"_id": sessionID}, &options.FindOneOptions{Projection: bson.M{"times": 1}}) + s := sessionColl.FindOne(ctx, bson.M{"_id": sessionID}, &options.FindOneOptions{Projection: bson.M{"times": 1, "code": 1}}) if s.Err() != nil { - return "", fmt.Errorf("findOne: %w", s.Err()) + return "", "", fmt.Errorf("findOne: %w", s.Err()) } var session greenlight.Session if err := s.Decode(&session); err != nil { - return "", fmt.Errorf("decode session: %w", err) + return "", "", fmt.Errorf("decode session: %w", err) } joinData := greenlight.UserJoinCode{ @@ -47,11 +47,11 @@ func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, ior, err := userJoinCodeColl.InsertOne(ctx, joinData) if err != nil { - return "", fmt.Errorf("insertOne: %w", err) + return "", "", fmt.Errorf("insertOne: %w", err) } joinDataID := ior.InsertedID id := joinDataID.(primitive.ObjectID).Hex() - return id, nil + return id, session.JoinCode, nil } diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index 52a4508..a1056c0 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -19,8 +19,9 @@ func TestCreate(t *testing.T) { srv := mongodb.New(dbName, dbClient) session := greenlight.Session{ - ID: randID(), // Simulate Greenlight IDs (not using ObjectId()) - Cohort: "test", + ID: randID(), // Simulate Greenlight IDs (not using ObjectId()) + Cohort: "test", + JoinCode: "tlav", } var err error @@ -30,7 +31,7 @@ func TestCreate(t *testing.T) { _, err = dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), session) require.NoError(t, err) - joinCodeId, err := srv.Create(context.Background(), session.ID) + joinCodeId, sessionJoinCode, err := srv.Create(context.Background(), session.ID) require.NoError(t, err) require.NotEmpty(t, joinCodeId) @@ -50,6 +51,7 @@ func TestCreate(t *testing.T) { require.NoError(t, err) require.Equal(t, wantExpiresAt, joinCode.ExpiresAt) + require.Equal(t, session.JoinCode, sessionJoinCode) } diff --git a/signup.go b/signup.go index 1daf266..1726b86 100644 --- a/signup.go +++ b/signup.go @@ -72,7 +72,7 @@ type ( // codeCreator creates a join code for a user. codeCreator interface { - Create(ctx context.Context, sessionID string) (string, error) + Create(ctx context.Context, sessionID string) (string, string, error) } Task interface { @@ -310,12 +310,13 @@ func (sc *SignupService) register(ctx context.Context, su Signup) error { if err != nil { return fmt.Errorf("zoomService.run: %w", err) } - joinCodeID, err := sc.gldbService.Create(ctx, su.SessionID) + joinCodeID, sessionJoinCode, err := sc.gldbService.Create(ctx, su.SessionID) if err != nil { return fmt.Errorf("userJoinCode Create: %w", err) } su.userJoinCode = joinCodeID + su.JoinCode = sessionJoinCode // Run each task in a go routine for concurrent execution g, ctx := errgroup.WithContext(ctx) diff --git a/signup_test.go b/signup_test.go index 9efd757..b50f3b6 100644 --- a/signup_test.go +++ b/signup_test.go @@ -48,8 +48,8 @@ func (*MockZoomService) name() string { type MockGreenlightDBService struct{} -func (m *MockGreenlightDBService) Create(ctx context.Context, sessionID string) (string, error) { - return "", nil +func (m *MockGreenlightDBService) Create(ctx context.Context, sessionID string) (string, string, error) { + return "", "", nil } func TestRegisterUser(t *testing.T) { From 74df755648505ee4c5fb691c0bf30a07f9ebfc4c Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 7 Apr 2023 21:26:12 +0000 Subject: [PATCH 19/45] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0d597c..fc48f53 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Session Sign Up Service -![Coverage](https://img.shields.io/badge/Coverage-55.9%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-55.8%25-yellow) When someone signs up for an Info Session on [operationspark.org](https://operationspark.org), this service runs a series of tasks: From 96a2090188406ff245d2cb11a1456489ed2e7a9f Mon Sep 17 00:00:00 2001 From: Taylor Shephard Date: Mon, 10 Apr 2023 10:59:57 -0500 Subject: [PATCH 20/45] Update greenlight/greenlight.go Co-authored-by: Harvey Sanders --- greenlight/greenlight.go | 1 - 1 file changed, 1 deletion(-) diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index 9d944d1..da9fc15 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -67,7 +67,6 @@ type ( } UserJoinCode struct { - // ID primitive.ObjectID `bson:"_id"` // user join code ID ExpiresAt time.Time `bson:"expiresAt"` // 8 hours after start of session" UsedAt string `bson:"usedAt"` // "null | Date used" UserID string `bson:"userId"` // set when user join code is used in greenlight From 913a201740aa7b41e84063ff7a2632d12ffee147 Mon Sep 17 00:00:00 2001 From: Taylor Shephard Date: Mon, 10 Apr 2023 11:07:19 -0500 Subject: [PATCH 21/45] Update greenlight/greenlight.go Co-authored-by: Harvey Sanders --- greenlight/greenlight.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/greenlight/greenlight.go b/greenlight/greenlight.go index da9fc15..7bb7f96 100644 --- a/greenlight/greenlight.go +++ b/greenlight/greenlight.go @@ -75,7 +75,7 @@ type ( UnixTime time.Time ) - +// UnmarshalBSONValue unmarshals a Unix time (seconds after Jan 1, 1970 00:00 UTC) to `time.Time`. Fields using the UnixTime type were not serialized with the default Mongo ISODate so need custom marshaling/unmarshaling. func (ut *UnixTime) UnmarshalBSONValue(t bsontype.Type, data []byte) error { rv := bson.RawValue{Type: t, Value: data} *ut = UnixTime(time.Unix(rv.AsInt64(), 0)) From 5b6b0f3008b348469432cadf6871bdec687e9cf6 Mon Sep 17 00:00:00 2001 From: Taylor Shephard Date: Mon, 10 Apr 2023 11:07:55 -0500 Subject: [PATCH 22/45] Update mongodb/mongodb_test.go Co-authored-by: Harvey Sanders --- mongodb/mongodb_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index a1056c0..f5bc36c 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -37,7 +37,7 @@ func TestCreate(t *testing.T) { userJoinCodeColl := dbClient.Database(dbName).Collection("userJoinCodes") - objID, err := primitive.ObjectIDFromHex(joinCodeId) // change string id to mongo ObjectID + objID, err := primitive.ObjectIDFromHex(joinCodeId) // change string ID to Mongo ObjectID require.NoError(t, err) joinCodeDoc := userJoinCodeColl.FindOne(context.Background(), bson.M{"_id": objID}) From 4f1c9affe412bf7aae2862f8055d156c2cda1d61 Mon Sep 17 00:00:00 2001 From: Taylor Shephard Date: Mon, 10 Apr 2023 11:08:07 -0500 Subject: [PATCH 23/45] Update signup.go Co-authored-by: Harvey Sanders --- signup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signup.go b/signup.go index 1726b86..244033d 100644 --- a/signup.go +++ b/signup.go @@ -70,7 +70,7 @@ type ( gldbService codeCreator } - // codeCreator creates a join code for a user. + // codeCreator creates a Session join code for a user. codeCreator interface { Create(ctx context.Context, sessionID string) (string, string, error) } From ed4bd68522c871f051ccf520d3201b5bb805470d Mon Sep 17 00:00:00 2001 From: Taylor Shephard Date: Mon, 10 Apr 2023 11:11:22 -0500 Subject: [PATCH 24/45] Update signup.go Co-authored-by: Harvey Sanders --- signup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signup.go b/signup.go index 244033d..94b9253 100644 --- a/signup.go +++ b/signup.go @@ -259,7 +259,7 @@ func (su Signup) shortMessagingURL() (string, error) { LocationType: su.LocationType, JoinCode: su.JoinCode, IsGmail: strings.HasSuffix(su.Email, "gmail.com"), - GreenlightURL: fmt.Sprintf("https://greenlight.operationspark.org/sessions/%s/?subview=overview&userJoinCode=%s", su.SessionID, su.userJoinCode), + GreenlightURL: fmt.Sprintf("%s/sessions/%s/?subview=overview&userJoinCode=%s", greenlightHost, su.SessionID, su.userJoinCode), Location: Location{ Name: su.GooglePlace.Name, Line1: line1, From 09f0d0545bb7d598c178a7cb1dc9a6aef03b5fd9 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 10 Apr 2023 11:27:33 -0500 Subject: [PATCH 25/45] update create function name to CreateUserJoinCode --- mongodb/mongodb.go | 2 +- mongodb/mongodb_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index c768fa8..8b72125 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -26,7 +26,7 @@ func New(dbName string, client *mongo.Client) *MongodbService { // Creates a join code document (including SessionID and ExpiresAt) and saves it to the Greenlight database. // Returns the join code document ID and the session join code. -func (m *MongodbService) Create(ctx context.Context, sessionID string) (string, string, error) { +func (m *MongodbService) CreateUserJoinCode(ctx context.Context, sessionID string) (string, string, error) { userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCodes") sessionColl := m.client.Database(m.dbName).Collection("sessions") diff --git a/mongodb/mongodb_test.go b/mongodb/mongodb_test.go index f5bc36c..96debf0 100644 --- a/mongodb/mongodb_test.go +++ b/mongodb/mongodb_test.go @@ -31,7 +31,7 @@ func TestCreate(t *testing.T) { _, err = dbClient.Database(dbName).Collection("sessions").InsertOne(context.Background(), session) require.NoError(t, err) - joinCodeId, sessionJoinCode, err := srv.Create(context.Background(), session.ID) + joinCodeId, sessionJoinCode, err := srv.CreateUserJoinCode(context.Background(), session.ID) require.NoError(t, err) require.NotEmpty(t, joinCodeId) From 1be9a14aa5b25c1be69480432aa7778635eca781 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 10 Apr 2023 12:09:52 -0500 Subject: [PATCH 26/45] change function name create to createUserJoinCode and set GREENLIGHT_HOST env variable --- signup.go | 6 +++--- signup_test.go | 5 +++-- twilio.go | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/signup.go b/signup.go index 94b9253..3fec315 100644 --- a/signup.go +++ b/signup.go @@ -72,7 +72,7 @@ type ( // codeCreator creates a Session join code for a user. codeCreator interface { - Create(ctx context.Context, sessionID string) (string, string, error) + CreateUserJoinCode(ctx context.Context, sessionID string) (string, string, error) } Task interface { @@ -248,7 +248,7 @@ func (su Signup) shortMessage(infoURL string) (string, error) { // ShortMessagingURL produces a custom URL for use on Operation Spark's SMS Messaging Preview service. // https://github.com/OperationSpark/sms.opspark.org -func (su Signup) shortMessagingURL() (string, error) { +func (su Signup) shortMessagingURL(greenlightHost string) (string, error) { line1, cityStateZip := greenlight.ParseAddress(su.GooglePlace.Address) p := rendererReqParams{ @@ -310,7 +310,7 @@ func (sc *SignupService) register(ctx context.Context, su Signup) error { if err != nil { return fmt.Errorf("zoomService.run: %w", err) } - joinCodeID, sessionJoinCode, err := sc.gldbService.Create(ctx, su.SessionID) + joinCodeID, sessionJoinCode, err := sc.gldbService.CreateUserJoinCode(ctx, su.SessionID) if err != nil { return fmt.Errorf("userJoinCode Create: %w", err) } diff --git a/signup_test.go b/signup_test.go index b50f3b6..a9c58e2 100644 --- a/signup_test.go +++ b/signup_test.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "net/url" + "os" "strings" "testing" "time" @@ -48,7 +49,7 @@ func (*MockZoomService) name() string { type MockGreenlightDBService struct{} -func (m *MockGreenlightDBService) Create(ctx context.Context, sessionID string) (string, string, error) { +func (m *MockGreenlightDBService) CreateUserJoinCode(ctx context.Context, sessionID string) (string, string, error) { return "", "", nil } @@ -591,7 +592,7 @@ func TestShortMessagingURL(t *testing.T) { wantURLPrefix := "https://sms.operationspark.org/m/" // method under test - gotURL, err := s.shortMessagingURL() + gotURL, err := s.shortMessagingURL(os.Getenv("GREENLIGHT_HOST")) if err != nil { t.Fatal(err) } diff --git a/twilio.go b/twilio.go index eb5159c..a66b756 100644 --- a/twilio.go +++ b/twilio.go @@ -123,7 +123,7 @@ func (t *smsService) run(ctx context.Context, su Signup) error { } // create user-specific info session details URL - msgngURL, err := su.shortMessagingURL() + msgngURL, err := su.shortMessagingURL(os.Getenv("GREENLIGHT_HOST")) if err != nil { return fmt.Errorf("shortMessagingURL: %w", err) } From ed92463193e9d162dd9e9ead5ab180f52eb0ae32 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 10 Apr 2023 14:38:28 -0500 Subject: [PATCH 27/45] add greenlight host variable --- .env.sample | 3 +++ .github/workflows/deploy-staging.yml | 1 + .github/workflows/deploy-testing.yml | 1 + .github/workflows/deploy.yml | 1 + 4 files changed, 6 insertions(+) diff --git a/.env.sample b/.env.sample index 1de6031..bf8b73a 100644 --- a/.env.sample +++ b/.env.sample @@ -5,6 +5,8 @@ SLACK_WEBHOOK_URL="[Slack Webhook URL]" # Greenlight API # Where to POST signups for the Greenlight Database GREENLIGHT_WEBHOOK_URL=http://greenlight.operationspark.opg/api/signup +GREENLIGHT_HOST="https://greenlight.operationspark.org/" + # Mailgun API MAIL_DOMAIN=mail.operationspark.org @@ -32,3 +34,4 @@ URL_SHORTENER_API_KEY="[Operation Spark URL Shortener API Key]" OS_MESSAGING_SERVICE_URL="[Operation Spark Messenger Service URL (e.g. https://messenger.operationspark.org)]" MONGO_URI="mongodb://localhost:27017/greenlight" + diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 5e745bc..634c324 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -34,6 +34,7 @@ jobs: MAIL_DOMAIN=${{secrets.MAIL_DOMAIN}}, MAILGUN_API_KEY=${{secrets.MAILGUN_API_KEY}}, GREENLIGHT_WEBHOOK_URL=${{secrets.GREENLIGHT_WEBHOOK_URL}}, + GREENLIGHT_HOST=${{secrets.GREENLIGHT_HOST}}, GREENLIGHT_API_KEY=${{secrets.GREENLIGHT_API_KEY}}, ZOOM_ACCOUNT_ID=${{secrets.ZOOM_ACCOUNT_ID}}, ZOOM_CLIENT_ID=${{secrets.ZOOM_CLIENT_ID}}, diff --git a/.github/workflows/deploy-testing.yml b/.github/workflows/deploy-testing.yml index c7f700e..7527cbb 100644 --- a/.github/workflows/deploy-testing.yml +++ b/.github/workflows/deploy-testing.yml @@ -34,6 +34,7 @@ jobs: MAIL_DOMAIN=${{secrets.MAIL_DOMAIN}}, MAILGUN_API_KEY=${{secrets.MAILGUN_API_KEY}}, GREENLIGHT_WEBHOOK_URL=${{secrets.GREENLIGHT_WEBHOOK_URL}}, + GREENLIGHT_HOST=${{secrets.GREENLIGHT_HOST}}, GREENLIGHT_API_KEY=${{secrets.GREENLIGHT_API_KEY}}, ZOOM_ACCOUNT_ID=${{secrets.ZOOM_ACCOUNT_ID}}, ZOOM_CLIENT_ID=${{secrets.ZOOM_CLIENT_ID}}, diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bd2fdb4..aa55039 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,6 +34,7 @@ jobs: MAIL_DOMAIN=${{secrets.MAIL_DOMAIN}}, MAILGUN_API_KEY=${{secrets.MAILGUN_API_KEY}}, GREENLIGHT_WEBHOOK_URL=${{secrets.GREENLIGHT_WEBHOOK_URL}}, + GREENLIGHT_HOST=${{secrets.GREENLIGHT_HOST}}, GREENLIGHT_API_KEY=${{secrets.GREENLIGHT_API_KEY}}, ZOOM_ACCOUNT_ID=${{secrets.ZOOM_ACCOUNT_ID}}, ZOOM_CLIENT_ID=${{secrets.ZOOM_CLIENT_ID}}, From b1a628ab0ef93c6a0069efe37cb3d98327eb6ee9 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 10 Apr 2023 14:39:24 -0500 Subject: [PATCH 28/45] pass url string into shortMessagingURL func --- signup_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/signup_test.go b/signup_test.go index a9c58e2..2a9e622 100644 --- a/signup_test.go +++ b/signup_test.go @@ -8,7 +8,6 @@ import ( "fmt" "io" "net/url" - "os" "strings" "testing" "time" @@ -592,7 +591,7 @@ func TestShortMessagingURL(t *testing.T) { wantURLPrefix := "https://sms.operationspark.org/m/" // method under test - gotURL, err := s.shortMessagingURL(os.Getenv("GREENLIGHT_HOST")) + gotURL, err := s.shortMessagingURL("https://greenlight.operationspark.org") if err != nil { t.Fatal(err) } From cc44d8fd7d07d0fdd6b81508c495984c428d6a42 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 10 Apr 2023 15:12:57 -0500 Subject: [PATCH 29/45] add branch to workflow_dispatch --- .github/workflows/deploy-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-testing.yml b/.github/workflows/deploy-testing.yml index 7527cbb..31c8ccb 100644 --- a/.github/workflows/deploy-testing.yml +++ b/.github/workflows/deploy-testing.yml @@ -3,6 +3,7 @@ on: push: branches: - "testing" + - "62-support-for-auto-enrollment" jobs: build-deploy-cloud-function: From b03b5fd1fb5d71003f73608e1da68d3d656b5a26 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 10 Apr 2023 15:33:41 -0500 Subject: [PATCH 30/45] add workflow_dispatch --- .github/workflows/deploy-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-testing.yml b/.github/workflows/deploy-testing.yml index 31c8ccb..e353fc1 100644 --- a/.github/workflows/deploy-testing.yml +++ b/.github/workflows/deploy-testing.yml @@ -1,9 +1,9 @@ name: GCP Cloud Functions Deploy (Testing) on: + workflow_dispatch: push: branches: - - "testing" - - "62-support-for-auto-enrollment" + - testing jobs: build-deploy-cloud-function: From ed31cdfd5e317b4f5810c91328215cb39252d8c5 Mon Sep 17 00:00:00 2001 From: Taylor Date: Tue, 11 Apr 2023 10:23:59 -0500 Subject: [PATCH 31/45] use env variable for baseURL --- signup.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/signup.go b/signup.go index 3fec315..2138b7b 100644 --- a/signup.go +++ b/signup.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "os" "strconv" "strings" "time" @@ -273,7 +274,7 @@ func (su Signup) shortMessagingURL(greenlightHost string) (string, error) { return "", fmt.Errorf("structToBase64: %w", err) } - baseURL := "https://sms.operationspark.org" + baseURL := os.Getenv("OS_RENDERING_SERVICE_URL") return fmt.Sprintf("%s/m/%s", baseURL, encoded), nil } From e24c0b6ad1d9c26ddb7c1a2ff39839c900b04840 Mon Sep 17 00:00:00 2001 From: Taylor Date: Tue, 11 Apr 2023 11:20:13 -0500 Subject: [PATCH 32/45] use env variable for basURL --- signup.go | 4 +--- signup_test.go | 5 +++-- twilio.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/signup.go b/signup.go index 2138b7b..6a5c337 100644 --- a/signup.go +++ b/signup.go @@ -5,7 +5,6 @@ import ( "encoding/base64" "encoding/json" "fmt" - "os" "strconv" "strings" "time" @@ -249,7 +248,7 @@ func (su Signup) shortMessage(infoURL string) (string, error) { // ShortMessagingURL produces a custom URL for use on Operation Spark's SMS Messaging Preview service. // https://github.com/OperationSpark/sms.opspark.org -func (su Signup) shortMessagingURL(greenlightHost string) (string, error) { +func (su Signup) shortMessagingURL(greenlightHost, baseURL string) (string, error) { line1, cityStateZip := greenlight.ParseAddress(su.GooglePlace.Address) p := rendererReqParams{ @@ -274,7 +273,6 @@ func (su Signup) shortMessagingURL(greenlightHost string) (string, error) { return "", fmt.Errorf("structToBase64: %w", err) } - baseURL := os.Getenv("OS_RENDERING_SERVICE_URL") return fmt.Sprintf("%s/m/%s", baseURL, encoded), nil } diff --git a/signup_test.go b/signup_test.go index 2a9e622..e97c1db 100644 --- a/signup_test.go +++ b/signup_test.go @@ -591,14 +591,15 @@ func TestShortMessagingURL(t *testing.T) { wantURLPrefix := "https://sms.operationspark.org/m/" // method under test - gotURL, err := s.shortMessagingURL("https://greenlight.operationspark.org") + gotURL, err := s.shortMessagingURL("https://greenlight.operationspark.org", "https://sms.operationspark.org") if err != nil { t.Fatal(err) } // the messaging URL should be prefixed with the passed in base URL if !strings.HasPrefix(gotURL, wantURLPrefix) { - t.Fatalf("URL: %q doesn't have prefix: %q", wantURLPrefix, gotURL) + fmt.Print(wantURLPrefix) + t.Fatalf("URL: %q doesn't have prefix: %q", gotURL, wantURLPrefix) } // grab the encoded info session details from the URL diff --git a/twilio.go b/twilio.go index a66b756..7d41896 100644 --- a/twilio.go +++ b/twilio.go @@ -123,7 +123,7 @@ func (t *smsService) run(ctx context.Context, su Signup) error { } // create user-specific info session details URL - msgngURL, err := su.shortMessagingURL(os.Getenv("GREENLIGHT_HOST")) + msgngURL, err := su.shortMessagingURL(os.Getenv("GREENLIGHT_HOST"), os.Getenv("OS_RENDERING_SERVICE_URL")) if err != nil { return fmt.Errorf("shortMessagingURL: %w", err) } From 45c7bfd666597a7bee0fd8c2b3296ccec4eea430 Mon Sep 17 00:00:00 2001 From: Taylor Date: Tue, 11 Apr 2023 12:49:21 -0500 Subject: [PATCH 33/45] add joinCode to greenlight url --- signup.go | 2 +- signup_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/signup.go b/signup.go index 6a5c337..5043173 100644 --- a/signup.go +++ b/signup.go @@ -259,7 +259,7 @@ func (su Signup) shortMessagingURL(greenlightHost, baseURL string) (string, erro LocationType: su.LocationType, JoinCode: su.JoinCode, IsGmail: strings.HasSuffix(su.Email, "gmail.com"), - GreenlightURL: fmt.Sprintf("%s/sessions/%s/?subview=overview&userJoinCode=%s", greenlightHost, su.SessionID, su.userJoinCode), + GreenlightURL: fmt.Sprintf("%s/sessions/%s/?subview=overview&userJoinCode=%s&joinCode=%s", greenlightHost, su.SessionID, su.userJoinCode, su.JoinCode), Location: Location{ Name: su.GooglePlace.Name, Line1: line1, diff --git a/signup_test.go b/signup_test.go index e97c1db..7ef1215 100644 --- a/signup_test.go +++ b/signup_test.go @@ -586,6 +586,7 @@ func TestShortMessagingURL(t *testing.T) { Address: "2723 Guess Rd, Durham, NC 27705", }, userJoinCode: "6421ecaa903dc77763e51829", + JoinCode: "hqy0", // signup has a joinCode property accessed from the session once it gets to shortMessagingURL } wantURLPrefix := "https://sms.operationspark.org/m/" @@ -623,7 +624,7 @@ func TestShortMessagingURL(t *testing.T) { assertEqual(t, gotParams.Location.MapURL, "https://www.google.com/maps/place/2723+Guess+Rd%2CDurham%2C+NC+27705") // should be true because "gmail.com" should be the signup's email address domain assertEqual(t, gotParams.IsGmail, true) - assertEqual(t, gotParams.GreenlightURL, "https://greenlight.operationspark.org/sessions/WpkB3jcw6gCw2uEMf/?subview=overview&userJoinCode=6421ecaa903dc77763e51829") + assertEqual(t, gotParams.GreenlightURL, "https://greenlight.operationspark.org/sessions/WpkB3jcw6gCw2uEMf/?subview=overview&userJoinCode=6421ecaa903dc77763e51829&joinCode=hqy0") }) } From d8959ac6df8d3592ab91e697ba18ed55ded551a3 Mon Sep 17 00:00:00 2001 From: Taylor Date: Wed, 12 Apr 2023 12:36:54 -0500 Subject: [PATCH 34/45] create user join code if session exists --- signup.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/signup.go b/signup.go index 5043173..f98b65b 100644 --- a/signup.go +++ b/signup.go @@ -309,13 +309,16 @@ func (sc *SignupService) register(ctx context.Context, su Signup) error { if err != nil { return fmt.Errorf("zoomService.run: %w", err) } - joinCodeID, sessionJoinCode, err := sc.gldbService.CreateUserJoinCode(ctx, su.SessionID) - if err != nil { - return fmt.Errorf("userJoinCode Create: %w", err) - } - su.userJoinCode = joinCodeID - su.JoinCode = sessionJoinCode + if su.SessionID != "" { + joinCodeID, sessionJoinCode, err := sc.gldbService.CreateUserJoinCode(ctx, su.SessionID) + if err != nil { + return fmt.Errorf("userJoinCode Create: %w", err) + } + + su.userJoinCode = joinCodeID + su.JoinCode = sessionJoinCode + } // Run each task in a go routine for concurrent execution g, ctx := errgroup.WithContext(ctx) From 669ef0201c3c3a065a9f1e6cf0b42b4686c52a50 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 12 Apr 2023 17:39:08 +0000 Subject: [PATCH 35/45] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc48f53..9ab19cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Session Sign Up Service -![Coverage](https://img.shields.io/badge/Coverage-55.8%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-55.3%25-yellow) When someone signs up for an Info Session on [operationspark.org](https://operationspark.org), this service runs a series of tasks: From a3a7c85ed7b46ed536760834565124f737eb23e2 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 2 Jan 2024 18:48:35 +0000 Subject: [PATCH 36/45] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2efe31d..52a4a14 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Session Sign Up Service -![Coverage](https://img.shields.io/badge/Coverage-56.3%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-56.4%25-yellow) When someone signs up for an Info Session on [operationspark.org](https://operationspark.org), this service runs a series of tasks: From 23665e571c50e399680078207adde9309145d5fd Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Tue, 2 Jan 2024 13:49:53 -0500 Subject: [PATCH 37/45] Update Go runtime version to go121 --- .github/workflows/deploy-staging.yml | 2 +- .github/workflows/deploy-testing.yml | 2 +- .github/workflows/deploy.yml | 2 +- .vscode/settings.json | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 88a3e09..f215834 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -28,7 +28,7 @@ jobs: https_trigger_security_level: "secure-always" project_id: "operationspark-org" region: "us-central1" - runtime: "go119" + runtime: "go121" env_vars: >- SLACK_WEBHOOK_URL=${{secrets.SLACK_WEBHOOK_URL}}, MAIL_DOMAIN=${{secrets.MAIL_DOMAIN}}, diff --git a/.github/workflows/deploy-testing.yml b/.github/workflows/deploy-testing.yml index fc96451..2d3b2b7 100644 --- a/.github/workflows/deploy-testing.yml +++ b/.github/workflows/deploy-testing.yml @@ -29,7 +29,7 @@ jobs: https_trigger_security_level: "secure-always" project_id: "operationspark-org" region: "us-central1" - runtime: "go119" + runtime: "go121" env_vars: >- SLACK_WEBHOOK_URL=${{secrets.SLACK_WEBHOOK_URL}}, MAIL_DOMAIN=${{secrets.MAIL_DOMAIN}}, diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 232fa45..01c1384 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,7 +29,7 @@ jobs: https_trigger_security_level: "secure-always" project_id: "operationspark-org" region: "us-central1" - runtime: "go119" + runtime: "go121" env_vars: >- SLACK_WEBHOOK_URL=${{secrets.SLACK_WEBHOOK_URL}}, MAIL_DOMAIN=${{secrets.MAIL_DOMAIN}}, diff --git a/.vscode/settings.json b/.vscode/settings.json index bea1a61..839d908 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "go.testEnvFile": "${workspaceFolder}/.env.smoke", "cSpell.words": [ "Emptyf", + "gldb", "stretchr" ] } From 3d2a8a89f0e5eeaafc8cef77d1b66fe877d0898e Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Tue, 2 Jan 2024 14:35:59 -0500 Subject: [PATCH 38/45] Fix base64 decoder in signup_test.go --- signup_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signup_test.go b/signup_test.go index c737bc6..2654e55 100644 --- a/signup_test.go +++ b/signup_test.go @@ -746,7 +746,7 @@ func TestCreateMessageURL(t *testing.T) { // Decode the base64 encoded data from the generated URL encoded := strings.TrimPrefix(u.Path, "/m/") - d := base64.NewDecoder(base64.StdEncoding, strings.NewReader(encoded)) + d := base64.NewDecoder(base64.URLEncoding, strings.NewReader(encoded)) jsonBytes, err := io.ReadAll(d) require.NoError(t, err) From 4cf95c85f59a2f05263d82119fb14f75d2c377aa Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Tue, 2 Jan 2024 14:45:09 -0500 Subject: [PATCH 39/45] Update dockertest --- go.mod | 32 +++++++++--------- go.sum | 104 ++++++++++++++++++++++----------------------------------- 2 files changed, 56 insertions(+), 80 deletions(-) diff --git a/go.mod b/go.mod index cc4fe84..54915b8 100644 --- a/go.mod +++ b/go.mod @@ -12,16 +12,16 @@ require ( require ( cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect - github.com/Microsoft/go-winio v0.5.2 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/containerd/continuity v0.3.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/containerd/continuity v0.4.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/docker/cli v20.10.14+incompatible // indirect - github.com/docker/docker v20.10.7+incompatible // indirect + github.com/docker/cli v24.0.7+incompatible // indirect + github.com/docker/docker v24.0.7+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-chi/chi/v5 v5.0.11 // indirect github.com/go-logr/logr v1.4.1 // indirect @@ -35,22 +35,22 @@ require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.5.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/imdario/mergo v0.3.12 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/klauspost/compress v1.17.4 // indirect - github.com/mitchellh/mapstructure v1.4.1 // indirect - github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/term v0.5.0 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/montanaflynn/stats v0.7.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.1.2 // indirect + github.com/opencontainers/runc v1.1.11 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect @@ -60,15 +60,17 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/crypto v0.17.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.15.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.1 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/grpc v1.60.1 // indirect google.golang.org/protobuf v1.32.0 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -81,7 +83,7 @@ require ( github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/ory/dockertest/v3 v3.9.1 + github.com/ory/dockertest/v3 v3.10.0 github.com/stretchr/testify v1.8.4 github.com/twilio/twilio-go v1.16.0 go.mongodb.org/mongo-driver v1.13.1 diff --git a/go.sum b/go.sum index e5930a0..c04579b 100644 --- a/go.sum +++ b/go.sum @@ -605,15 +605,15 @@ cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcP dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/GoogleCloudPlatform/functions-framework-go v1.8.0 h1:T6A2/y11ew21+jYVgM8d6MeLuzBCLIhjuYqPWamNM/8= github.com/GoogleCloudPlatform/functions-framework-go v1.8.0/go.mod h1:KpD6tyJWaVnELorVNG+GgBxCNZSVnyWDIZOtibAfAH0= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= -github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -633,19 +633,17 @@ github.com/brianvoe/gofakeit v3.18.0+incompatible h1:wDOmHc9DLG4nRjUVVaxA+CEglKO github.com/brianvoe/gofakeit v3.18.0+incompatible/go.mod h1:kfwdRA90vvNhPutZWfH7WPaDzUjz+CZFqG+rPkOjGOc= github.com/brianvoe/gofakeit/v6 v6.19.0 h1:g+yJ+meWVEsAmR+bV4mNM/eXI0N+0pZ3D+Mi+G5+YQo= github.com/brianvoe/gofakeit/v6 v6.19.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudevents/sdk-go/v2 v2.14.0 h1:Nrob4FwVgi5L4tV9lhjzZcjYqFVyJzsA56CwPaPfv6s= github.com/cloudevents/sdk-go/v2 v2.14.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= @@ -662,26 +660,22 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/cli v20.10.14+incompatible h1:dSBKJOVesDgHo7rbxlYjYsXe7gPzrTT+/cKQgpDAazg= -github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/docker v20.10.7+incompatible h1:Z6O9Nhsjv+ayUEeI1IojKbYcsGdgYSNqxe1s2MYzUhQ= -github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= +github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -711,7 +705,6 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= @@ -736,8 +729,6 @@ github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhO github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= @@ -872,8 +863,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -913,11 +904,10 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= -github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 h1:rzf0wL0CHVc8CEsgyygG0Mn9CNCCPZqOPaz8RiiHYQk= -github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -927,18 +917,15 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.1.2 h1:2VSZwLx5k/BfsBxMMipG/LYUnmqOD/BPkIVgQUcTlLw= -github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= -github.com/ory/dockertest/v3 v3.9.1 h1:v4dkG+dlu76goxMiTT2j8zV7s4oPPEppKT8K8p2f1kY= -github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= +github.com/opencontainers/runc v1.1.11 h1:9LjxyVlE0BPMRP2wuQDRlHV4941Jp9rc3F0+YKimopA= +github.com/opencontainers/runc v1.1.11/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= +github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= @@ -960,19 +947,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= -github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -987,22 +969,19 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/twilio/twilio-go v1.16.0 h1:NabGDInWQYPFVAz2TPxpjfPFeoDlaB3MIww1PlZU+rM= github.com/twilio/twilio-go v1.16.0/go.mod h1:tdnfQ5TjbewoAu4lf9bMsGvfuJ/QU9gYuv9yx3TSIXU= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= @@ -1126,6 +1105,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1246,12 +1227,9 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1268,14 +1246,12 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1294,12 +1270,9 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1314,6 +1287,7 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1378,7 +1352,6 @@ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1429,6 +1402,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1735,14 +1710,13 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= -gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= +gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= +gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 750382800e21a9830b1b3463cd211380a12dde31 Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Tue, 2 Jan 2024 14:45:19 -0500 Subject: [PATCH 40/45] Update verify-changed-files action version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ea96ff..2168dc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: filename: coverage.out - name: Verify Changed files - uses: tj-actions/verify-changed-files@v9.1 + uses: tj-actions/verify-changed-files@v17 id: verify-changed-files with: files: README.md From 90d0c647f3c25b1bf7d149c7b55095df03a6e4d8 Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Tue, 2 Jan 2024 18:09:46 -0500 Subject: [PATCH 41/45] Shutdown server if DB connection fails --- function.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function.go b/function.go index 496c8b8..efa34f3 100644 --- a/function.go +++ b/function.go @@ -175,7 +175,7 @@ func NewSignupServer() *signupServer { mongoClient, dbName, err := getMongoClient() if err != nil { - log.Printf("Could not connect to MongoDB: %v\n", err) + log.Fatalf("Could not connect to MongoDB: %v\n", err) } gldbService := mongodb.New(dbName, mongoClient) From cc82e0cc06187eed0b4b4b325ae93772b382b457 Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Wed, 3 Jan 2024 12:13:15 -0500 Subject: [PATCH 42/45] Update documentation comments --- mongodb/mongodb.go | 4 ++-- signup.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 8b72125..1de5723 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -24,8 +24,8 @@ func New(dbName string, client *mongo.Client) *MongodbService { } } -// Creates a join code document (including SessionID and ExpiresAt) and saves it to the Greenlight database. -// Returns the join code document ID and the session join code. +// CreateUserJoinCode creates a join code document (including SessionID and ExpiresAt) and saves it to the Greenlight database. +// It returns the join code document ID and the session join code. func (m *MongodbService) CreateUserJoinCode(ctx context.Context, sessionID string) (string, string, error) { userJoinCodeColl := m.client.Database(m.dbName).Collection("userJoinCodes") sessionColl := m.client.Database(m.dbName).Collection("sessions") diff --git a/signup.go b/signup.go index ceb7228..c76a509 100644 --- a/signup.go +++ b/signup.go @@ -370,6 +370,7 @@ func (sc *SignupService) attachZoomMeetingID(su *Signup) error { return nil } +// CreateMessageURL creates a custom URL for use on Operation Spark's SMS Messaging Preview service. func (osm *osRenderer) CreateMessageURL(p notify.Participant) (string, error) { params := rendererReqParams{ Template: INFO_SESSION_TEMPLATE, From f20f074d246a86b8a00830ac7a01bdc5d28f8686 Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Wed, 3 Jan 2024 12:13:35 -0500 Subject: [PATCH 43/45] Remove push trigger for testing branch in deploy-testing workflow --- .github/workflows/deploy-testing.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deploy-testing.yml b/.github/workflows/deploy-testing.yml index 2d3b2b7..4754c9c 100644 --- a/.github/workflows/deploy-testing.yml +++ b/.github/workflows/deploy-testing.yml @@ -1,9 +1,6 @@ name: GCP Cloud Functions Deploy (Testing) on: workflow_dispatch: - push: - branches: - - testing jobs: build-deploy-cloud-function: From daa3d4dde8e8277f427e175183ccbf08d1afc0b7 Mon Sep 17 00:00:00 2001 From: Harvey Sanders Date: Wed, 3 Jan 2024 12:37:29 -0500 Subject: [PATCH 44/45] Ignore mongo error in CI --- function.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/function.go b/function.go index efa34f3..261e50f 100644 --- a/function.go +++ b/function.go @@ -174,7 +174,7 @@ func NewSignupServer() *signupServer { }) mongoClient, dbName, err := getMongoClient() - if err != nil { + if err != nil && os.Getenv("CI") != "true" { log.Fatalf("Could not connect to MongoDB: %v\n", err) } From 34ba9ec3bd844f6afb40dcda1992c32a270a15ef Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 3 Jan 2024 17:39:20 +0000 Subject: [PATCH 45/45] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08b2214..7e1ba4e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Session Sign Up Service -![Coverage](https://img.shields.io/badge/Coverage-56.7%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-56.6%25-yellow) When someone signs up for an Info Session on [operationspark.org](https://operationspark.org), this service runs a series of tasks: