diff --git a/main.go b/main.go index 16e1eb7..864cd5e 100644 --- a/main.go +++ b/main.go @@ -13,8 +13,9 @@ import ( ) type User struct { - Name string `yaml:"name"` - Email string `yaml:"email"` + Name string `yaml:"name"` + Email string `yaml:"email"` + IsNewUser bool `json:"isNewUser" bson:"isNewUser"` } type UsersData struct { diff --git a/mongodb.go b/mongodb.go index 9276b1e..cc95972 100644 --- a/mongodb.go +++ b/mongodb.go @@ -11,6 +11,7 @@ import ( // Function to insert a user into MongoDB func insertUser(client *mongo.Client, user User) error { collection := client.Database("vault").Collection("users") + user.IsNewUser = true _, err := collection.InsertOne(context.Background(), user) if err != nil { log.Printf("Error inserting user: %v", err)