Refactor router and storage
* Split and extract data-logic from application level * Move storage to DeeSee package * Move router into internal package * Fix Makefile * Fix documentation * Fix tests
This commit is contained in:
@@ -3,6 +3,7 @@ package deesee
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/eslider/superherohub/pkg/people"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
@@ -52,6 +53,12 @@ func (s *Superhero) Has(power string) bool {
|
||||
return s.SuperPowers.Contains(power)
|
||||
}
|
||||
|
||||
// Decode JSON superhero
|
||||
func (s *Superhero) Decode(reader io.Reader) (err error) {
|
||||
err = json.NewDecoder(reader).Decode(s)
|
||||
return
|
||||
}
|
||||
|
||||
// IsAcceptable checks if the given power is allowed.
|
||||
func IsAcceptable(power string) bool {
|
||||
for _, p := range allowedSuperPowers {
|
||||
|
||||
Reference in New Issue
Block a user