Self Order
This commit is contained in:
@@ -138,3 +138,15 @@ func (r *CustomerRepository) GetByEmail(ctx context.Context, email string, organ
|
||||
}
|
||||
return &customer, nil
|
||||
}
|
||||
|
||||
func (r *CustomerRepository) GetByPhoneNumber(ctx context.Context, phoneNumber string) (*entities.Customer, error) {
|
||||
var customer entities.Customer
|
||||
err := r.db.WithContext(ctx).Where("phone_number = ?", phoneNumber).First(&customer).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return &customer, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user