feat
- command handlers
This commit is contained in:
1 parent
3673d318a1
commit
213562956c
6 files changed
+249
-1
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package mock
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"spellbook/internal/adapters/caster"
|
||||
"spellbook/internal/models"
|
||||
)
|
||||
|
||||
var testSpell = models.Spell{
|
||||
Id: 0,
|
||||
Name: "test",
|
||||
Spell: "curl {{.target}}",
|
||||
ShortDesc: "test spell",
|
||||
Tags: []string{"tag1", "tag2", "tag3"},
|
||||
}
|
||||
|
||||
type Application struct{}
|
||||
|
||||
func (a *Application) AddSpell(_ context.Context, spell models.Spell) error {
|
||||
fmt.Println("TEST - AddSpell", spell)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *Application) GetSpell(_ context.Context, spellName string) (models.Spell, error) {
|
||||
fmt.Println("TEST - GetSpell", spellName)
|
||||
return testSpell, nil
|
||||
}
|
||||
|
||||
func (a *Application) GetSpells(_ context.Context, query models.SearchQuery) ([]models.Spell, error) {
|
||||
fmt.Println("TEST - GetSpells", query)
|
||||
|
||||
return []models.Spell{
|
||||
testSpell,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *Application) DeleteSpell(_ context.Context, spellName string) error {
|
||||
fmt.Println("TEST - DeleteSpell", spellName)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *Application) CastSpell(ctx context.Context, spellCast models.SpellCast) (models.CastResult, error) {
|
||||
fmt.Println("TEST - CastSpell")
|
||||
return (&caster.SpellCaster{}).Cast(ctx, spellCast)
|
||||
}
|
||||
Reference in new issue
Block a user