update and get customer
parent
adbd2fdc8c
commit
e789bfbb4e
35
go.mod
35
go.mod
|
@ -3,41 +3,40 @@ module jannex/admin-dashboard-backend
|
|||
go 1.21.0
|
||||
|
||||
require (
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.16
|
||||
github.com/gofiber/fiber v1.14.6
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.21
|
||||
github.com/gofiber/fiber/v2 v2.49.2
|
||||
github.com/gofiber/websocket/v2 v2.1.6
|
||||
github.com/google/uuid v1.3.1
|
||||
github.com/joho/godotenv v1.5.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
|
||||
golang.org/x/crypto v0.15.0
|
||||
gorm.io/driver/mysql v1.5.2
|
||||
gorm.io/gorm v1.25.5
|
||||
)
|
||||
|
||||
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/andybalholm/brotli v1.0.6 // indirect
|
||||
github.com/fasthttp/websocket v1.5.7 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // 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/gofiber/utils v0.0.10 // indirect
|
||||
github.com/gorilla/schema v1.1.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.1 // indirect
|
||||
github.com/gofiber/utils v1.1.0 // indirect
|
||||
github.com/gorilla/schema v1.2.1 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/klauspost/compress v1.16.7 // indirect
|
||||
github.com/klauspost/compress v1.17.3 // 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.19 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.49.0 // indirect
|
||||
github.com/valyala/fasthttp v1.51.0 // indirect
|
||||
github.com/valyala/tcplisten v1.0.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
|
||||
golang.org/x/net v0.18.0 // indirect
|
||||
golang.org/x/sys v0.14.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
)
|
||||
|
|
68
go.sum
68
go.sum
|
@ -1,39 +1,46 @@
|
|||
git.ex.umbach.dev/Alex/roese-utils v1.0.16 h1:B9yVx5nL7FfUPJmqHDs58mq8MB2wSox1fK34EP3dqhc=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.16/go.mod h1:mov3ZaoSu+GBQU1uXN/AfSK6MF3/3WxUk38Tb6IKxbI=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.19 h1:o7WiO+vajQm2M7/y5IYFM9uuBFBc8Y4LIymmx+LBgo8=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.19/go.mod h1:hFcnKQl6nuGFEMCxK/eVQBUD6ixBFlAaiy4E2aQqUL8=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.20 h1:uGAuGE66qhtOhTWOAEDoo5+3Xt9Yw8hruu/HuCNnjmY=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.20/go.mod h1:hFcnKQl6nuGFEMCxK/eVQBUD6ixBFlAaiy4E2aQqUL8=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.21 h1:ae1AHQh8UHJVLbpk5Gf4S5IP0EEWGD1JFIeX9cIcYcc=
|
||||
git.ex.umbach.dev/Alex/roese-utils v1.0.21/go.mod h1:hFcnKQl6nuGFEMCxK/eVQBUD6ixBFlAaiy4E2aQqUL8=
|
||||
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
|
||||
github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/fasthttp/websocket v1.5.7 h1:0a6o2OfeATvtGgoMKleURhLT6JqWPg7fYfWnH4KHau4=
|
||||
github.com/fasthttp/websocket v1.5.7/go.mod h1:bC4fxSono9czeXHQUVKxsC0sNjbm7lPJR04GDFqClfU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
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.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-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=
|
||||
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
|
||||
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gofiber/fiber v1.14.6 h1:QRUPvPmr8ijQuGo1MgupHBn8E+wW0IKqiOvIZPtV70o=
|
||||
github.com/gofiber/fiber v1.14.6/go.mod h1:Yw2ekF1YDPreO9V6TMYjynu94xRxZBdaa8X5HhHsjCM=
|
||||
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/utils v0.0.10 h1:3Mr7X7JdCUo7CWf/i5sajSaDmArEDtti8bM1JUVso2U=
|
||||
github.com/gofiber/utils v0.0.10/go.mod h1:9J5aHFUIjq0XfknT4+hdSMG6/jzfaAgCu4HEbWDeBlo=
|
||||
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
|
||||
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
|
||||
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.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY=
|
||||
github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
|
||||
github.com/gorilla/schema v1.2.1 h1:tjDxcmdb+siIqkTNoV+qRH2mjYdr2hHe5MKXbp61ziM=
|
||||
github.com/gorilla/schema v1.2.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
|
||||
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=
|
||||
|
@ -41,8 +48,8 @@ github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/
|
|||
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.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/compress v1.17.3 h1:qkRjuerhUU1EmXLYGkSH6EZL+vPSxIrYjLNAK4slzwA=
|
||||
github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
|
||||
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.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
|
@ -50,15 +57,17 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec
|
|||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
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-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/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/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
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=
|
||||
|
@ -74,17 +83,17 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
|
|||
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.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA=
|
||||
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/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
||||
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
|
||||
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
|
||||
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
|
||||
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
@ -92,17 +101,18 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
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/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
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=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.5.0 h1:6hSAT5QcyIaty0jfnff0z0CLDjyRgZ8mlMHLqSt7uXM=
|
||||
gorm.io/driver/mysql v1.5.0/go.mod h1:FFla/fJuCvyTi7rJQd27qlNX2v3L6deTR1GgTjSOLPo=
|
||||
gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs=
|
||||
gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8=
|
||||
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls=
|
||||
gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package crm
|
||||
|
||||
import (
|
||||
"jannex/admin-dashboard-backend/modules/database"
|
||||
"jannex/admin-dashboard-backend/modules/structs"
|
||||
"jannex/admin-dashboard-backend/modules/utils"
|
||||
|
||||
"git.ex.umbach.dev/Alex/roese-utils/rspagination"
|
||||
)
|
||||
|
||||
func GetTableCustomers(params structs.CrmTypeCustomerRequest, query rspagination.PageQuery) []structs.CrmTableCustomer {
|
||||
var customers []structs.CrmTableCustomer
|
||||
|
||||
if params.Type == utils.CrmPipelineCustomers {
|
||||
rspagination.DbPageQuery(database.DB,
|
||||
query,
|
||||
utils.CrmCustomersPaginationLimit,
|
||||
&customers,
|
||||
"created_at DESC",
|
||||
nil)
|
||||
} else {
|
||||
var pipeline uint8
|
||||
|
||||
if params.Type == utils.CrmPipelineDmcPipeline {
|
||||
pipeline = utils.CrmPipelineDmcPipelineInt
|
||||
} else {
|
||||
pipeline = utils.CrmPipelineSetterCloserInt
|
||||
}
|
||||
|
||||
rspagination.DbPageQuery(database.DB,
|
||||
query,
|
||||
utils.CrmCustomersPaginationLimit,
|
||||
&customers,
|
||||
"created_at DESC",
|
||||
structs.CrmCustomer{
|
||||
Pipeline: pipeline,
|
||||
DealPhase: params.DealPhase})
|
||||
}
|
||||
|
||||
return customers
|
||||
}
|
|
@ -45,4 +45,5 @@ func InitDatabase() {
|
|||
db.AutoMigrate(&structs.EquipmentDocumentation{})
|
||||
db.AutoMigrate(&structs.Notification{})
|
||||
db.AutoMigrate(&structs.LogManagerServerConnection{})
|
||||
db.AutoMigrate(&structs.CrmCustomer{})
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"git.ex.umbach.dev/Alex/roese-utils/rslogger"
|
||||
"github.com/gofiber/fiber"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func AddSystemLog(logType string, format string, v ...any) {
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package structs
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// swagger:model CrmCustomer
|
||||
type CrmCustomer struct {
|
||||
Id string
|
||||
Pipeline uint8
|
||||
DealPhase uint8
|
||||
FirstName string
|
||||
LastName string
|
||||
CreatedAt time.Time
|
||||
Telephone string
|
||||
Email string
|
||||
LastContact time.Time
|
||||
CreatedBy string
|
||||
Notes string
|
||||
Company string
|
||||
ZipCode string
|
||||
Address string
|
||||
City string
|
||||
Country string
|
||||
FederalState string
|
||||
Website string
|
||||
LeadOrigin string
|
||||
NumberOfEmployees string
|
||||
NumberOfJobsSearchedFor string
|
||||
JobTitle string
|
||||
NumberOfEmployeesRequired string
|
||||
HowLongHadHeBeenSearching string
|
||||
Turnover string
|
||||
DateOfCompletion string
|
||||
OrderVolume string
|
||||
NumberOfInstallments string
|
||||
AmountsOfTheInstallments string
|
||||
BookedPackages string
|
||||
AssignedEmployee string
|
||||
}
|
||||
|
||||
// swagger:model CrmTableCustomerResponse
|
||||
type CrmTableCustomerResponse struct {
|
||||
Customers []CrmTableCustomer
|
||||
TotalPages int
|
||||
}
|
||||
|
||||
type CrmTableCustomer struct {
|
||||
Id string
|
||||
FirstName string
|
||||
LastName string
|
||||
CreatedAt time.Time
|
||||
Telephone string
|
||||
Email string
|
||||
LastContact time.Time
|
||||
CreatedBy string
|
||||
Notes string
|
||||
}
|
||||
|
||||
func (CrmTableCustomer) TableName() string {
|
||||
return "crm_customers"
|
||||
}
|
||||
|
||||
type CrmTypeCustomerRequest struct {
|
||||
Type string // pipeline name
|
||||
DealPhase uint8
|
||||
}
|
||||
|
||||
type CrmGetCustomerRequest struct {
|
||||
Id string
|
||||
}
|
|
@ -39,6 +39,13 @@ const (
|
|||
EquipmentDocumentationsPaginationLimit = 3
|
||||
GroupTasksPaginationLimit = 5
|
||||
NotificationsPaginationLimit = 10
|
||||
CrmCustomersPaginationLimit = 10
|
||||
|
||||
CrmPipelineCustomers = "customers"
|
||||
CrmPipelineDmcPipeline = "dmc-pipeline"
|
||||
CrmPipelineDmcPipelineInt = 1 // used for database
|
||||
CrmPipelineSetterCloser = "setter-closer"
|
||||
CrmPipelineSetterCloserInt = 2 // used for database
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -93,6 +100,7 @@ const (
|
|||
SentCmdAdminAreaManageCheckedForAvailableCategories = 44
|
||||
SentCmdAdminAreaManageLogManagerServerConnectionAdded = 45
|
||||
SentCmdAdminAreaManageLogManagerServerConnectionRemoved = 46
|
||||
SentCmdCrmCustomerUpdated = 47
|
||||
)
|
||||
|
||||
// commands received from web clients
|
||||
|
@ -206,6 +214,12 @@ const (
|
|||
PermissionsRoboticsRobotsEnablePermitJoin = "robotics.robots.enable_permit_join"
|
||||
PermissionsRoboticsRobotsAuthorizeDenyUnauthorizedRobots = "robotics.robots.authorize_deny_unauthorized_robots"
|
||||
PermissionsRoboticsRobotsViewSwaggerDocumentation = "robotics.robots.view_swagger_documentation"
|
||||
|
||||
_crm = "crm."
|
||||
PermissionCrmCustomersView = _crm + "customers.view"
|
||||
PermissionCrmCustomersEdit = _crm + "customers.edit"
|
||||
PermissionCrmDmcPipelineView = _crm + "dmc_pipeline.view"
|
||||
PermissionCrmSetterCloserView = _crm + "setter_closer.view"
|
||||
)
|
||||
|
||||
var SystemPermissions = []string{
|
||||
|
@ -237,6 +251,10 @@ var SystemPermissions = []string{
|
|||
PermissionsRoboticsRobotsEnablePermitJoin,
|
||||
PermissionsRoboticsRobotsAuthorizeDenyUnauthorizedRobots,
|
||||
PermissionsRoboticsRobotsViewSwaggerDocumentation,
|
||||
PermissionCrmCustomersView,
|
||||
PermissionCrmCustomersEdit,
|
||||
PermissionCrmDmcPipelineView,
|
||||
PermissionCrmSetterCloserView,
|
||||
}
|
||||
|
||||
var DynamicGroupTasksPermissions = []string{
|
||||
|
@ -261,4 +279,6 @@ const (
|
|||
SubscribedTopicConsoles = "/consoles"
|
||||
|
||||
SubscribedTopicAdminAreaManage = "/admin-area/manage"
|
||||
|
||||
SubscribedTopicCrm = "/crm/"
|
||||
)
|
||||
|
|
|
@ -52,6 +52,87 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/crm/customer/{id}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"crm"
|
||||
],
|
||||
"summary": "Get crm customer",
|
||||
"operationId": "crmGetCrmCustomer",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Customer id",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Crm customer",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CrmCustomer"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request query"
|
||||
},
|
||||
"401": {
|
||||
"description": "No permissions"
|
||||
},
|
||||
"404": {
|
||||
"description": "Crm customer not found"
|
||||
},
|
||||
"500": {
|
||||
"description": "Failed to get crm customer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/crm/{type}/{dealPhase}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"crm"
|
||||
],
|
||||
"summary": "Get crm customers",
|
||||
"operationId": "crmGetCrmCustomers",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Page number",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Crm customers",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CrmTableCustomerResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request query"
|
||||
},
|
||||
"401": {
|
||||
"description": "No permissions"
|
||||
},
|
||||
"404": {
|
||||
"description": "Crm type not found"
|
||||
},
|
||||
"422": {
|
||||
"description": "Deal phase not set"
|
||||
},
|
||||
"500": {
|
||||
"description": "Failed to get crm customers"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/equipment/documentation/create": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
|
@ -347,11 +428,6 @@
|
|||
"description": "Page number",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"description": "Number of items per page",
|
||||
"name": "perPage",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
@ -926,6 +1002,160 @@
|
|||
},
|
||||
"x-go-package": "jannex/admin-dashboard-backend/modules/structs"
|
||||
},
|
||||
"CrmCustomer": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Address": {
|
||||
"type": "string"
|
||||
},
|
||||
"AmountsOfTheInstallments": {
|
||||
"type": "string"
|
||||
},
|
||||
"AssignedEmployee": {
|
||||
"type": "string"
|
||||
},
|
||||
"BookedPackages": {
|
||||
"type": "string"
|
||||
},
|
||||
"City": {
|
||||
"type": "string"
|
||||
},
|
||||
"Company": {
|
||||
"type": "string"
|
||||
},
|
||||
"Country": {
|
||||
"type": "string"
|
||||
},
|
||||
"CreatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"CreatedBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"DateOfCompletion": {
|
||||
"type": "string"
|
||||
},
|
||||
"DealPhase": {
|
||||
"type": "integer",
|
||||
"format": "uint8"
|
||||
},
|
||||
"Email": {
|
||||
"type": "string"
|
||||
},
|
||||
"FederalState": {
|
||||
"type": "string"
|
||||
},
|
||||
"FirstName": {
|
||||
"type": "string"
|
||||
},
|
||||
"HowLongHadHeBeenSearching": {
|
||||
"type": "string"
|
||||
},
|
||||
"Id": {
|
||||
"type": "string"
|
||||
},
|
||||
"JobTitle": {
|
||||
"type": "string"
|
||||
},
|
||||
"LastContact": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"LastName": {
|
||||
"type": "string"
|
||||
},
|
||||
"LeadOrigin": {
|
||||
"type": "string"
|
||||
},
|
||||
"Notes": {
|
||||
"type": "string"
|
||||
},
|
||||
"NumberOfEmployees": {
|
||||
"type": "string"
|
||||
},
|
||||
"NumberOfEmployeesRequired": {
|
||||
"type": "string"
|
||||
},
|
||||
"NumberOfInstallments": {
|
||||
"type": "string"
|
||||
},
|
||||
"NumberOfJobsSearchedFor": {
|
||||
"type": "string"
|
||||
},
|
||||
"OrderVolume": {
|
||||
"type": "string"
|
||||
},
|
||||
"Pipeline": {
|
||||
"type": "integer",
|
||||
"format": "uint8"
|
||||
},
|
||||
"Telephone": {
|
||||
"type": "string"
|
||||
},
|
||||
"Turnover": {
|
||||
"type": "string"
|
||||
},
|
||||
"Website": {
|
||||
"type": "string"
|
||||
},
|
||||
"ZipCode": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"x-go-package": "jannex/admin-dashboard-backend/modules/structs"
|
||||
},
|
||||
"CrmTableCustomer": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"CreatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"CreatedBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"Email": {
|
||||
"type": "string"
|
||||
},
|
||||
"FirstName": {
|
||||
"type": "string"
|
||||
},
|
||||
"Id": {
|
||||
"type": "string"
|
||||
},
|
||||
"LastContact": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"LastName": {
|
||||
"type": "string"
|
||||
},
|
||||
"Notes": {
|
||||
"type": "string"
|
||||
},
|
||||
"Telephone": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"x-go-package": "jannex/admin-dashboard-backend/modules/structs"
|
||||
},
|
||||
"CrmTableCustomerResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Customers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/CrmTableCustomer"
|
||||
}
|
||||
},
|
||||
"TotalPages": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
},
|
||||
"x-go-package": "jannex/admin-dashboard-backend/modules/structs"
|
||||
},
|
||||
"EditEquipmentDocumentationRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
package crm
|
||||
|
||||
import (
|
||||
"jannex/admin-dashboard-backend/modules/crm"
|
||||
"jannex/admin-dashboard-backend/modules/database"
|
||||
"jannex/admin-dashboard-backend/modules/structs"
|
||||
"jannex/admin-dashboard-backend/modules/utils"
|
||||
"jannex/admin-dashboard-backend/socketclients"
|
||||
|
||||
"git.ex.umbach.dev/Alex/roese-utils/rspagination"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func GetCrmTypeCustomers(c *fiber.Ctx) error {
|
||||
// swagger:operation GET /crm/pipeline/{type}/{dealPhase} crm crmGetCrmCustomers
|
||||
// ---
|
||||
// summary: Get crm customers
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: page
|
||||
// in: query
|
||||
// description: Page number
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Crm customers
|
||||
// schema:
|
||||
// "$ref": "#/definitions/CrmTableCustomerResponse"
|
||||
// '400':
|
||||
// description: Invalid request query
|
||||
// '401':
|
||||
// description: No permissions
|
||||
// '404':
|
||||
// description: Crm type not found
|
||||
// '422':
|
||||
// description: Deal phase not set
|
||||
// '500':
|
||||
// description: Failed to get crm customers
|
||||
|
||||
var params structs.CrmTypeCustomerRequest
|
||||
|
||||
if err := c.ParamsParser(¶ms); err != nil {
|
||||
return c.SendStatus(fiber.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !socketclients.HasPermission(c.Locals("userId").(string), utils.PermissionCrmCustomersView) {
|
||||
return c.SendStatus(fiber.StatusUnauthorized)
|
||||
}
|
||||
|
||||
var query rspagination.PageQuery
|
||||
|
||||
if err := c.QueryParser(&query); err != nil {
|
||||
return c.SendStatus(fiber.StatusBadRequest)
|
||||
}
|
||||
|
||||
if params.Type == utils.CrmPipelineCustomers {
|
||||
return c.JSON(structs.CrmTableCustomerResponse{
|
||||
Customers: crm.GetTableCustomers(params, query),
|
||||
TotalPages: rspagination.GetTotalPages(database.DB,
|
||||
utils.CrmCustomersPaginationLimit,
|
||||
[]structs.CrmCustomer{},
|
||||
nil),
|
||||
})
|
||||
}
|
||||
|
||||
// Check if deal phase is set
|
||||
if params.DealPhase == 0 {
|
||||
return c.SendStatus(fiber.StatusUnprocessableEntity)
|
||||
}
|
||||
|
||||
if params.Type == utils.CrmPipelineDmcPipeline {
|
||||
return c.JSON(structs.CrmTableCustomerResponse{
|
||||
Customers: crm.GetTableCustomers(params, query),
|
||||
TotalPages: rspagination.GetTotalPages(database.DB,
|
||||
utils.CrmCustomersPaginationLimit,
|
||||
[]structs.CrmCustomer{},
|
||||
structs.CrmCustomer{
|
||||
Pipeline: utils.CrmPipelineDmcPipelineInt,
|
||||
DealPhase: params.DealPhase}),
|
||||
})
|
||||
}
|
||||
|
||||
if params.Type == utils.CrmPipelineSetterCloser {
|
||||
return c.JSON(structs.CrmTableCustomerResponse{
|
||||
Customers: crm.GetTableCustomers(params, query),
|
||||
TotalPages: rspagination.GetTotalPages(database.DB,
|
||||
utils.CrmCustomersPaginationLimit,
|
||||
[]structs.CrmCustomer{},
|
||||
structs.CrmCustomer{
|
||||
Pipeline: utils.CrmPipelineSetterCloserInt,
|
||||
DealPhase: params.DealPhase}),
|
||||
})
|
||||
}
|
||||
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
func GetCrmCustomer(c *fiber.Ctx) error {
|
||||
// swagger:operation GET /crm/customer/view/{id} crm crmGetCrmCustomer
|
||||
// ---
|
||||
// summary: Get crm customer
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: id
|
||||
// in: path
|
||||
// description: Customer id
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Crm customer
|
||||
// schema:
|
||||
// "$ref": "#/definitions/CrmCustomer"
|
||||
// '400':
|
||||
// description: Invalid request query
|
||||
// '401':
|
||||
// description: No permissions
|
||||
// '404':
|
||||
// description: Crm customer not found
|
||||
// '500':
|
||||
// description: Failed to get crm customer
|
||||
|
||||
var params structs.CrmGetCustomerRequest
|
||||
|
||||
if err := c.ParamsParser(¶ms); err != nil {
|
||||
return c.SendStatus(fiber.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !socketclients.HasPermission(c.Locals("userId").(string), utils.PermissionCrmCustomersView) {
|
||||
return c.SendStatus(fiber.StatusUnauthorized)
|
||||
}
|
||||
|
||||
var customer structs.CrmCustomer
|
||||
|
||||
database.DB.First(&customer, "id = ?", params.Id)
|
||||
|
||||
if customer.Id != params.Id {
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
return c.JSON(customer)
|
||||
}
|
||||
|
||||
func UpdateCrmCustomer(c *fiber.Ctx) error {
|
||||
// swagger:operation POST /crm/customer/update/{id} crm crmUpdateCrmCustomer
|
||||
// ---
|
||||
// summary: Update crm customer
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: id
|
||||
// in: path
|
||||
// description: Customer id
|
||||
// - name: crmCustomer
|
||||
// in: body
|
||||
// description: Crm customer
|
||||
// schema:
|
||||
// "$ref": "#/definitions/CrmCustomer"
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Crm customer
|
||||
// schema:
|
||||
// "$ref": "#/definitions/CrmCustomer"
|
||||
// '400':
|
||||
// description: Invalid request query
|
||||
// '401':
|
||||
// description: No permissions
|
||||
// '404':
|
||||
// description: Crm customer not found
|
||||
// '500':
|
||||
// description: Failed to update crm customer
|
||||
|
||||
var params structs.CrmGetCustomerRequest
|
||||
|
||||
if err := c.ParamsParser(¶ms); err != nil {
|
||||
return c.SendStatus(fiber.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !socketclients.HasPermission(c.Locals("userId").(string), utils.PermissionCrmCustomersEdit) {
|
||||
return c.SendStatus(fiber.StatusUnauthorized)
|
||||
}
|
||||
|
||||
var customer structs.CrmCustomer
|
||||
|
||||
database.DB.First(&customer, "id = ?", params.Id)
|
||||
|
||||
if customer.Id != params.Id {
|
||||
return c.SendStatus(fiber.StatusNotFound)
|
||||
}
|
||||
|
||||
var crmCustomer structs.CrmCustomer
|
||||
|
||||
if err := c.BodyParser(&crmCustomer); err != nil {
|
||||
return c.SendStatus(fiber.StatusBadRequest)
|
||||
}
|
||||
|
||||
log.Info().Msgf("%+v %v", crmCustomer, crmCustomer.Telephone)
|
||||
|
||||
database.DB.Model(&structs.CrmCustomer{}).
|
||||
Where("id = ?", params.Id).
|
||||
Select("*"). // update all fields (even if they are empty)
|
||||
Updates(crmCustomer)
|
||||
|
||||
socketclients.BroadcastMessageToTopicStartsWith(utils.SubscribedTopicCrm, structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdCrmCustomerUpdated,
|
||||
Body: crmCustomer,
|
||||
})
|
||||
|
||||
return c.JSON(crmCustomer)
|
||||
}
|
|
@ -30,11 +30,6 @@ func GetGroupTasks(c *fiber.Ctx) error {
|
|||
// - name: page
|
||||
// in: query
|
||||
// description: Page number
|
||||
// required: false
|
||||
// - name: perPage
|
||||
// in: query
|
||||
// description: Number of items per page
|
||||
// required: false
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Group tasks
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"jannex/admin-dashboard-backend/modules/structs"
|
||||
"jannex/admin-dashboard-backend/modules/utils"
|
||||
adminarea "jannex/admin-dashboard-backend/routers/router/api/v1/adminArea"
|
||||
"jannex/admin-dashboard-backend/routers/router/api/v1/crm"
|
||||
"jannex/admin-dashboard-backend/routers/router/api/v1/equipment"
|
||||
"jannex/admin-dashboard-backend/routers/router/api/v1/grouptasks"
|
||||
"jannex/admin-dashboard-backend/routers/router/api/v1/logmanagerserverconnections"
|
||||
|
@ -66,6 +67,11 @@ func SetupRoutes(app *fiber.App) {
|
|||
l := v1.Group("/lmsc") // logmanagerserverconnections
|
||||
l.Get("/", requestAccessValidation, logmanagerserverconnections.GetConnectedLogManagerServers)
|
||||
|
||||
c := v1.Group("/crm")
|
||||
c.Get("/pipeline/:type/:dealPhase", requestAccessValidation, crm.GetCrmTypeCustomers)
|
||||
c.Get("/customer/view/:id", requestAccessValidation, crm.GetCrmCustomer)
|
||||
c.Post("/customer/update/:id", requestAccessValidation, crm.UpdateCrmCustomer)
|
||||
|
||||
app.Static("/", config.Cfg.FolderPaths.PublicStatic)
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,14 @@ func BroadcastMessageToTopic(topic string, sendSocketMessage structs.SendSocketM
|
|||
}
|
||||
}
|
||||
|
||||
func BroadcastMessageToTopicStartsWith(topic string, sendSocketMessage structs.SendSocketMessage) {
|
||||
for _, client := range cache.GetSocketClients() {
|
||||
if strings.HasPrefix(client.SubscribedTopic, topic) {
|
||||
client.SendMessage(sendSocketMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BroadcastMessageToTopics(topics []string, sendSocketMessage structs.SendSocketMessage) {
|
||||
for _, topic := range topics {
|
||||
BroadcastMessageToTopic(topic, sendSocketMessage)
|
||||
|
|
Loading…
Reference in New Issue