implemented wallet headers

This commit is contained in:
Fran Jurmanović
2021-06-10 00:13:35 +02:00
parent 636a367d3e
commit 0fc69a0af2
7 changed files with 113 additions and 7 deletions

View File

@@ -0,0 +1,35 @@
package controllers
import (
"wallet-api/pkg/models"
"wallet-api/pkg/services"
"github.com/gin-gonic/gin"
)
type WalletsHeaderController struct {
WalletService *services.WalletService
}
func NewWalletsHeaderController(as *services.WalletService, s *gin.RouterGroup) *WalletsHeaderController {
wc := new(WalletsHeaderController)
wc.WalletService = as
s.GET("", wc.Get)
return wc
}
func (wc *WalletsHeaderController) Get(c *gin.Context) {
body := new(models.Auth)
embed, _ := c.GetQuery("embed")
walletId, _ := c.GetQuery("walletId")
auth := c.MustGet("auth")
body.Id = auth.(*models.Auth).Id
wm := wc.WalletService.GetHeader(body, embed, walletId)
c.JSON(200, wm)
}