diff --git a/go.mod b/go.mod index fcc2516..28fa074 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,14 @@ module jannex/admin-dashboard-backend -go 1.20 +go 1.21.0 require ( - github.com/go-playground/validator/v10 v10.12.0 - github.com/gofiber/fiber/v2 v2.44.0 + git.ex.umbach.dev/Alex/roese-utils v1.0.6 + github.com/gofiber/fiber/v2 v2.49.2 github.com/gofiber/websocket/v2 v2.1.6 - github.com/google/uuid v1.3.0 + github.com/google/uuid v1.3.1 github.com/joho/godotenv v1.5.1 - github.com/rs/zerolog v1.29.1 + github.com/rs/zerolog v1.31.0 github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee golang.org/x/crypto v0.7.0 gorm.io/driver/mysql v1.5.0 @@ -18,23 +18,23 @@ require ( require ( github.com/andybalholm/brotli v1.0.5 // indirect github.com/fasthttp/websocket v1.5.2 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.15.5 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect - github.com/klauspost/compress v1.16.3 // indirect - github.com/leodido/go-urn v1.2.2 // indirect + github.com/klauspost/compress v1.16.7 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/philhofer/fwd v1.1.2 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect - github.com/tinylib/msgp v1.1.8 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.45.0 // indirect + github.com/valyala/fasthttp v1.49.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index f4140d7..71270db 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +git.ex.umbach.dev/Alex/roese-utils v1.0.6 h1:dqel8hRA+7IEwxPN1ld88UQu+ZnccECwWuwRbXDdh3U= +git.ex.umbach.dev/Alex/roese-utils v1.0.6/go.mod h1:tjq6m6lNFo0TzAvq8jHhlK48IGxi+SrlrQwf9WYg408= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -6,56 +8,50 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fasthttp/websocket v1.5.2 h1:KdCb0EpLpdJpfE3IPA5YLK/aYBO3dhZcvwxz6tXe2LQ= github.com/fasthttp/websocket v1.5.2/go.mod h1:S0KC1VBlx1SaXGXq7yi1wKz4jMub58qEnHQG9oHuqBw= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.12.0 h1:E4gtWgxWxp8YSxExrQFv5BpCahla0PVF2oTTEYaWQGI= -github.com/go-playground/validator/v10 v10.12.0/go.mod h1:hCAPuzYvKdP33pxWa+2+6AIKXEKqjIUyqsNCtbsSJrA= +github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= +github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofiber/fiber/v2 v2.44.0 h1:Z90bEvPcJM5GFJnu1py0E1ojoerkyew3iiNJ78MQCM8= -github.com/gofiber/fiber/v2 v2.44.0/go.mod h1:VTMtb/au8g01iqvHyaCzftuM/xmZgKOZCtFzz6CdV9w= +github.com/gofiber/fiber/v2 v2.49.2 h1:ONEN3/Vc+dUCxxDgZZwpqvhISgHqb+bu+isBiEyKEQs= +github.com/gofiber/fiber/v2 v2.49.2/go.mod h1:gNsKnyrmfEWFpJxQAV0qvW6l70K1dZGno12oLtukcts= github.com/gofiber/websocket/v2 v2.1.6 h1:k4z+YqzGUwbCQJCIW+mDJF2iCcBfRY7BJGUa2k+VHXo= github.com/gofiber/websocket/v2 v2.1.6/go.mod h1:o+oXFwHjavIiM2KWo/MNpcIOruS0am16h3efqnjXLis= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/leodido/go-urn v1.2.2 h1:7z68G0FCGvDk646jz1AelTYNYWrTNm0bEcFAo147wt4= -github.com/leodido/go-urn v1.2.2/go.mod h1:kUaIbLZWttglzwNuG0pgsh5vuV6u2YcGBYz1hIPjtOQ= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= -github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= -github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= -github.com/rwtodd/Go.Sed v0.0.0-20210816025313-55464686f9ef/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ= -github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 h1:rmMl4fXJhKMNWl+K+r/fq4FbbKI+Ia2m9hYBLm2h4G4= -github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3D/WJsDd1iXHT96alCoN2KJo6/4x1DZC3wZs8= -github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk= github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -65,67 +61,22 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= -github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= -github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.45.0 h1:zPkkzpIn8tdHZUrVa6PzYd0i5verqiPSkgTd3bSUcpA= -github.com/valyala/fasthttp v1.45.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= +github.com/valyala/fasthttp v1.49.0 h1:9FdvCpmxB74LH4dPb7IJ1cOSsluR07XG3I1txXWwJpE= +github.com/valyala/fasthttp v1.49.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/groupTasks/groups/rex-robots/index.json b/groupTasks/groups/rex-robots/index.json new file mode 100644 index 0000000..d665ffd --- /dev/null +++ b/groupTasks/groups/rex-robots/index.json @@ -0,0 +1,36 @@ +{ + "category": "RexRobots", + "name": "Produktionstask 1", + "globalInputs": [ + { + "parameterName": "kundenname", + "type": "text", + "displayName": "Name des Kunden" + } + ], + "tasks": [ + { + "name": "Bild zu Label konvertieren", + "onFinish": "pause", + "undoPossible": true, + "repeatPossible": true, + "scriptPath": "test1.py", + "parameters": [ + { + "parameterName": "labelformat", + "type": "text", + "displayName": "Format des Labels", + "global": false + } + ] + }, + { + "name": "Label drucken", + "onFinish": "next", + "undoPossible": false, + "repeatPossible": false, + "scriptPath": "test2.py", + "parameters": [] + } + ] +} diff --git a/groupTasks/groups/rex-robots/test.py b/groupTasks/groups/rex-robots/test.py new file mode 100644 index 0000000..b061c7d --- /dev/null +++ b/groupTasks/groups/rex-robots/test.py @@ -0,0 +1,11 @@ +import sys +import os + +# add the path to the libs folder +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) + +from libs.robots import rex + +rexRobot = rex.Rex("rexRobot") + +rexRobot.move(1, 2, 3) \ No newline at end of file diff --git a/groupTasks/libs/__init__.py b/groupTasks/libs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/groupTasks/libs/__pycache__/__init__.cpython-39.pyc b/groupTasks/libs/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..0a54c85 Binary files /dev/null and b/groupTasks/libs/__pycache__/__init__.cpython-39.pyc differ diff --git a/groupTasks/libs/__pycache__/test.cpython-39.pyc b/groupTasks/libs/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000..a06c666 Binary files /dev/null and b/groupTasks/libs/__pycache__/test.cpython-39.pyc differ diff --git a/groupTasks/libs/robots/__init__.py b/groupTasks/libs/robots/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/groupTasks/libs/robots/__pycache__/__init__.cpython-39.pyc b/groupTasks/libs/robots/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..5b3853f Binary files /dev/null and b/groupTasks/libs/robots/__pycache__/__init__.cpython-39.pyc differ diff --git a/groupTasks/libs/robots/__pycache__/rex.cpython-39.pyc b/groupTasks/libs/robots/__pycache__/rex.cpython-39.pyc new file mode 100644 index 0000000..533eac1 Binary files /dev/null and b/groupTasks/libs/robots/__pycache__/rex.cpython-39.pyc differ diff --git a/groupTasks/libs/robots/rex.py b/groupTasks/libs/robots/rex.py new file mode 100644 index 0000000..9d34a6c --- /dev/null +++ b/groupTasks/libs/robots/rex.py @@ -0,0 +1,22 @@ +class Rex: + """ + This class represents a rex robot. + """ + def __init__(self, name): + self.name = name + self.x = 0 + self.y = 0 + self.z = 0 + + def move(self, x, y, z): + """ + Move the robot to a new position. + """ + self.x = x + self.y = y + self.z = z + + print("Robot: " + self.name + " moved to (" + str(self.x) + ", " + str(self.y) + ")") + + def __str__(self): + return "Robot: " + self.name + " (" + str(self.x) + ", " + str(self.y) + ")" \ No newline at end of file diff --git a/groupTasks/libs/test.py b/groupTasks/libs/test.py new file mode 100644 index 0000000..08641b9 --- /dev/null +++ b/groupTasks/libs/test.py @@ -0,0 +1,3 @@ +# test.py +def testa(): + print("Hello from test.py") \ No newline at end of file diff --git a/main b/main index ffd146a..26b2a59 100755 Binary files a/main and b/main differ diff --git a/main.go b/main.go index e0d6b02..ed23d03 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,7 @@ import ( "path/filepath" "time" + "git.ex.umbach.dev/Alex/roese-utils/rsconfig" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" flogger "github.com/gofiber/fiber/v2/middleware/logger" @@ -40,7 +41,32 @@ import ( func init() { fmt.Println("Server is starting...") - createEnvConfigFileIfNotExists() + rsconfig.CreateEnvConfigFileIfNotExists(`DEBUG=false +COLORIZED_OUTPUT=true +HOST=127.0.0.1 +PORT=8080 + +LOG_MANAGER_SERVER_URL=http://localhost:50110 + +# Folder paths +FOLDER_GROUPTASKS_GROUPS=./groupTasks/groups/ +FOLDER_GROUPTASKS_RUNNINGTASKS=./groupTasks/runningTasks/ + +FOLDER_LOGS_GROUPTASKS=./logs/grouptasks/ +FOLDER_LOGS_SYSTEM=./logs/system/ + +FOLDER_PUBLIC_STATIC=./public/ + +# MariaDB +MARIADB_HOSTNAME=127.0.0.1 +MARIADB_PORT=3306 +MARIADB_USERNAME=db_user +MARIADB_PASSWORD=db_password +MARIADB_DATABASE_NAME=db_database_name + +# invex storage system api +INVEX_API_BASE=api_url +INVEX_API_TOKEN=api_token`) config.LoadConfig() logger.InitLogger() @@ -131,48 +157,6 @@ func main() { app.Listen(config.Cfg.Host + ":" + config.Cfg.Port) } -func createEnvConfigFileIfNotExists() { - if os.Getenv("DOCKER") != "" { - return - } - - content := `DEBUG=false -COLORIZED_OUTPUT=true -HOST=127.0.0.1 -PORT=8080 - -# Folder paths -FOLDER_GROUPTASKS_GROUPS=./groupTasks/groups/ -FOLDER_GROUPTASKS_RUNNINGTASKS=./groupTasks/runningTasks/ - -FOLDER_LOGS_GROUPTASKS=./logs/grouptasks/ -FOLDER_LOGS_SYSTEM=./logs/system/ - -FOLDER_PUBLIC_STATIC=./public/ - -# Log language configurations -LOG_LANGUAGE_GROUPTASKS=./grouptasks_lang_log_messages.json -LOG_LANGUAGE_SYSTEM=./system_lang_log_messages.json - -# MariaDB -MARIADB_HOSTNAME=127.0.0.1 -MARIADB_PORT=3306 -MARIADB_USERNAME=db_user -MARIADB_PASSWORD=db_password -MARIADB_DATABASE_NAME=db_database_name` - - if _, err := os.Stat(".env"); os.IsNotExist(err) { - err := os.WriteFile(".env", []byte(content), 0644) - - if err != nil { - panic("Failed to create .env file, err: " + err.Error()) - } - - fmt.Println("Config .env was created. Please configure and start the server again.") - os.Exit(1) - } -} - // create global requirements.txt in cfg.PublicStatic groupTasks folder func createGlobalRequirementsTxtIfNotExists() { cfg := config.Cfg.FolderPaths diff --git a/modules/cache/grouptaskstepsinput.go b/modules/cache/grouptaskstepsinput.go index e18c827..c213ce8 100644 --- a/modules/cache/grouptaskstepsinput.go +++ b/modules/cache/grouptaskstepsinput.go @@ -2,8 +2,9 @@ package cache import ( "jannex/admin-dashboard-backend/modules/structs" - "jannex/admin-dashboard-backend/modules/utils" "sync" + + "git.ex.umbach.dev/Alex/roese-utils/rsutils" ) /* @@ -61,5 +62,5 @@ func GetGroupTaskStepsInputsValue(inputs []structs.GroupTaskStepsInput, groupTas return "" } - return utils.MarshalJson(inputParameters) + return rsutils.MarshalJson(inputParameters) } diff --git a/modules/equipment/equipment.go b/modules/equipment/equipment.go index 883b50b..82033b8 100644 --- a/modules/equipment/equipment.go +++ b/modules/equipment/equipment.go @@ -264,13 +264,15 @@ func isInList(fileName string, notes []Notes) bool { // fetching the thumbnail from the invex server and sending it back to the client func GetEquipmentInvexThumbnail(c *fiber.Ctx, stockItemId string) error { // first request to /api/stock/:stockItemId/ to get the thumbnail url - _, body, err := requestclient.InvexApiRequestClient(fiber.MethodGet, config.Cfg.InvexAPI.Base+"/api/stock/"+stockItemId+"/") + s, body, err := requestclient.InvexApiRequestClient(fiber.MethodGet, config.Cfg.InvexAPI.Base+"/api/stock/"+stockItemId+"/") if err != nil { log.Error().Msgf("Invex api request error: %s", err) return c.SendStatus(fiber.StatusInternalServerError) } + log.Info().Msgf("StatusCode: %d", s) + // parse body as json var data map[string]interface{} diff --git a/modules/grouptasks/grouptasks.go b/modules/grouptasks/grouptasks.go index 044f694..2eb4ea1 100644 --- a/modules/grouptasks/grouptasks.go +++ b/modules/grouptasks/grouptasks.go @@ -18,6 +18,7 @@ import ( "strings" "time" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/google/uuid" "github.com/rs/zerolog/log" ) @@ -681,7 +682,7 @@ func RunGroupTask(args RunGroupTaskArgs) { }, args.Category) logger.AddGroupTasksLog("System has started step %s of groupTaskId %s", - utils.MarshalJson(args.Step), groupTaskStep.GroupTasksId) + rsutils.MarshalJson(args.Step), groupTaskStep.GroupTasksId) RunGroupTask(args) } else { diff --git a/modules/utils/utils.go b/modules/utils/utils.go index a1e097a..cd2af17 100644 --- a/modules/utils/utils.go +++ b/modules/utils/utils.go @@ -1,13 +1,9 @@ package utils import ( - "crypto/rand" - "encoding/json" - "errors" "jannex/admin-dashboard-backend/modules/database" "jannex/admin-dashboard-backend/modules/structs" "math" - "math/big" "time" "github.com/gofiber/fiber/v2" @@ -23,17 +19,6 @@ func GetXApiKeyHeader(c *fiber.Ctx) string { return c.GetReqHeaders()[HeaderXApiKey] } -func MarshalJson(v any) string { - json, err := json.Marshal(v) - - if err != nil { - log.Error().Msgf("Failed to marshal json %s", err) - return "" - } - - return string(json) -} - func GetSessionExpiresAtTime() time.Time { return time.Now().Add(time.Second * SessionExpiresAtTime) } @@ -49,71 +34,6 @@ func IsPasswordLengthValid(password string) bool { return true } -func GenerateSession() (string, error) { - var letters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - - r := make([]byte, 36) - - for i := 0; i < 36; i++ { - num, err := rand.Int(rand.Reader, big.NewInt(int64(len(letters)))) - - if err != nil { - log.Error().Msgf("Failed to session: %v", err) - return "", err - } - - if i == 8 || i == 13 || i == 18 || i == 23 { - r[i] = 45 - } else { - r[i] = letters[num.Int64()] - } - } - - return string(r), nil -} - -func ParamsParserHelper(c *fiber.Ctx, params interface{}) error { - if err := c.ParamsParser(params); err != nil { - log.Error().Msgf("Failed to parse params, err: %s", err.Error()) - return errors.New("Failed to parse params") - } - - if errValidation := ValidateStruct(params); errValidation != nil { - log.Error().Msgf("Failed to validate params, err: %v", errValidation) - return errors.New("Failed to validate params") - } - - return nil -} - -func BodyParserHelper(c *fiber.Ctx, body interface{}) error { - if err := c.BodyParser(body); err != nil { - log.Error().Msgf("Failed to parse body, err: %s", err.Error()) - return errors.New("Failed to parse body") - } - - if errValidation := ValidateStruct(body); errValidation != nil { - log.Error().Msgf("Failed to validate body, err: %v", errValidation) - return errors.New("Failed to validate body") - } - - return nil -} - -func QueryParserHelper(c *fiber.Ctx, query interface{}) error { - if err := c.QueryParser(query); err != nil { - log.Error().Msgf("Failed to parse query, err: %s", err.Error()) - return errors.New("Failed to parse query") - } - - if errValidation := ValidateStruct(query); errValidation != nil { - log.Error().Msgf("Failed to validate query, err: %v", errValidation) - return errors.New("Failed to validate query") - } - - return nil -} - // GetTotalPages returns total pages for pagination // Example whereQuery = "stock_item_id = ?" and args = stockItemId is Where("stock_item_id = ?", stockItemId) func GetTotalPages(paginationLimit int, any interface{}, whereQuery interface{}, args ...interface{}) int { diff --git a/modules/utils/validator.go b/modules/utils/validator.go index 6ddeb77..2c2926f 100644 --- a/modules/utils/validator.go +++ b/modules/utils/validator.go @@ -2,57 +2,27 @@ package utils import ( "jannex/admin-dashboard-backend/modules/structs" - "regexp" - "strings" - "github.com/go-playground/validator/v10" + "git.ex.umbach.dev/Alex/roese-utils/rsvalidator" ) -type ErrorResponse struct { - FailedField string - Tag string - Value string -} - -var Validate = validator.New() - -func ValidateStruct(event interface{}) []*ErrorResponse { - var errors []*ErrorResponse - err := Validate.Struct(event) - if err != nil { - for _, err := range err.(validator.ValidationErrors) { - var element ErrorResponse - element.FailedField = err.StructNamespace() - element.Tag = err.Tag() - element.Value = err.Param() - errors = append(errors, &element) - } - } - return errors -} - -func validateNumericString(fl validator.FieldLevel) bool { - str := fl.Field().String() - return strings.TrimSpace(str) != "" && regexp.MustCompile(`^[0-9]+$`).MatchString(str) -} - func ValidatorInit() { - Validate.RegisterValidation("numericstring", validateNumericString) + rsvalidator.Validate.RegisterValidation("numericstring", rsvalidator.ValidateNumericString) - Validate.RegisterStructValidationMapRules(generalRules, + rsvalidator.Validate.RegisterStructValidationMapRules(generalRules, structs.UserLoginRequest{}, structs.UserSignOutSessionRequest{}, structs.ScannerRequest{}) - Validate.RegisterStructValidationMapRules(groupTaskRules, + rsvalidator.Validate.RegisterStructValidationMapRules(groupTaskRules, structs.ApiGroupTaskRequest{}) - Validate.RegisterStructValidationMapRules(equipmentRules, + rsvalidator.Validate.RegisterStructValidationMapRules(equipmentRules, structs.EquipmentRequest{}, structs.GetDocumentationEquipmentRequest{}, structs.CreateEquipmentDocumentationRequest{}, structs.EditEquipmentDocumentationRequest{}) - Validate.RegisterStructValidationMapRules(notificationRules, + rsvalidator.Validate.RegisterStructValidationMapRules(notificationRules, structs.AddNotificationRequest{}) } diff --git a/routers/router/api/v1/equipment/equipment.go b/routers/router/api/v1/equipment/equipment.go index 1fddc84..8280726 100644 --- a/routers/router/api/v1/equipment/equipment.go +++ b/routers/router/api/v1/equipment/equipment.go @@ -6,6 +6,7 @@ import ( "jannex/admin-dashboard-backend/modules/utils" "jannex/admin-dashboard-backend/socketclients" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/gofiber/fiber/v2" ) @@ -41,7 +42,7 @@ func CreateEquipmentDocumentation(c *fiber.Ctx) error { var body structs.CreateEquipmentDocumentationRequest - if err := utils.BodyParserHelper(c, &body); err != nil { + if err := rsutils.BodyParserHelper(c, &body); err != nil { return c.SendStatus(fiber.StatusBadRequest) } @@ -86,13 +87,13 @@ func GetEquipmentDocumentations(c *fiber.Ctx) error { var params structs.EquipmentRequest - if err := utils.ParamsParserHelper(c, ¶ms); err != nil { + if err := rsutils.ParamsParserHelper(c, ¶ms); err != nil { return c.SendStatus(fiber.StatusBadRequest) } var query structs.PageQuery - if err := utils.QueryParserHelper(c, &query); err != nil { + if err := rsutils.QueryParserHelper(c, &query); err != nil { return c.SendStatus(fiber.StatusBadRequest) } @@ -139,7 +140,7 @@ func GetEquipmentDocumentation(c *fiber.Ctx) error { var params structs.GetDocumentationEquipmentRequest - if err := utils.ParamsParserHelper(c, ¶ms); err != nil { + if err := rsutils.ParamsParserHelper(c, ¶ms); err != nil { return c.SendStatus(fiber.StatusBadRequest) } @@ -178,7 +179,7 @@ func EditEquipmentDocumentation(c *fiber.Ctx) error { var body structs.EditEquipmentDocumentationRequest - if err := utils.BodyParserHelper(c, &body); err != nil { + if err := rsutils.BodyParserHelper(c, &body); err != nil { return c.SendStatus(fiber.StatusBadRequest) } @@ -211,7 +212,7 @@ func GetEquipmentThumbnail(c *fiber.Ctx) error { var params structs.EquipmentRequest - if err := utils.ParamsParserHelper(c, ¶ms); err != nil { + if err := rsutils.ParamsParserHelper(c, ¶ms); err != nil { return c.SendStatus(fiber.StatusBadRequest) } diff --git a/routers/router/api/v1/grouptasks/grouptasks.go b/routers/router/api/v1/grouptasks/grouptasks.go index a62d79b..389027c 100644 --- a/routers/router/api/v1/grouptasks/grouptasks.go +++ b/routers/router/api/v1/grouptasks/grouptasks.go @@ -8,6 +8,8 @@ import ( "jannex/admin-dashboard-backend/modules/utils" "jannex/admin-dashboard-backend/socketclients" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" + "git.ex.umbach.dev/Alex/roese-utils/rsvalidator" "github.com/gofiber/fiber/v2" "github.com/rs/zerolog/log" ) @@ -152,7 +154,7 @@ func StartGroupTask(c *fiber.Ctx) error { return c.Status(fiber.StatusBadRequest).JSON(err) } - if errValidation := utils.ValidateStruct(body); errValidation != nil { + if errValidation := rsvalidator.ValidateStruct(body); errValidation != nil { log.Error().Msgf("Failed to validate body, err: %v", errValidation) return c.Status(fiber.StatusBadRequest).JSON(errValidation) } @@ -248,5 +250,5 @@ func convertJsonGlobalInputToStruct(bodyGlobalInputs []map[string]string, groupG } } - return utils.MarshalJson(globalInputs) + return rsutils.MarshalJson(globalInputs) } diff --git a/routers/router/api/v1/jnxscanner/scanner.go b/routers/router/api/v1/jnxscanner/scanner.go index a49db9e..3ac628f 100644 --- a/routers/router/api/v1/jnxscanner/scanner.go +++ b/routers/router/api/v1/jnxscanner/scanner.go @@ -8,6 +8,8 @@ import ( "jannex/admin-dashboard-backend/socketclients" "time" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" + "git.ex.umbach.dev/Alex/roese-utils/rsvalidator" "github.com/gofiber/fiber/v2" "github.com/rs/zerolog/log" "github.com/savsgio/gotils/uuid" @@ -21,13 +23,13 @@ func AddScanner(c *fiber.Ctx) error { return c.Status(fiber.StatusBadRequest).JSON(err) } - if err := utils.ValidateStruct(body); err != nil { + if err := rsvalidator.ValidateStruct(body); err != nil { log.Error().Msgf("Failed to validate body, err: %v", err) return c.SendStatus(fiber.StatusBadRequest) } id := uuid.V4() - session, err := utils.GenerateSession() + session, err := rsutils.GenerateSession() if err != nil { return c.SendStatus(fiber.StatusInternalServerError) diff --git a/routers/router/api/v1/machines/machines.go b/routers/router/api/v1/machines/machines.go index 89b3c5e..8bf638d 100644 --- a/routers/router/api/v1/machines/machines.go +++ b/routers/router/api/v1/machines/machines.go @@ -5,9 +5,9 @@ import ( "jannex/admin-dashboard-backend/modules/config" "jannex/admin-dashboard-backend/modules/requestclient" "jannex/admin-dashboard-backend/modules/structs" - "jannex/admin-dashboard-backend/modules/utils" "strconv" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/gofiber/fiber/v2" "github.com/rs/zerolog/log" ) @@ -27,7 +27,7 @@ type InvexApiStockListResponse struct { func GetMachines(c *fiber.Ctx) error { var body structs.MachinesBody - if err := utils.BodyParserHelper(c, &body); err != nil { + if err := rsutils.BodyParserHelper(c, &body); err != nil { return c.SendStatus(fiber.StatusBadRequest) } diff --git a/routers/router/api/v1/notification/notification.go b/routers/router/api/v1/notification/notification.go index 781e716..0e4fee1 100644 --- a/routers/router/api/v1/notification/notification.go +++ b/routers/router/api/v1/notification/notification.go @@ -5,6 +5,7 @@ import ( "jannex/admin-dashboard-backend/modules/structs" "jannex/admin-dashboard-backend/modules/utils" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/gofiber/fiber/v2" ) @@ -38,7 +39,7 @@ func AddNotification(c *fiber.Ctx) error { var body structs.AddNotificationRequest - if err := utils.BodyParserHelper(c, &body); err != nil { + if err := rsutils.BodyParserHelper(c, &body); err != nil { return c.SendStatus(fiber.StatusBadRequest) } @@ -72,7 +73,7 @@ func GetNotifications(c *fiber.Ctx) error { var query structs.PageQuery - if err := utils.QueryParserHelper(c, &query); err != nil { + if err := rsutils.QueryParserHelper(c, &query); err != nil { return c.SendStatus(fiber.StatusBadRequest) } diff --git a/routers/router/api/v1/user/auth.go b/routers/router/api/v1/user/auth.go index d24107b..2ce3cfd 100644 --- a/routers/router/api/v1/user/auth.go +++ b/routers/router/api/v1/user/auth.go @@ -8,6 +8,7 @@ import ( "jannex/admin-dashboard-backend/modules/utils" "jannex/admin-dashboard-backend/socketclients" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/gofiber/fiber/v2" "github.com/rs/zerolog/log" "github.com/savsgio/gotils/uuid" @@ -41,7 +42,7 @@ func UserLogin(c *fiber.Ctx) error { var body structs.UserLoginRequest - if err := utils.BodyParserHelper(c, &body); err != nil { + if err := rsutils.BodyParserHelper(c, &body); err != nil { return c.SendStatus(fiber.StatusBadRequest) } @@ -74,7 +75,7 @@ func UserLogin(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusUnauthorized) } - session, err := utils.GenerateSession() + session, err := rsutils.GenerateSession() if err != nil { return c.SendStatus(fiber.StatusInternalServerError) diff --git a/socketclients/socketclients.go b/socketclients/socketclients.go index a5e6535..9a950a3 100644 --- a/socketclients/socketclients.go +++ b/socketclients/socketclients.go @@ -14,6 +14,7 @@ import ( "strings" "time" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/gofiber/websocket/v2" "github.com/google/uuid" "github.com/rs/zerolog/log" @@ -453,7 +454,7 @@ func UpdateUserProfile(conn *websocket.Conn, changes map[string]interface{}) { }, }) - logger.AddSystemLog("User %s has updated his account with the following changes: %v", userId, utils.MarshalJson(updates)) + logger.AddSystemLog("User %s has updated his account with the following changes: %v", userId, rsutils.MarshalJson(updates)) } } } @@ -634,7 +635,7 @@ func AdminAreaUpdateRole(conn *websocket.Conn, body map[string]interface{}) { }) logger.AddSystemLog("User %s has updated the role %s with the following changes: %v", - conn.Locals("userId").(string), roleId, utils.MarshalJson(updates)) + conn.Locals("userId").(string), roleId, rsutils.MarshalJson(updates)) } func AdminAreaMoveRoleToSortingOrder(conn *websocket.Conn, body map[string]interface{}) { @@ -992,7 +993,7 @@ func GetUserApiKeys(userId string) []structs.UserApiKey { } func CreateNewUserApiKey(userId string, apiName string) { - token, err := utils.GenerateSession() + token, err := rsutils.GenerateSession() if err != nil { return diff --git a/socketserver/hub.go b/socketserver/hub.go index b08a6ce..53f5177 100644 --- a/socketserver/hub.go +++ b/socketserver/hub.go @@ -14,6 +14,7 @@ import ( "jannex/admin-dashboard-backend/socketclients" "time" + "git.ex.umbach.dev/Alex/roese-utils/rsutils" "github.com/gofiber/websocket/v2" "github.com/google/uuid" "github.com/rs/zerolog/log" @@ -84,7 +85,7 @@ func RunHub() { groupId := receivedMessage.Body["id"].(string) - globalInputsJsonString := utils.MarshalJson(receivedMessage.Body["globalInputs"]) + globalInputsJsonString := rsutils.MarshalJson(receivedMessage.Body["globalInputs"]) log.Debug().Msgf("globalInputsJsonString %v", globalInputsJsonString) @@ -124,7 +125,7 @@ func RunHub() { GroupId: receivedMessage.Body["groupId"].(string), Step: uint8(receivedMessage.Body["step"].(float64)), TaskStepId: receivedMessage.Body["taskStepId"].(string), - TaskInputs: utils.MarshalJson(receivedMessage.Body["taskInputs"]), + TaskInputs: rsutils.MarshalJson(receivedMessage.Body["taskInputs"]), } go grouptasks.RunGroupTask(groupTaskArgs)