Token and session implementation with Redis
This commit is contained in:
@@ -36,6 +36,20 @@ func (r *TableRepository) GetByID(ctx context.Context, id uuid.UUID) (*entities.
|
||||
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").
|
||||
Preload("Order").
|
||||
Where("token = ?", token).
|
||||
First(&table).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &table, nil
|
||||
}
|
||||
|
||||
func (r *TableRepository) GetByOutletID(ctx context.Context, outletID uuid.UUID) ([]entities.Table, error) {
|
||||
var tables []entities.Table
|
||||
err := r.db.WithContext(ctx).
|
||||
|
||||
Reference in New Issue
Block a user