mirror of
https://github.com/mayswind/ezbookkeeping
synced 2026-04-21 13:37:43 +00:00
28 lines
600 B
Go
28 lines
600 B
Go
package api
|
|
|
|
import (
|
|
"github.com/mayswind/ezbookkeeping/pkg/core"
|
|
"github.com/mayswind/ezbookkeeping/pkg/errs"
|
|
)
|
|
|
|
// SystemsApi represents system api
|
|
type SystemsApi struct{}
|
|
|
|
// Initialize a system api singleton instance
|
|
var (
|
|
Systems = &SystemsApi{}
|
|
)
|
|
|
|
// VersionHandler returns the server version and commit hash
|
|
func (a *SystemsApi) VersionHandler(c *core.WebContext) (any, *errs.Error) {
|
|
result := make(map[string]string)
|
|
|
|
result["version"] = core.Version
|
|
result["commitHash"] = core.CommitHash
|
|
|
|
if core.BuildTime != "" {
|
|
result["buildTime"] = core.BuildTime
|
|
}
|
|
|
|
return result, nil
|
|
}
|