Skip to content

Commit

Permalink
Add user validation on dial creation
Browse files Browse the repository at this point in the history
  • Loading branch information
benbjohnson committed Jan 30, 2021
1 parent 030fcb0 commit daadc79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sqlite/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,11 @@ func createDial(ctx context.Context, tx *Tx, dial *wtf.Dial) error {
dial.CreatedAt = tx.now
dial.UpdatedAt = dial.CreatedAt

// Perform basic field validation.
// Perform basic field validation & ensure user exists.
if err := dial.Validate(); err != nil {
return err
} else if _, err := findUserByID(ctx, tx, dial.UserID); err != nil {
return err
}

// Insert row into database.
Expand Down

0 comments on commit daadc79

Please sign in to comment.