Self Order
This commit is contained in:
@@ -170,3 +170,16 @@ func (r *TableRepository) GetByOrderID(ctx context.Context, orderID uuid.UUID) (
|
||||
}
|
||||
return &table, nil
|
||||
}
|
||||
|
||||
func (r *TableRepository) GetByToken(ctx context.Context, token string) (*entities.Table, error) {
|
||||
var table entities.Table
|
||||
err := r.db.WithContext(ctx).
|
||||
Preload("Organization").
|
||||
Preload("Outlet").
|
||||
Where("token = ? AND is_active = ?", token, true).
|
||||
First(&table).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &table, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user