You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.3 KiB
Go

7 months ago
package route
import (
"github.com/gin-gonic/gin"
"gold-shop/api/manage"
"gold-shop/middleware"
"gold-shop/utils/result"
)
func adminRouteInit(r *gin.Engine) {
manageGroup := r.Group("/manage")
manageGroup.Use(middleware.CorsMiddleware("manage"))
manageGroup.Match([]string{"POST", "OPTIONS"}, "/login", result.Json(manage.Login))
7 months ago
manageGroup.GET("/download", manage.DownloadUsers)
7 months ago
authGroup := manageGroup.Group("")
authGroup.Use(middleware.JwtMiddleware("admin"))
{
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-admin-info", result.Json(manage.GetAdminInfo))
authGroup.Match([]string{"POST", "OPTIONS"}, "/logout", result.Json(manage.Logout))
authGroup.Match([]string{"POST", "OPTIONS"}, "/add-admin", result.Json(manage.AddAdmin))
7 months ago
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-users", result.Json(manage.GetUsers))
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-users", manage.DownloadUsers)
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-orders", result.Json(manage.GetOrders))
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-orders", manage.DownloadOrders)
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-payments", result.Json(manage.GetPayments))
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-payments", manage.DownloadPayments)
7 months ago
}
}