diff --git a/auth/auth.go b/auth/auth.go index 2437c93..58274d3 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -2,10 +2,11 @@ package auth import ( "fmt" - "github.com/golang-jwt/jwt/v4" - "github.com/spf13/viper" "net/http" "strings" + + "github.com/golang-jwt/jwt/v4" + "github.com/spf13/viper" ) type Claims struct { diff --git a/endpoints/contribute.go b/endpoints/contribute.go index 18f20d3..4011288 100644 --- a/endpoints/contribute.go +++ b/endpoints/contribute.go @@ -3,14 +3,15 @@ package endpoints import ( "encoding/json" "fmt" + "net/http" + "strings" + . "github.com/imosed/signet/data" "github.com/stellar/go/clients/horizonclient" "github.com/stellar/go/keypair" "github.com/stellar/go/network" "github.com/stellar/go/protocols/horizon" "github.com/stellar/go/txnbuild" - "net/http" - "strings" ) type ContributeRequest struct { diff --git a/endpoints/escalateprivileges.go b/endpoints/escalateprivileges.go index afc6c98..11e212a 100644 --- a/endpoints/escalateprivileges.go +++ b/endpoints/escalateprivileges.go @@ -2,9 +2,10 @@ package endpoints import ( "encoding/json" + "net/http" + "github.com/imosed/signet/auth" . "github.com/imosed/signet/data" - "net/http" ) type EscalatePrivilegesRequest struct { diff --git a/endpoints/getbalance.go b/endpoints/getbalance.go index c3d064d..4dc86c9 100644 --- a/endpoints/getbalance.go +++ b/endpoints/getbalance.go @@ -2,11 +2,12 @@ package endpoints import ( "encoding/json" + "net/http" + "strconv" + "github.com/stellar/go/clients/horizonclient" "github.com/stellar/go/keypair" "github.com/stellar/go/protocols/horizon" - "net/http" - "strconv" ) type GetBalanceRequest struct { diff --git a/endpoints/getqueues.go b/endpoints/getqueues.go index 3e0a190..562eca6 100644 --- a/endpoints/getqueues.go +++ b/endpoints/getqueues.go @@ -2,15 +2,16 @@ package endpoints import ( "encoding/json" - . "github.com/imosed/signet/data" "net/http" + + . "github.com/imosed/signet/data" ) type GetQueuesResponse struct { Queues []Queue `json:"queues"` } -func GetQueues(w http.ResponseWriter, r *http.Request) { +func GetQueues(w http.ResponseWriter, _ *http.Request) { var resp GetQueuesResponse Db.Table("queues").Scan(&resp.Queues) diff --git a/endpoints/register.go b/endpoints/register.go index 1898330..068554c 100644 --- a/endpoints/register.go +++ b/endpoints/register.go @@ -7,12 +7,13 @@ import ( "encoding/json" "errors" "fmt" + "net/http" + "strings" + "github.com/imosed/signet/auth" . "github.com/imosed/signet/data" "github.com/spf13/viper" "golang.org/x/crypto/argon2" - "net/http" - "strings" ) const ( diff --git a/endpoints/users.go b/endpoints/users.go index c0740da..8c8b9ed 100644 --- a/endpoints/users.go +++ b/endpoints/users.go @@ -2,11 +2,12 @@ package endpoints import ( "encoding/json" - . "github.com/imosed/signet/data" "net/http" + + . "github.com/imosed/signet/data" ) -func UsersExist(w http.ResponseWriter, r *http.Request) { +func UsersExist(w http.ResponseWriter, _ *http.Request) { var numUsers int64 Db.Table("users").Count(&numUsers) diff --git a/helpers.go b/helpers.go deleted file mode 100644 index 4b5bd15..0000000 --- a/helpers.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import "github.com/imosed/signet/data" - -func SumContributions(contributions []data.Contribution) (sum float64) { - total := 0.0 - for _, contribution := range contributions { - total += contribution.Amount - } - return total -} diff --git a/main.go b/main.go index 718b506..2c8c03c 100644 --- a/main.go +++ b/main.go @@ -2,11 +2,12 @@ package main import ( "fmt" + "net/http" + "github.com/gorilla/mux" "github.com/imosed/signet/data" "github.com/imosed/signet/endpoints" "github.com/spf13/viper" - "net/http" ) var err error @@ -36,7 +37,7 @@ func main() { router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers) router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund) router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund) - //router.HandleFunc("/SubmitFund", endpoints.SubmitFund) + // router.HandleFunc("/SubmitFund", endpoints.SubmitFund) router.HandleFunc("/GetBalance", endpoints.GetBalance) router.HandleFunc("/Contribute", endpoints.Contribute) router.HandleFunc("/ContributorStream", endpoints.ContributorStream)