Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiKaestle committed Jan 19, 2024
1 parent e047e82 commit 62ad38d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dao/role_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ func RoleHistoryBulkInsert(ctx context.Context, i *models.RoleHistoryBulkRequest
}
userRoleHistory := new(models.RoleHistoryDatabase)
result.Users = append(result.Users, models.ExportRole{UserID: user.ID, Role: role.Role})
history_filter := bson.D{{Key: "user_id", Value: user.ID}, {Key: "role", Value: role.Role}, {Key: "end_date", Value: int64(0)}, {Key: "crew_id", Value: i.CrewID}, {Key: "confirmed", Value: false}}

if err = PoolRoleHistoryCollection.FindOne(ctx, bson.D{{Key: "user_id", Value: user.ID}, {Key: "role", Value: role.Role}, {Key: "end_date", Value: int64(0)}, {Key: "crew_id", Value: i.CrewID}, {Key: "confirmed", Value: false}}, userRoleHistory); err != nil {
if err = PoolRoleHistoryCollection.FindOne(ctx, history_filter, userRoleHistory); err != nil {
if err = PoolRoleHistoryCollection.InsertOne(ctx, role.NewRoleHistory(user)); err != nil {
return
}
Expand Down Expand Up @@ -114,7 +115,7 @@ func RoleHistoryDelete(ctx context.Context, i *models.RoleHistoryRequest, token

func RoleHistoryFromRoles(ctx context.Context) (err error) {
roles := new([]vmod.Role)
PoolRoleCollection.Find(ctx, bson.D{}, roles)
PoolRoleCollection.Find(ctx, bson.D{{}}, roles)

for _, role := range *roles {
user := new(models.User)
Expand Down

0 comments on commit 62ad38d

Please sign in to comment.