From f31aa197cabaec6d694c4d509b3eabbf8644add6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20B=C3=BClow?= Date: Thu, 26 Oct 2023 13:59:10 +0200 Subject: [PATCH] added PackageList struct to common --- common/structs.go | 6 ++++++ server/api/endpoint/packageList.go | 3 ++- server/go.mod | 1 + server/go.sum | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/structs.go b/common/structs.go index 4ffbf5e..6d3df75 100644 --- a/common/structs.go +++ b/common/structs.go @@ -1,5 +1,6 @@ package common +// OSInfo gives some basic information about the system. type OSInfo struct { OS string Distribution string @@ -10,6 +11,7 @@ type OSInfo struct { PackageManager string } +// ListPackage is a single package and the information about it type ListPackage struct { Name string Source string @@ -20,5 +22,9 @@ type ListPackage struct { PackageManager string } +// PackageList holds a list of ListPackages and some additional metadata type PackageList struct { + Hostname string + Date int64 + List []ListPackage } diff --git a/server/api/endpoint/packageList.go b/server/api/endpoint/packageList.go index 4cd9e7d..d0526cd 100644 --- a/server/api/endpoint/packageList.go +++ b/server/api/endpoint/packageList.go @@ -1,7 +1,8 @@ package endpoint import "github.com/gin-gonic/gin" +import "git.jmbit.de/jmb/patchman/common" func PackageList(c *gin.Context) { - + var packageList common.PackageList } diff --git a/server/go.mod b/server/go.mod index d1600a0..ccccdcc 100644 --- a/server/go.mod +++ b/server/go.mod @@ -3,6 +3,7 @@ module git.jmbit.de/jmb/patchman/server go 1.21.3 require ( + git.jmbit.de/jmb/patchman/common v0.0.0-20231026115429-7ea813e74a3f github.com/gin-gonic/gin v1.9.1 github.com/spf13/viper v1.17.0 ) diff --git a/server/go.sum b/server/go.sum index 2221ff0..491eaa8 100644 --- a/server/go.sum +++ b/server/go.sum @@ -36,6 +36,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +git.jmbit.de/jmb/patchman/common v0.0.0-20231026115429-7ea813e74a3f h1:TBGCreejem+sBB5YfM9yTzyEiNUw8uQ3WG3S9WPot6M= +git.jmbit.de/jmb/patchman/common v0.0.0-20231026115429-7ea813e74a3f/go.mod h1:kDNcep588pcLfJQ5E5iFxhceXkkBrlCOnwZylTBeVOA= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=