Self Order

This commit is contained in:
2026-05-04 16:23:29 +07:00
parent 2c76962959
commit b993da898f
16 changed files with 443 additions and 3 deletions
@@ -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
}