ソースを参照

Code cleanup

master
Jared 1年前
コミット
2fae115b2d
9個のファイルの変更23行の追加26行の削除
  1. +3
    -2
      auth/auth.go
  2. +3
    -2
      endpoints/contribute.go
  3. +2
    -1
      endpoints/escalateprivileges.go
  4. +3
    -2
      endpoints/getbalance.go
  5. +3
    -2
      endpoints/getqueues.go
  6. +3
    -2
      endpoints/register.go
  7. +3
    -2
      endpoints/users.go
  8. +0
    -11
      helpers.go
  9. +3
    -2
      main.go

+ 3
- 2
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 {


+ 3
- 2
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 {


+ 2
- 1
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 {


+ 3
- 2
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 {


+ 3
- 2
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)


+ 3
- 2
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 (


+ 3
- 2
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)



+ 0
- 11
helpers.go ファイルの表示

@@ -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
}

+ 3
- 2
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)


読み込み中…
キャンセル
保存