timetracker update

This commit is contained in:
Daniel Goc
2026-03-11 09:33:36 +01:00
parent bbf8a2c133
commit 9ef4bb219b
121 changed files with 4328 additions and 2231 deletions

View File

@@ -0,0 +1,26 @@
package general
import (
"git.ma-al.com/goc_marek/timetracker/assets"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/static"
)
func InitBo(app *fiber.App) {
// static files
app.Get("/*", static.New("", static.Config{
FS: assets.FS(),
// Browse: true,
MaxAge: 60 * 60 * 24 * 30, // 30 days
}))
app.Get("/*", static.New("", static.Config{
FS: assets.FSDist(),
// Browse: true,
MaxAge: 60 * 60 * 24 * 30, // 30 days
}))
app.Get("/*", func(c fiber.Ctx) error {
return c.SendFile("./assets/public/dist/index.html")
})
}

View File

@@ -0,0 +1,17 @@
package general
import (
"git.ma-al.com/goc_marek/timetracker/app/config"
"git.ma-al.com/goc_marek/timetracker/assets"
"github.com/gofiber/fiber/v3"
)
func Favicon(app *fiber.App, cfg *config.Config) {
// Favicon check endpoint
app.Get("/favicon.ico", func(c fiber.Ctx) error {
return c.SendFile("img/favicon.ico", fiber.SendFile{
FS: assets.FS(),
})
})
}

View File

@@ -0,0 +1,20 @@
package general
import (
"git.ma-al.com/goc_marek/timetracker/app/config"
"github.com/gofiber/fiber/v3"
)
func InitHealth(app *fiber.App, cfg *config.Config) {
// Health check endpoint
app.Get("/health", func(c fiber.Ctx) error {
// emailService.NewEmailService().SendVerificationEmail("goc_daniel@ma-al.com", "jakis_token", c.BaseURL(), "en")
// emailService.NewEmailService().SendPasswordResetEmail("goc_daniel@ma-al.com", "jakis_token", c.BaseURL(), "en")
// emailService.NewEmailService().SendNewUserAdminNotification("goc_daniel@ma-al.com", "admin", c.BaseURL())
return c.JSON(fiber.Map{
"status": "ok",
"app": cfg.App.Name,
"version": cfg.App.Version,
})
})
}

View File

@@ -0,0 +1,60 @@
package general
import (
"git.ma-al.com/goc_marek/timetracker/app/api"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/static"
)
func InitSwagger(app *fiber.App) {
// Swagger - serve OpenAPI JSON
app.Get("/openapi.json", func(c fiber.Ctx) error {
c.Set("Content-Type", "application/json")
return c.SendString(api.ApenapiJson)
})
// Swagger UI HTML
app.Get("/swagger", func(c fiber.Ctx) error {
return c.Redirect().Status(fiber.StatusFound).To("/swagger/index.html")
})
app.Get("/swagger/index.html", func(c fiber.Ctx) error {
c.Set("Content-Type", "text/html")
return c.SendString(swaggerHTML)
})
// Serve Swagger assets
app.Get("/swagger/assets", static.New("app/api/swagger/assets"))
}
// Embedded Swagger UI HTML (minimal version)
var swaggerHTML = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js" charset="UTF-8"></script>
<script src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-standalone-preset.js" charset="UTF-8"></script>
<script>
window.onload = function() {
window.ui = SwaggerUIBundle({
url: "/openapi.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
layout: "StandaloneLayout"
});
};
</script>
</body>
</html>
`