diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ae6787f..c6eee6c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -292,14 +302,6 @@
-
-
- 1768498751836
-
-
-
- 1768498751836
-
1768555180530
@@ -684,7 +686,15 @@
1770370919043
-
+
+
+ 1770371073055
+
+
+
+ 1770371073055
+
+
@@ -734,7 +744,6 @@
-
@@ -759,7 +768,8 @@
-
+
+
diff --git a/config/packages/security.yaml b/config/packages/security.yaml
index c0859d3..35967a3 100644
--- a/config/packages/security.yaml
+++ b/config/packages/security.yaml
@@ -53,6 +53,8 @@ security:
- { path: ^/api/users, roles: PUBLIC_ACCESS, methods: [GET] }
# Doc API (swagger) en public
- { path: ^/api/docs, roles: PUBLIC_ACCESS }
+ # Version de l'application en public
+ - { path: ^/api/version, roles: PUBLIC_ACCESS, methods: [GET] }
# Tout le reste nécessite un JWT
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
diff --git a/frontend/app.vue b/frontend/app.vue
index f8eacfa..c336825 100644
--- a/frontend/app.vue
+++ b/frontend/app.vue
@@ -3,3 +3,11 @@
+
+
diff --git a/frontend/composables/useAppVersion.ts b/frontend/composables/useAppVersion.ts
new file mode 100644
index 0000000..803278d
--- /dev/null
+++ b/frontend/composables/useAppVersion.ts
@@ -0,0 +1,17 @@
+export const useAppVersion = () => {
+ const api = useApi()
+ const version = useState('app-version', () => null)
+
+ const load = async () => {
+ if (version.value) {
+ return version.value
+ }
+ const response = await api.get<{ version: string }>('version', {}, {
+ toast: false
+ })
+ version.value = response.version
+ return version.value
+ }
+
+ return { version, load }
+}
diff --git a/frontend/layouts/default.vue b/frontend/layouts/default.vue
index bc932da..e978c6d 100644
--- a/frontend/layouts/default.vue
+++ b/frontend/layouts/default.vue
@@ -100,6 +100,9 @@
+
@@ -109,6 +112,7 @@ import { useAuthStore } from '~/stores/auth'
const route = useRoute()
const auth = useAuthStore()
const isMenuOpen = ref(false)
+const { version } = useAppVersion()
const closeMenu = () => {
isMenuOpen.value = false
diff --git a/frontend/pages/login.vue b/frontend/pages/login.vue
index cc8c809..21d0c21 100644
--- a/frontend/pages/login.vue
+++ b/frontend/pages/login.vue
@@ -46,7 +46,8 @@
>
Connexion
-
+ v{{ version }}
+
@@ -57,6 +58,7 @@ import { useAuthStore } from '~/stores/auth'
const router = useRouter()
const auth = useAuthStore()
+const { version } = useAppVersion()
definePageMeta({
layout: 'auth'
diff --git a/src/Dto/AppVersion.php b/src/ApiResource/AppVersion.php
similarity index 89%
rename from src/Dto/AppVersion.php
rename to src/ApiResource/AppVersion.php
index 66f7dea..ba3c071 100644
--- a/src/Dto/AppVersion.php
+++ b/src/ApiResource/AppVersion.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Dto;
+namespace App\ApiResource;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
@@ -17,7 +17,6 @@ use Symfony\Component\Serializer\Attribute\Groups;
provider: AppVersionProvider::class,
),
],
- security: "is_granted('ROLE_USER')",
)]
final class AppVersion
{
diff --git a/src/State/AppVersionProvider.php b/src/State/AppVersionProvider.php
index 9f14f64..cc65752 100644
--- a/src/State/AppVersionProvider.php
+++ b/src/State/AppVersionProvider.php
@@ -6,7 +6,7 @@ namespace App\State;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
-use App\Dto\AppVersion;
+use App\ApiResource\AppVersion;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
final readonly class AppVersionProvider implements ProviderInterface