Skip to content

Commit

Permalink
When the name or email of a crew is updated, all user_crew models are…
Browse files Browse the repository at this point in the history
… also updated
  • Loading branch information
deinelieblings committed Jun 21, 2024
1 parent 9d72b40 commit e13f83c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dao/crew.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ func CrewUpdate(ctx context.Context, i *models.CrewUpdate, token *vcapool.Access
return
}
}
if crew.Email != i.Email || crew.Name != i.Name {
filter := bson.D{{Key: "crew_id", Value: i.ID}}
update := bson.D{{Key: "email", Value: i.Email}, {Key: "name", Value: i.Name}}
if err = UserCrewCollection.UpdateMany(ctx, filter, vmdb.UpdateSet(update)); err != nil {
return
}

}
return
}

Expand Down

0 comments on commit e13f83c

Please sign in to comment.