-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from hypha-dao/migration
migration
- Loading branch information
Showing
24 changed files
with
505 additions
and
586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ test-payloads/ | |
dist/ | ||
daoctl-*.yaml | ||
daoctl-local.yaml | ||
last-doc.tmp | ||
last-doc.tmp | ||
.graph.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
|
||
eos "github.com/eoscanada/eos-go" | ||
"github.com/hypha-dao/daoctl/util" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
"github.com/tidwall/pretty" | ||
) | ||
|
||
var dumpCmd = &cobra.Command{ | ||
Use: "dump [hash]", | ||
Short: "raw dump of the documents json", | ||
Long: "raw dump of the documents json", | ||
Args: cobra.RangeArgs(1, 1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
api := eos.New(viper.GetString("EosioEndpoint")) | ||
ctx := context.Background() | ||
contract := eos.AN(viper.GetString("DAOContract")) | ||
|
||
document, err := util.Get(ctx, api, contract, args[0]) | ||
if err != nil { | ||
return fmt.Errorf("cannot find document with hash: %v %v", args[0], err) | ||
} | ||
|
||
docJson, err := json.Marshal(document) | ||
if err != nil { | ||
return fmt.Errorf("cannot marshall document to JSON: %v %v", args[0], err) | ||
} | ||
|
||
fmt.Println(string(pretty.Color(pretty.Pretty(docJson), nil))) | ||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(dumpCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strconv" | ||
|
||
eos "github.com/eoscanada/eos-go" | ||
"github.com/hypha-dao/daoctl/util" | ||
"github.com/hypha-dao/document-graph/docgraph" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
type period struct { | ||
Proposer eos.AccountName `json:"proposer"` | ||
ProposalType eos.Name `json:"proposal_type"` | ||
ContentGroups []docgraph.ContentGroup `json:"content_groups"` | ||
} | ||
|
||
// Period represents a period of time aligning to a payroll period, typically a week | ||
type Period struct { | ||
PeriodID uint64 `json:"period_id"` | ||
StartTime eos.BlockTimestamp `json:"start_date"` | ||
EndTime eos.BlockTimestamp `json:"end_date"` | ||
Phase string `json:"phase"` | ||
} | ||
|
||
var fixCmd = &cobra.Command{ | ||
Use: "fix", | ||
Short: "fix a document - admin only", | ||
|
||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
||
ctx := context.Background() | ||
api := getAPI() | ||
contract := eos.AN(viper.GetString("DAOContract")) | ||
|
||
gc, err := util.GetCache(ctx, api, contract) | ||
if err != nil { | ||
return fmt.Errorf("cannot get cache: %v", err) | ||
} | ||
fmt.Println("Number of items in the cache: " + strconv.Itoa(gc.Cache.ItemCount())) | ||
return nil | ||
}, | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(fixCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.