From cba1aa93633bdc8715f71e3ecefc26bd744f496d Mon Sep 17 00:00:00 2001 From: Mansi Canopas <115449373+cp-mansi-d@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:16:49 +0530 Subject: [PATCH] Fix : Blog API image issue (#599) * update source code pro file * update version of blog-kit * deploy changes on dev * deploy changes on dev * revert deploy code * run prettier * Fix : post api image issue * minor change * update query --- go.mod | 9 +- go.sum | 14 ++- nuxt-frontend/package.json | 2 +- nuxt-frontend/yarn.lock | 178 +++++++++++++++++++++---------------- post/index.go | 41 +++++++-- post/models.go | 4 + 6 files changed, 149 insertions(+), 99 deletions(-) diff --git a/go.mod b/go.mod index d641e785e..7ce372b41 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( jobs v0.0.0-00010101000000-000000000000 leave v0.0.0-00010101000000-000000000000 notification v0.0.0-00010101000000-000000000000 + post v0.0.0-00010101000000-000000000000 sitemap v0.0.0-00010101000000-000000000000 utils v0.0.0-00010101000000-000000000000 ) @@ -71,18 +72,17 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.0.9 // indirect - github.com/samber/lo v1.39.0 // indirect + github.com/samber/lo v1.47.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect go.opencensus.io v0.24.0 // indirect golang.org/x/arch v0.4.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect - golang.org/x/sync v0.3.0 // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/text v0.16.0 // indirect google.golang.org/api v0.136.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230807174057-1744710a1577 // indirect @@ -94,5 +94,4 @@ require ( gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect gopkg.in/guregu/null.v3 v3.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - post v0.0.0-00010101000000-000000000000 // indirect ) diff --git a/go.sum b/go.sum index 60c6baf42..93e3bb97b 100644 --- a/go.sum +++ b/go.sum @@ -168,8 +168,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= -github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= +github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= +github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -208,8 +208,6 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= -golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -238,8 +236,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/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.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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= @@ -265,8 +263,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/nuxt-frontend/package.json b/nuxt-frontend/package.json index 909274cb4..4cf6103ef 100644 --- a/nuxt-frontend/package.json +++ b/nuxt-frontend/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.22.15", - "@canopassoftware/nuxt-blog-kit": "^1.1.11", + "@canopassoftware/nuxt-blog-kit": "^1.1.12", "@ivanv/vue-collapse-transition": "^1.0.2", "@nuxt/devtools": "latest", "@nuxtjs/sitemap": "^5.1.0", diff --git a/nuxt-frontend/yarn.lock b/nuxt-frontend/yarn.lock index cef28a617..0d51a842c 100644 --- a/nuxt-frontend/yarn.lock +++ b/nuxt-frontend/yarn.lock @@ -1761,10 +1761,10 @@ "@babel/helper-string-parser" "^7.25.9" "@babel/helper-validator-identifier" "^7.25.9" -"@canopassoftware/nuxt-blog-kit@^1.1.11": - version "1.1.11" - resolved "https://registry.yarnpkg.com/@canopassoftware/nuxt-blog-kit/-/nuxt-blog-kit-1.1.11.tgz#83f676cf651c8e8238b4de8a1e7923d5ab17a636" - integrity sha512-H/uf6pAwRls9mtmmp4T+BnhaldY8cxyVNsZe1eZcVVecA03phlcmjD/i+odoRaibpTffMaV/Lv29h28HXppDZw== +"@canopassoftware/nuxt-blog-kit@^1.1.12": + version "1.1.12" + resolved "https://registry.yarnpkg.com/@canopassoftware/nuxt-blog-kit/-/nuxt-blog-kit-1.1.12.tgz#86723a04c44befc2f07c1255f964561ab4242553" + integrity sha512-Nk7L4QbZo3TvzX1+tv6TZueTi360uwdus2LYzZDYEawNjYNwca34EDmGM5sJl6laHnDlGJdxypBz0PPk7BmZhA== dependencies: "@nuxt/kit" "^3.7.4" "@pinia/nuxt" "^0.5.0" @@ -2394,19 +2394,19 @@ resolved "https://registry.npmjs.org/@nuxt/devalue/-/devalue-2.0.2.tgz" integrity sha512-GBzP8zOc7CGWyFQS6dv1lQz8VVpz5C2yRszbXufwG/9zhStTIH50EtD87NmWbTMwXDvZLNg8GIpb1UFdH93JCA== -"@nuxt/devtools-kit@1.4.2", "@nuxt/devtools-kit@^1.3.9", "@nuxt/devtools-kit@^1.4.2": - version "1.4.2" - resolved "https://registry.npmjs.org/@nuxt/devtools-kit/-/devtools-kit-1.4.2.tgz" - integrity sha512-8a5PhVnC7E94318/sHbNSe9mI2MlsQ8+pJLGs2Hh1OJyidB9SWe6hoFc8q4K9VOtXak9uCFVb5V2JGXS1q+1aA== +"@nuxt/devtools-kit@1.6.1", "@nuxt/devtools-kit@^1.3.9", "@nuxt/devtools-kit@^1.4.2": + version "1.6.1" + resolved "https://registry.npmjs.org/@nuxt/devtools-kit/-/devtools-kit-1.6.1.tgz" + integrity sha512-6pvK5ih4XONVMSABlDbq6q7/TrZ++hyXGn5zdROVU780aYX3EjU8F0sq+1Lmc6ieiJg4tNe/EA+zV1onKRPsrQ== dependencies: - "@nuxt/kit" "^3.13.1" - "@nuxt/schema" "^3.13.1" + "@nuxt/kit" "^3.13.2" + "@nuxt/schema" "^3.13.2" execa "^7.2.0" -"@nuxt/devtools-wizard@1.4.2": - version "1.4.2" - resolved "https://registry.npmjs.org/@nuxt/devtools-wizard/-/devtools-wizard-1.4.2.tgz" - integrity sha512-TyhmPBg/xJKPOdnwR3DAh8KMUt6/0dUNABCxGVeY7PYbIiXt4msIGVJkBc4y+WwIJHOYPrSRClmZVsXQfRlB4A== +"@nuxt/devtools-wizard@1.6.1": + version "1.6.1" + resolved "https://registry.npmjs.org/@nuxt/devtools-wizard/-/devtools-wizard-1.6.1.tgz" + integrity sha512-MpcKHgXJd4JyhJEvcIMTZqojyDFHLt9Wx2oWbV7YSEnubtHYxUM6p2M+Nb9/3mT+qoOiZQ+0db3xVcMW92oE8Q== dependencies: consola "^3.2.3" diff "^7.0.0" @@ -2420,16 +2420,16 @@ semver "^7.6.3" "@nuxt/devtools@^1.4.2", "@nuxt/devtools@latest": - version "1.4.2" - resolved "https://registry.npmjs.org/@nuxt/devtools/-/devtools-1.4.2.tgz" - integrity sha512-Ok3g2P7iwKyK8LiwozbYVAZTo8t91iXSmlJj2ozeo1okKQ2Qi1AtwB6nYgIlkUHZmo155ZjG/LCHYI5uhQ/sGw== + version "1.6.1" + resolved "https://registry.npmjs.org/@nuxt/devtools/-/devtools-1.6.1.tgz" + integrity sha512-s+4msaf8/REaXVbBDzjMgdUmEwR68hpoiQWx4QkH0JHSNQXWCWgNngqlZOM3DSRmPrelS57PJCag+L7gnT1wLw== dependencies: "@antfu/utils" "^0.7.10" - "@nuxt/devtools-kit" "1.4.2" - "@nuxt/devtools-wizard" "1.4.2" - "@nuxt/kit" "^3.13.1" - "@vue/devtools-core" "7.4.4" - "@vue/devtools-kit" "7.4.4" + "@nuxt/devtools-kit" "1.6.1" + "@nuxt/devtools-wizard" "1.6.1" + "@nuxt/kit" "^3.13.2" + "@vue/devtools-core" "7.6.4" + "@vue/devtools-kit" "7.6.4" birpc "^0.2.17" consola "^3.2.3" cronstrue "^2.50.0" @@ -2446,19 +2446,19 @@ local-pkg "^0.5.0" magicast "^0.3.5" nypm "^0.3.11" - ohash "^1.1.3" + ohash "^1.1.4" pathe "^1.1.2" perfect-debounce "^1.0.0" pkg-types "^1.2.0" rc9 "^2.1.2" scule "^1.3.0" semver "^7.6.3" - simple-git "^3.26.0" + simple-git "^3.27.0" sirv "^2.0.4" tinyglobby "^0.2.6" - unimport "^3.11.1" + unimport "^3.12.0" vite-plugin-inspect "^0.8.7" - vite-plugin-vue-inspector "^5.2.0" + vite-plugin-vue-inspector "5.1.3" which "^3.0.1" ws "^8.18.0" @@ -2487,7 +2487,7 @@ unplugin "^1.14.1" unstorage "^1.12.0" -"@nuxt/kit@3.13.2", "@nuxt/kit@^3.0.0", "@nuxt/kit@^3.12.3", "@nuxt/kit@^3.13.1", "@nuxt/kit@^3.3.2", "@nuxt/kit@^3.5.0", "@nuxt/kit@^3.6.5": +"@nuxt/kit@3.13.2", "@nuxt/kit@^3.0.0", "@nuxt/kit@^3.12.3", "@nuxt/kit@^3.13.1", "@nuxt/kit@^3.13.2", "@nuxt/kit@^3.3.2", "@nuxt/kit@^3.5.0", "@nuxt/kit@^3.6.5": version "3.13.2" resolved "https://registry.npmjs.org/@nuxt/kit/-/kit-3.13.2.tgz" integrity sha512-KvRw21zU//wdz25IeE1E5m/aFSzhJloBRAQtv+evcFeZvuroIxpIQuUqhbzuwznaUwpiWbmwlcsp5uOWmi4vwA== @@ -2539,7 +2539,7 @@ unimport "^3.13.2" untyped "^1.5.1" -"@nuxt/schema@3.13.2", "@nuxt/schema@^3.13.1": +"@nuxt/schema@3.13.2", "@nuxt/schema@^3.13.1", "@nuxt/schema@^3.13.2": version "3.13.2" resolved "https://registry.npmjs.org/@nuxt/schema/-/schema-3.13.2.tgz" integrity sha512-CCZgpm+MkqtOMDEgF9SWgGPBXlQ01hV/6+2reDEpJuqFPGzV8HYKPBcIFvn7/z5ahtgutHLzjP71Na+hYcqSpw== @@ -3885,48 +3885,48 @@ resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz" integrity sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g== -"@vue/devtools-core@7.4.4": - version "7.4.4" - resolved "https://registry.npmjs.org/@vue/devtools-core/-/devtools-core-7.4.4.tgz" - integrity sha512-DLxgA3DfeADkRzhAfm3G2Rw/cWxub64SdP5b+s5dwL30+whOGj+QNhmyFpwZ8ZTrHDFRIPj0RqNzJ8IRR1pz7w== +"@vue/devtools-core@7.6.4": + version "7.6.4" + resolved "https://registry.npmjs.org/@vue/devtools-core/-/devtools-core-7.6.4.tgz" + integrity sha512-blSwGVYpb7b5TALMjjoBiAl5imuBF7WEOAtaJaBMNikR8SQkm6mkUt4YlIKh9874/qoimwmpDOm+GHBZ4Y5m+g== dependencies: - "@vue/devtools-kit" "^7.4.4" - "@vue/devtools-shared" "^7.4.4" + "@vue/devtools-kit" "^7.6.4" + "@vue/devtools-shared" "^7.6.4" mitt "^3.0.1" nanoid "^3.3.4" pathe "^1.1.2" vite-hot-client "^0.2.3" -"@vue/devtools-kit@7.4.4": - version "7.4.4" - resolved "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.4.4.tgz" - integrity sha512-awK/4NfsUG0nQ7qnTM37m7ZkEUMREyPh8taFCX+uQYps/MTFEum0AD05VeGDRMXwWvMmGIcWX9xp8ZiBddY0jw== +"@vue/devtools-kit@7.6.4": + version "7.6.4" + resolved "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.6.4.tgz" + integrity sha512-Zs86qIXXM9icU0PiGY09PQCle4TI750IPLmAJzW5Kf9n9t5HzSYf6Rz6fyzSwmfMPiR51SUKJh9sXVZu78h2QA== dependencies: - "@vue/devtools-shared" "^7.4.4" - birpc "^0.2.17" + "@vue/devtools-shared" "^7.6.4" + birpc "^0.2.19" hookable "^5.5.3" mitt "^3.0.1" perfect-debounce "^1.0.0" speakingurl "^14.0.1" superjson "^2.2.1" -"@vue/devtools-kit@^7.4.4": - version "7.4.5" - resolved "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.4.5.tgz" - integrity sha512-Uuki4Z6Bc/ExvtlPkeDNGSAe4580R+HPcVABfTE9TF7BTz3Nntk7vxIRUyWblZkUEcB/x+wn2uofyt5i2LaUew== +"@vue/devtools-kit@^7.6.4": + version "7.6.5" + resolved "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.6.5.tgz" + integrity sha512-fLQhUwmUbtEDHW1SEiHUF5k2Ptw816As5ZUVb/SzrqkrJzXI8xjEIo8suNBe/N+ewdz/9m5ayeFH8fmcVIbr4Q== dependencies: - "@vue/devtools-shared" "^7.4.5" - birpc "^0.2.17" + "@vue/devtools-shared" "^7.6.5" + birpc "^0.2.19" hookable "^5.5.3" mitt "^3.0.1" perfect-debounce "^1.0.0" speakingurl "^14.0.1" superjson "^2.2.1" -"@vue/devtools-shared@^7.4.4", "@vue/devtools-shared@^7.4.5": - version "7.4.5" - resolved "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.4.5.tgz" - integrity sha512-2XgUOkL/7QDmyYI9J7cm+rz/qBhcGv+W5+i1fhwdQ0HQ1RowhdK66F0QBuJSz/5k12opJY8eN6m03/XZMs7imQ== +"@vue/devtools-shared@^7.6.4", "@vue/devtools-shared@^7.6.5": + version "7.6.5" + resolved "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.6.5.tgz" + integrity sha512-szsXQ0jlpjuFfmxb6F40qkSF4gtLC1W+dKRh/UiTulC+RekZsjqcN/qnVFkzqOO1YnzzShinZwfmv+MbfPJnpw== dependencies: rfdc "^1.4.1" @@ -4517,10 +4517,10 @@ bindings@^1.4.0: dependencies: file-uri-to-path "1.0.0" -birpc@^0.2.17: - version "0.2.17" - resolved "https://registry.npmjs.org/birpc/-/birpc-0.2.17.tgz" - integrity sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg== +birpc@^0.2.17, birpc@^0.2.19: + version "0.2.19" + resolved "https://registry.npmjs.org/birpc/-/birpc-0.2.19.tgz" + integrity sha512-5WeXXAvTmitV1RqJFppT5QtUiz2p1mRSYU000Jkft5ZUCLJIk4uQriYNO50HknxKwM6jd8utNc66K1qGIwwWBQ== bl@^4.1.0: version "4.1.0" @@ -5559,9 +5559,9 @@ electron-to-chromium@^1.5.4: integrity sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ== electron-to-chromium@^1.5.41: - version "1.5.65" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.65.tgz#e2b9d84d31e187a847e3ccdcfb415ddd4a3d1ea7" - integrity sha512-PWVzBjghx7/wop6n22vS2MLU8tKGd4Q91aCEGhG/TYmW6PP5OcSXcdnxTe1NNt0T66N8D6jxh4kC8UsdzOGaIw== + version "1.5.67" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.67.tgz#66ebd2be4a77469ac2760ef5e9e460ba9a43a845" + integrity sha512-nz88NNBsD7kQSAGGJyp8hS6xSPtWwqNogA0mjtc2nUYeEf3nURK9qpV18TuBdDmEDgVWotS8Wkzf+V52dSQ/LQ== emoji-regex@^8.0.0: version "8.0.0" @@ -6083,6 +6083,11 @@ fdir@^6.3.0: resolved "https://registry.npmjs.org/fdir/-/fdir-6.3.0.tgz" integrity sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ== +fdir@^6.4.2: + version "6.4.2" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.2.tgz#ddaa7ce1831b161bc3657bb99cb36e1622702689" + integrity sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ== + fflate@^0.4.4: version "0.4.8" resolved "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz" @@ -7002,6 +7007,11 @@ js-tokens@^9.0.0: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.0.tgz" integrity sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ== +js-tokens@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-9.0.1.tgz#2ec43964658435296f6761b34e10671c2d9527f4" + integrity sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ== + js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" @@ -7379,7 +7389,7 @@ magic-string@^0.30.0, magic-string@^0.30.10, magic-string@^0.30.11, magic-string dependencies: "@jridgewell/sourcemap-codec" "^1.5.0" -magic-string@^0.30.13: +magic-string@^0.30.14: version "0.30.14" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.14.tgz#e9bb29870b81cfc1ec3cc656552f5a7fcbf19077" integrity sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw== @@ -8299,9 +8309,9 @@ pinia@>=2.1.0, pinia@^2.1.6: vue-demi "^0.14.10" pinia@^2.1.7, pinia@^2.2.3: - version "2.2.6" - resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.2.6.tgz#ff93f35b8c02033eaedc8c92ad5f10f215d6c804" - integrity sha512-vIsR8JkDN5Ga2vAxqOE2cJj4VtsHnzpR1Fz30kClxlh0yCHfec6uoMeM3e/ddqmwFUejK3NlrcQa/shnpyT4hA== + version "2.2.8" + resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.2.8.tgz#78bccede31f39e0119188fdaf705c31a93da6d5f" + integrity sha512-NRTYy2g+kju5tBRe0oNlriZIbMNvma8ZJrpHsp3qudyiMEA8jMmPPKQ2QMHg0Oc4BkUyQYWagACabrwriCK9HQ== dependencies: "@vue/devtools-api" "^6.6.3" vue-demi "^0.14.10" @@ -9389,7 +9399,7 @@ signal-exit@^4.0.1, signal-exit@^4.1.0: resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -simple-git@^3.26.0: +simple-git@^3.27.0: version "3.27.0" resolved "https://registry.npmjs.org/simple-git/-/simple-git-3.27.0.tgz" integrity sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA== @@ -9602,6 +9612,13 @@ strip-literal@^2.1.0: dependencies: js-tokens "^9.0.0" +strip-literal@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-2.1.1.tgz#26906e65f606d49f748454a08084e94190c2e5ad" + integrity sha512-631UJ6O00eNGfMiWG78ck80dfBab8X6IVFB51jZK5Icd7XAs60Z5y7QdSd/wGIklnWvRbUNloVzhOKKmutxQ6Q== + dependencies: + js-tokens "^9.0.1" + strnum@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz" @@ -9846,6 +9863,14 @@ tinyglobby@0.2.6, tinyglobby@^0.2.6: fdir "^6.3.0" picomatch "^4.0.2" +tinyglobby@^0.2.10: + version "0.2.10" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.10.tgz#e712cf2dc9b95a1f5c5bbd159720e15833977a0f" + integrity sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew== + dependencies: + fdir "^6.4.2" + picomatch "^4.0.2" + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" @@ -10030,7 +10055,7 @@ unicorn-magic@^0.1.0: resolved "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz" integrity sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ== -unimport@^3.11.1, unimport@^3.12.0, unimport@^3.7.2: +unimport@^3.12.0, unimport@^3.7.2: version "3.12.0" resolved "https://registry.npmjs.org/unimport/-/unimport-3.12.0.tgz" integrity sha512-5y8dSvNvyevsnw4TBQkIQR1Rjdbb+XjVSwQwxltpnVZrStBvvPkMPcZrh1kg5kY77kpx6+D4Ztd3W6FOBH/y2Q== @@ -10050,22 +10075,23 @@ unimport@^3.11.1, unimport@^3.12.0, unimport@^3.7.2: unplugin "^1.14.1" unimport@^3.13.2: - version "3.13.3" - resolved "https://registry.yarnpkg.com/unimport/-/unimport-3.13.3.tgz#443bbe6bcee0f7cba159bf4c7ea1f4f3891482c2" - integrity sha512-dr7sjOoRFCSDlnARFPAMB8OmjIMc6j14qd749VmB1yiqFEYFbi+1jWPTuc22JoFs/t1kHJXT3vQNiwCy3ZvsTA== + version "3.14.1" + resolved "https://registry.yarnpkg.com/unimport/-/unimport-3.14.1.tgz#405a879c3fb89a149cdf9e60210c28a08d299c57" + integrity sha512-5QERqIMwhLoTYFZN++HvjxF/uR6CJrtEFfS1MAWnerhjo3uXsXJalxMDecTt7zQL0u+USNG9UllPyapxiNZGPA== dependencies: "@rollup/pluginutils" "^5.1.3" acorn "^8.14.0" escape-string-regexp "^5.0.0" estree-walker "^3.0.3" - fast-glob "^3.3.2" local-pkg "^0.5.1" - magic-string "^0.30.13" + magic-string "^0.30.14" mlly "^1.7.3" pathe "^1.1.2" + picomatch "^4.0.2" pkg-types "^1.2.1" scule "^1.3.0" - strip-literal "^2.1.0" + strip-literal "^2.1.1" + tinyglobby "^0.2.10" unplugin "^1.16.0" universalify@^2.0.0: @@ -10239,9 +10265,9 @@ vary@^1.1.2, vary@~1.1.2: integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== vite-hot-client@^0.2.3: - version "0.2.3" - resolved "https://registry.npmjs.org/vite-hot-client/-/vite-hot-client-0.2.3.tgz" - integrity sha512-rOGAV7rUlUHX89fP2p2v0A2WWvV3QMX2UYq0fRqsWSvFvev4atHWqjwGoKaZT1VTKyLGk533ecu3eyd0o59CAg== + version "0.2.4" + resolved "https://registry.npmjs.org/vite-hot-client/-/vite-hot-client-0.2.4.tgz" + integrity sha512-a1nzURqO7DDmnXqabFOliz908FRmIppkBKsJthS8rbe8hBEXwEwe4C3Pp33Z1JoFCYfVL4kTOMLKk0ZZxREIeA== vite-node@^2.1.1: version "2.1.1" @@ -10288,10 +10314,10 @@ vite-plugin-inspect@^0.8.7: picocolors "^1.0.1" sirv "^2.0.4" -vite-plugin-vue-inspector@^5.2.0: - version "5.2.0" - resolved "https://registry.npmjs.org/vite-plugin-vue-inspector/-/vite-plugin-vue-inspector-5.2.0.tgz" - integrity sha512-wWxyb9XAtaIvV/Lr7cqB1HIzmHZFVUJsTNm3yAxkS87dgh/Ky4qr2wDEWNxF23fdhVa3jQ8MZREpr4XyiuaRqA== +vite-plugin-vue-inspector@5.1.3: + version "5.1.3" + resolved "https://registry.npmjs.org/vite-plugin-vue-inspector/-/vite-plugin-vue-inspector-5.1.3.tgz" + integrity sha512-pMrseXIDP1Gb38mOevY+BvtNGNqiqmqa2pKB99lnLsADQww9w9xMbAfT4GB6RUoaOkSPrtlXqpq2Fq+Dj2AgFg== dependencies: "@babel/core" "^7.23.0" "@babel/plugin-proposal-decorators" "^7.23.0" diff --git a/post/index.go b/post/index.go index 7bfe6b6f5..edab75581 100644 --- a/post/index.go +++ b/post/index.go @@ -176,19 +176,27 @@ func (repository *Repository) Show(c *gin.Context) { } if post.IsResource { - posts := []RecommendedPost{} - err = repository.Db.Select(&posts, `SELECT id, title, content, slug, published_on, is_featured, created_at, updated_at, published_at, - summary, blog_content, meta_description, toc, tags as tag, is_published, keywords, new_content, new_toc, new_blog_content, - is_resource, reading_time - FROM posts - WHERE slug != $1`+publishQuery, slug) + recommendedPosts := []RecommendedPost{} + + // Fetch recommended posts along with images + query := ` + SELECT p.id, p.title, p.content, p.slug, p.published_on, p.is_featured, p.created_at, p.updated_at, p.published_at, + p.summary, p.blog_content, p.meta_description, p.toc, p.tags as tag, p.is_published, p.keywords, p.new_content, + p.new_toc, p.new_blog_content, p.is_resource, p.reading_time, + f.id AS image_id, frm.related_id AS related_id, f.url AS image_url, f.alternative_text AS image_alternative_text + FROM posts p + LEFT JOIN files_related_morphs frm ON frm.related_id = p.id AND frm.related_type = 'api::post.post' + LEFT JOIN files f ON frm.file_id = f.id + WHERE p.slug != $1` + publishQuery + + err := repository.Db.Select(&recommendedPosts, query, slug) if err != nil { - log.Error("Error while fetching recommended post: ", err) + log.Error("Error while fetching recommended posts and images: ", err) c.AbortWithStatus(http.StatusInternalServerError) return } - - post.RecommendedPosts = repository.FilterPostsByTags(posts, repository.ExtractTagNames(post.Tags)) + filteredRecommendedPosts := repository.FilterPostsByTags(recommendedPosts, repository.ExtractTagNames(post.Tags)) + post.RecommendedPosts = repository.SetPostImageInRecommendedPosts(filteredRecommendedPosts) } new_posts := repository.PreparePosts([]Post{post}) @@ -255,6 +263,21 @@ func (repository *Repository) SetPostImageInPosts(posts []Post) []Post { return posts } +func (repository *Repository) SetPostImageInRecommendedPosts(recommendedPosts []RecommendedPost) []RecommendedPost { + for i, post := range recommendedPosts { + + if post.ImageUrl != "" && post.RelatedId != 0 { + recommendedPosts[i].Image = Image{ + Id: post.ImageId, + RelatedId: post.RelatedId, + Url: post.ImageUrl, + AlternativeText: post.ImageAltText, + } + } + } + return recommendedPosts +} + // Filter posts based on tags func (repository *Repository) FilterPostsByTags(posts []RecommendedPost, tags []string) []RecommendedPost { diff --git a/post/models.go b/post/models.go index f96c5426a..b1aa7277b 100644 --- a/post/models.go +++ b/post/models.go @@ -132,5 +132,9 @@ type RecommendedPost struct { IsResource bool `json:"is_resource"` ReadingTime null.Int `json:"reading_time"` Author Author `json:"author"` + ImageId int `json:"image_id"` + RelatedId int `json:"related_id"` + ImageUrl string `json:"image_url"` + ImageAltText null.String `json:"image_alternative_text"` Image Image `json:"image"` }