chore: add endpoint for consuming tokens

This commit adds a new endpoint `/token/consume` to the API router, allowing users to consume tokens from another source. It includes changes to the `token.go` file in the `controller` package.
This commit is contained in:
Laisky.Cai
2024-06-24 07:58:14 +00:00
parent a8cc96bf4a
commit 4eade81869
2 changed files with 88 additions and 23 deletions

View File

@@ -93,6 +93,7 @@ func SetApiRouter(router *gin.Engine) {
tokenRoute.POST("/", controller.AddToken)
tokenRoute.PUT("/", controller.UpdateToken)
tokenRoute.DELETE("/:id", controller.DeleteToken)
apiRouter.POST("/token/consume", middleware.TokenAuth(), controller.ConsumeToken)
}
costRoute := apiRouter.Group("/cost")
{