56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
package handlers_admin
|
|
|
|
import (
|
|
"CatsOfMastodonBotGo/internal"
|
|
"net/http"
|
|
|
|
requestmodels "CatsOfMastodonBotGo/internal/models/requestModels"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type AdminDashboardHandler struct {
|
|
AppContext *internal.AppContext
|
|
}
|
|
|
|
func NewAdminDashboardHandler(appContext *internal.AppContext) *AdminDashboardHandler {
|
|
return &AdminDashboardHandler{
|
|
AppContext: appContext,
|
|
}
|
|
}
|
|
|
|
func (appContext *AdminDashboardHandler) AdminHomePage(c *gin.Context) {
|
|
c.JSON(200, gin.H{
|
|
"YouAreOn": "AdminDashboardHomePage",
|
|
})
|
|
}
|
|
|
|
func (appContext *AdminDashboardHandler) ApproveMedia(c *gin.Context) {
|
|
c.JSON(200, gin.H{
|
|
"YouAreOn": "ApproveMedia",
|
|
})
|
|
}
|
|
|
|
func (appContext *AdminDashboardHandler) RejectMedia(c *gin.Context) {
|
|
c.JSON(200, gin.H{
|
|
"YouAreOn": "RejectMedia",
|
|
})
|
|
}
|
|
|
|
func (appContext *AdminDashboardHandler) Login(c *gin.Context) {
|
|
|
|
var input requestmodels.LoginInput
|
|
|
|
if err := c.ShouldBindJSON(&input); err != nil {
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
return
|
|
}
|
|
|
|
if input.Password == appContext.AppContext.AdminPassword {
|
|
c.JSON(200, gin.H{
|
|
"YouAreOn": "AdminDashboardHomePage",
|
|
})
|
|
}
|
|
|
|
}
|