Skip to content

Commit

Permalink
Merge pull request #16 from whyphi/feat/new-user-flag
Browse files Browse the repository at this point in the history
feat: add flag for isNewUser
  • Loading branch information
jinyoungbang authored Mar 7, 2024
2 parents a1c3d9c + cbb3256 commit 204b086
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 204b086

Please sign in to comment.