mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
added migration route
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"wallet-api/pkg/middleware"
|
||||
"wallet-api/pkg/services"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -15,6 +16,7 @@ func NewApiController(as *services.ApiService, s *gin.RouterGroup) *ApiControlle
|
||||
ac.ApiService = as
|
||||
|
||||
s.GET("", ac.getFirst)
|
||||
s.POST("migrate", middleware.Auth, ac.postMigrate)
|
||||
|
||||
return ac
|
||||
}
|
||||
@@ -23,3 +25,13 @@ func (ac *ApiController) getFirst(c *gin.Context) {
|
||||
apiModel := ac.ApiService.GetFirst()
|
||||
c.JSON(200, apiModel)
|
||||
}
|
||||
|
||||
func (ac *ApiController) postMigrate(c *gin.Context) {
|
||||
mr, er := ac.ApiService.PostMigrate()
|
||||
|
||||
if er.Message != "" {
|
||||
c.JSON(er.StatusCode, er)
|
||||
} else {
|
||||
c.JSON(200, mr)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user