diff --git a/cmd/main.go b/cmd/main.go index 2c0c009..ca04744 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -49,6 +49,7 @@ func main() { e.POST("/create", controllers.CreateUserController{}.CreateUser) e.POST("/addinvoice", controllers.AddInvoiceController{}.AddInvoice, middleware.JWT([]byte("secret"))) e.POST("/payinvoice", controllers.PayInvoiceController{}.PayInvoice, middleware.JWT([]byte("secret"))) + e.GET("/gettxs", controllers.GetTXSController{}.GetTXS, middleware.JWT([]byte("secret"))) e.GET("/checkpayment/:payment_hash", controllers.CheckPaymentController{}.CheckPayment, middleware.JWT([]byte("secret"))) e.GET("/balance", controllers.BalanceController{}.Balance, middleware.JWT([]byte("secret"))) diff --git a/pkg/controllers/gettxs.ctrl.go b/pkg/controllers/gettxs.ctrl.go new file mode 100644 index 0000000..a057015 --- /dev/null +++ b/pkg/controllers/gettxs.ctrl.go @@ -0,0 +1,15 @@ +package controllers + +import ( + "github.com/bumi/lndhub.go/pkg/database/models" + "github.com/labstack/echo/v4" + "net/http" +) + +// GetTXSController : GetTXSController struct +type GetTXSController struct{} + +// GetTXS : Get TXS Controller +func (GetTXSController) GetTXS(c echo.Context) error { + return c.JSON(http.StatusOK, &models.Invoice{}) +} diff --git a/pkg/database/models/invoice.go b/pkg/database/models/invoice.go index f04917c..0f618f5 100644 --- a/pkg/database/models/invoice.go +++ b/pkg/database/models/invoice.go @@ -4,17 +4,17 @@ import "time" // Invoice : Invoice Model type Invoice struct { - ID uint `gorm:"primary_key"` - Type string - UserID uint - TransactionEntryID uint - Amount uint - Memo string - DescriptionHash string - PaymentRequest string - RHash string - State string - CreatedAt time.Time - UpdatedAt time.Time - SettledAt time.Time + ID uint `gorm:"primary_key" json:"id"` + Type string `json:"type"` + UserID uint `json:"user_id"` + TransactionEntryID uint `json:"transaction_entry_id"` + Amount uint `json:"amount"` + Memo string `json:"memo"` + DescriptionHash string `json:"description_hash"` + PaymentRequest string `json:"payment_request"` + RHash string `json:"r_hash"` + State string `json:"state"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + SettledAt time.Time `json:"settled_at"` }