mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
fixed code documentation
This commit is contained in:
@@ -11,7 +11,16 @@ type ApiController struct {
|
||||
ApiService *services.ApiService
|
||||
}
|
||||
|
||||
// Initializes ApiController.
|
||||
/*
|
||||
NewApiController
|
||||
|
||||
Initializes ApiController.
|
||||
Args:
|
||||
*services.ApiService: API service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*ApiController: Controller for "api" interactions
|
||||
*/
|
||||
func NewApiController(as *services.ApiService, s *gin.RouterGroup) *ApiController {
|
||||
ac := new(ApiController)
|
||||
ac.ApiService = as
|
||||
@@ -22,15 +31,25 @@ func NewApiController(as *services.ApiService, s *gin.RouterGroup) *ApiControlle
|
||||
return ac
|
||||
}
|
||||
|
||||
/*
|
||||
getFirst
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /api).
|
||||
func (ac *ApiController) getFirst(c *gin.Context) {
|
||||
apiModel := ac.ApiService.GetFirst(c)
|
||||
c.JSON(200, apiModel)
|
||||
}
|
||||
|
||||
/*
|
||||
postMigrate
|
||||
|
||||
Requires "SECRET_CODE", "VERSION" (optional) from body.
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /api/migrate).
|
||||
//
|
||||
// Requires "SECRET_CODE", "VERSION" (optional) from body.
|
||||
func (ac *ApiController) postMigrate(c *gin.Context) {
|
||||
migrateModel := c.MustGet("migrate")
|
||||
version := migrateModel.(middleware.SecretCodeModel).Version
|
||||
|
||||
@@ -13,7 +13,16 @@ type AuthController struct {
|
||||
UsersService *services.UsersService
|
||||
}
|
||||
|
||||
// Initializes AuthController.
|
||||
/*
|
||||
NewAuthController
|
||||
|
||||
Initializes AuthController.
|
||||
Args:
|
||||
*services.UsersService: Users service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*AuthController: Controller for "auth" interactions
|
||||
*/
|
||||
func NewAuthController(rs *services.UsersService, s *gin.RouterGroup) *AuthController {
|
||||
rc := new(AuthController)
|
||||
rc.UsersService = rs
|
||||
@@ -26,6 +35,11 @@ func NewAuthController(rs *services.UsersService, s *gin.RouterGroup) *AuthContr
|
||||
return rc
|
||||
}
|
||||
|
||||
/*
|
||||
PostLogin
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /auth/login).
|
||||
func (rc *AuthController) PostLogin(c *gin.Context) {
|
||||
body := new(models.Login)
|
||||
@@ -42,6 +56,11 @@ func (rc *AuthController) PostLogin(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PostRegister
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /auth/register).
|
||||
func (rc *AuthController) PostRegister(c *gin.Context) {
|
||||
body := new(models.User)
|
||||
@@ -60,6 +79,11 @@ func (rc *AuthController) PostRegister(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Delete
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (DELETE /auth/deactivate).
|
||||
func (rc *AuthController) Delete(c *gin.Context) {
|
||||
auth := new(models.Auth)
|
||||
@@ -75,6 +99,11 @@ func (rc *AuthController) Delete(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CheckToken
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /auth/check-token).
|
||||
func (rc *AuthController) CheckToken(c *gin.Context) {
|
||||
token, _ := c.GetQuery("token")
|
||||
|
||||
@@ -10,7 +10,15 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Gets query parameters and populates FilteredResponse model.
|
||||
/*
|
||||
FilteredResponse
|
||||
|
||||
Gets query parameters and populates FilteredResponse model.
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
Returns:
|
||||
*models.FilteredResponse: Filtered response
|
||||
*/
|
||||
func FilteredResponse(c *gin.Context) *models.FilteredResponse {
|
||||
filtered := new(models.FilteredResponse)
|
||||
page, _ := c.GetQuery("page")
|
||||
|
||||
@@ -12,7 +12,16 @@ type SubscriptionTypeController struct {
|
||||
SubscriptionTypeService *services.SubscriptionTypeService
|
||||
}
|
||||
|
||||
// Initializes SubscriptionTypeController.
|
||||
/*
|
||||
NewSubscriptionTypeController
|
||||
|
||||
Initializes SubscriptionTypeController.
|
||||
Args:
|
||||
*services.SubscriptionTypeService: Subscription type service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*SubscriptionTypeController: Controller for "subscription-types" route interactions
|
||||
*/
|
||||
func NewSubscriptionTypeController(as *services.SubscriptionTypeService, s *gin.RouterGroup) *SubscriptionTypeController {
|
||||
wc := new(SubscriptionTypeController)
|
||||
wc.SubscriptionTypeService = as
|
||||
@@ -23,6 +32,11 @@ func NewSubscriptionTypeController(as *services.SubscriptionTypeService, s *gin.
|
||||
return wc
|
||||
}
|
||||
|
||||
/*
|
||||
New
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /subscription-types)
|
||||
func (wc *SubscriptionTypeController) New(c *gin.Context) {
|
||||
body := new(models.NewSubscriptionTypeBody)
|
||||
@@ -35,6 +49,11 @@ func (wc *SubscriptionTypeController) New(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAll
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /subscription-types)
|
||||
func (wc *SubscriptionTypeController) GetAll(c *gin.Context) {
|
||||
embed, _ := c.GetQuery("embed")
|
||||
|
||||
@@ -12,7 +12,16 @@ type SubscriptionController struct {
|
||||
SubscriptionService *services.SubscriptionService
|
||||
}
|
||||
|
||||
// Initializes SubscriptionController.
|
||||
/*
|
||||
NewSubscriptionController
|
||||
|
||||
Initializes SubscriptionController.
|
||||
Args:
|
||||
*services.SubscriptionService: Subscription service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*SubscriptionController: Controller for "subscription" route interactions
|
||||
*/
|
||||
func NewSubscriptionController(as *services.SubscriptionService, s *gin.RouterGroup) *SubscriptionController {
|
||||
wc := new(SubscriptionController)
|
||||
wc.SubscriptionService = as
|
||||
@@ -30,6 +39,11 @@ func NewSubscriptionController(as *services.SubscriptionService, s *gin.RouterGr
|
||||
return wc
|
||||
}
|
||||
|
||||
/*
|
||||
New
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /subscription)
|
||||
func (wc *SubscriptionController) New(c *gin.Context) {
|
||||
body := new(models.NewSubscriptionBody)
|
||||
@@ -42,6 +56,11 @@ func (wc *SubscriptionController) New(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
Edit
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (PUT /subscription/:id)
|
||||
func (wc *SubscriptionController) Edit(c *gin.Context) {
|
||||
body := new(models.SubscriptionEdit)
|
||||
@@ -56,6 +75,11 @@ func (wc *SubscriptionController) Edit(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
Get
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /subscription/:id)
|
||||
func (wc *SubscriptionController) Get(c *gin.Context) {
|
||||
body := new(models.Auth)
|
||||
@@ -94,6 +118,11 @@ func (wc *SubscriptionController) End(c *gin.Context) {
|
||||
c.JSON(200, fr)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAll
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /subscription)
|
||||
func (wc *SubscriptionController) GetAll(c *gin.Context) {
|
||||
body := new(models.Auth)
|
||||
|
||||
@@ -12,7 +12,16 @@ type TransactionTypeController struct {
|
||||
TransactionTypeService *services.TransactionTypeService
|
||||
}
|
||||
|
||||
// Initializes TransactionTypeController.
|
||||
/*
|
||||
NewTransactionTypeController
|
||||
|
||||
Initializes TransactionTypeController.
|
||||
Args:
|
||||
*services.TransactionTypeService: Transaction Type service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*TransactionTypeController: Controller for "transaction-types" route interactions
|
||||
*/
|
||||
func NewTransactionTypeController(as *services.TransactionTypeService, s *gin.RouterGroup) *TransactionTypeController {
|
||||
wc := new(TransactionTypeController)
|
||||
wc.TransactionTypeService = as
|
||||
@@ -23,6 +32,11 @@ func NewTransactionTypeController(as *services.TransactionTypeService, s *gin.Ro
|
||||
return wc
|
||||
}
|
||||
|
||||
/*
|
||||
New
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /transaction-types)
|
||||
func (wc *TransactionTypeController) New(c *gin.Context) {
|
||||
body := new(models.NewTransactionTypeBody)
|
||||
@@ -35,6 +49,11 @@ func (wc *TransactionTypeController) New(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAll
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /transaction-types)
|
||||
func (wc *TransactionTypeController) GetAll(c *gin.Context) {
|
||||
embed, _ := c.GetQuery("embed")
|
||||
|
||||
@@ -12,7 +12,16 @@ type TransactionController struct {
|
||||
TransactionService *services.TransactionService
|
||||
}
|
||||
|
||||
// Initializes TransactionController.
|
||||
/*
|
||||
NewTransactionController
|
||||
|
||||
Initializes TransactionController.
|
||||
Args:
|
||||
*services.TransactionService: Transaction service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*TransactionController: Controller for "transaction" route interactions
|
||||
*/
|
||||
func NewTransactionController(as *services.TransactionService, s *gin.RouterGroup) *TransactionController {
|
||||
wc := new(TransactionController)
|
||||
wc.TransactionService = as
|
||||
@@ -25,6 +34,11 @@ func NewTransactionController(as *services.TransactionService, s *gin.RouterGrou
|
||||
return wc
|
||||
}
|
||||
|
||||
/*
|
||||
New
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /transactions)
|
||||
func (wc *TransactionController) New(c *gin.Context) {
|
||||
body := new(models.NewTransactionBody)
|
||||
@@ -37,6 +51,11 @@ func (wc *TransactionController) New(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAll
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /transactions)
|
||||
func (wc *TransactionController) GetAll(c *gin.Context) {
|
||||
body := new(models.Auth)
|
||||
@@ -51,6 +70,11 @@ func (wc *TransactionController) GetAll(c *gin.Context) {
|
||||
c.JSON(200, fr)
|
||||
}
|
||||
|
||||
/*
|
||||
Edit
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (PUT /transactions/:id)
|
||||
func (wc *TransactionController) Edit(c *gin.Context) {
|
||||
body := new(models.TransactionEdit)
|
||||
@@ -65,6 +89,11 @@ func (wc *TransactionController) Edit(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
Get
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /transactions/:id)
|
||||
func (wc *TransactionController) Get(c *gin.Context) {
|
||||
body := new(models.Auth)
|
||||
|
||||
@@ -11,7 +11,16 @@ type WalletsHeaderController struct {
|
||||
WalletService *services.WalletService
|
||||
}
|
||||
|
||||
// Initializes WalletsHeaderController.
|
||||
/*
|
||||
NewWalletsHeaderController
|
||||
|
||||
Initializes WalletsHeaderController.
|
||||
Args:
|
||||
*services.WalletService: Wallet service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*WalletsHeaderController: Controller for "wallet/wallet-header" route interactions
|
||||
*/
|
||||
func NewWalletsHeaderController(as *services.WalletService, s *gin.RouterGroup) *WalletsHeaderController {
|
||||
wc := new(WalletsHeaderController)
|
||||
wc.WalletService = as
|
||||
@@ -21,6 +30,11 @@ func NewWalletsHeaderController(as *services.WalletService, s *gin.RouterGroup)
|
||||
return wc
|
||||
}
|
||||
|
||||
/*
|
||||
Get
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /wallet/wallet-header)
|
||||
func (wc *WalletsHeaderController) Get(c *gin.Context) {
|
||||
body := new(models.Auth)
|
||||
|
||||
@@ -12,7 +12,16 @@ type WalletsController struct {
|
||||
WalletService *services.WalletService
|
||||
}
|
||||
|
||||
// Initializes WalletsController.
|
||||
/*
|
||||
NewWalletsController
|
||||
|
||||
Initializes WalletsController.
|
||||
Args:
|
||||
*services.WalletService: Wallet service
|
||||
*gin.RouterGroup: Gin Router Group
|
||||
Returns:
|
||||
*WalletsController: Controller for "wallet" route interactions
|
||||
*/
|
||||
func NewWalletsController(as *services.WalletService, s *gin.RouterGroup) *WalletsController {
|
||||
wc := new(WalletsController)
|
||||
wc.WalletService = as
|
||||
@@ -25,6 +34,11 @@ func NewWalletsController(as *services.WalletService, s *gin.RouterGroup) *Walle
|
||||
return wc
|
||||
}
|
||||
|
||||
/*
|
||||
New
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (POST /wallet)
|
||||
func (wc *WalletsController) New(c *gin.Context) {
|
||||
body := new(models.NewWalletBody)
|
||||
@@ -41,6 +55,11 @@ func (wc *WalletsController) New(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
GetAll
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /wallet)
|
||||
func (wc *WalletsController) GetAll(c *gin.Context) {
|
||||
body := new(models.Auth)
|
||||
@@ -54,6 +73,11 @@ func (wc *WalletsController) GetAll(c *gin.Context) {
|
||||
c.JSON(200, fr)
|
||||
}
|
||||
|
||||
/*
|
||||
Edit
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (PUT /wallet/:id)
|
||||
func (wc *WalletsController) Edit(c *gin.Context) {
|
||||
body := new(models.WalletEdit)
|
||||
@@ -68,6 +92,11 @@ func (wc *WalletsController) Edit(c *gin.Context) {
|
||||
c.JSON(200, wm)
|
||||
}
|
||||
|
||||
/*
|
||||
Get
|
||||
Args:
|
||||
*gin.Context: Gin Application Context
|
||||
*/
|
||||
// ROUTE (GET /wallet/:id)
|
||||
func (wc *WalletsController) Get(c *gin.Context) {
|
||||
params := new(models.Params)
|
||||
|
||||
Reference in New Issue
Block a user