Refactor app structure: move models to domain, centralize config and database init - TODO: add jwt

This commit is contained in:
2025-05-17 20:07:29 +03:30
parent ab9254fcad
commit 7b601e75ba
12 changed files with 142 additions and 181 deletions

View File

@@ -0,0 +1,24 @@
package handlers
import (
"CatsOfMastodonBotGo/internal/services"
"github.com/gin-gonic/gin"
)
type ApiEndpointHandler struct {
PostService services.PostService
}
var ApiEndpointHandlerInstance *ApiEndpointHandler
func InitApiEndpointHandler() {
ApiEndpointHandlerInstance = &ApiEndpointHandler{
PostService: *services.PostServiceInstance,
}
}
func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
c.JSON(200,ps.PostService.GetRandomPost())
}