Add web server with admin dashboard and media approval endpoints

This commit is contained in:
2025-05-11 22:14:32 +03:30
parent 3e7f6b92d3
commit 75bad5e091
8 changed files with 179 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
package handlers
import "github.com/gin-gonic/gin"
func AdminDashboardHandler (c *gin.Context) {
c.JSON(200, gin.H{
"YouAreOn": "AdminDashboard",
})
}

View File

@@ -0,0 +1,9 @@
package handlers
import "github.com/gin-gonic/gin"
func ApproveMediaHandler (c *gin.Context) {
c.JSON(200, gin.H{
"YouAreOn": "ApproveMedia",
})
}

View File

@@ -0,0 +1,9 @@
package handlers
import "github.com/gin-gonic/gin"
func MainPageHandler (c *gin.Context) {
c.JSON(200, gin.H{
"YouAreOn": "MainPage",
})
}

View File

@@ -0,0 +1,9 @@
package handlers
import "github.com/gin-gonic/gin"
func RejectMediaHandler (c *gin.Context) {
c.JSON(200, gin.H{
"YouAreOn": "RejectMedia",
})
}

25
internal/server/router.go Normal file
View File

@@ -0,0 +1,25 @@
package server
import (
"CatsOfMastodonBotGo/internal/handlers"
"github.com/gin-gonic/gin"
)
func SetupRouter(r *gin.Engine) *gin.Engine {
admin := r.Group("/admin")
admin.GET("/", handlers.AdminDashboardHandler)
admin.POST("/approve", handlers.ApproveMediaHandler)
admin.POST("/reject", handlers.RejectMediaHandler)
r.GET("/", handlers.MainPageHandler)
return r
}