Browse Source

Uses static property for manager ID

Refactors to use a static property for the OpenTalent manager ID.

This change improves code readability and maintainability by
centralizing the manager ID in a static property of the
`WebsiteListMenuBuilder` class. This avoids accessing it via
runtime config and makes the code more self-documenting.

Related to V8-7750
Olivier Massot 2 months ago
parent
commit
82f754547c

+ 3 - 1
services/layout/menuBuilder/websiteListMenuBuilder.ts

@@ -10,6 +10,8 @@ import type { BaseOrganizationProfile } from '~/types/interfaces'
 export default class WebsiteListMenuBuilder extends AbstractMenuBuilder {
   static override readonly menuName = 'WebsiteList'
 
+  static OPENTALENT_MANAGER_ID = 93931
+
   /**
    * Construit le menu Site internet, ou null si aucune page accessible
    */
@@ -36,7 +38,7 @@ export default class WebsiteListMenuBuilder extends AbstractMenuBuilder {
           parent.id &&
           parent.name &&
           parent.website &&
-          parent.id !== this.runtimeConfig.OPENTALENT_MANAGER_ID
+          parent.id !== WebsiteListMenuBuilder.OPENTALENT_MANAGER_ID
         ) {
           children.push(
             this.createItem(

+ 1 - 1
tests/units/services/layout/menuBuilder/websiteListMenuBuilder.test.ts

@@ -117,7 +117,7 @@ describe('build', () => {
       { id: 3, name: 'parent3', website: 'https://parent3.net' },
     ]
 
-    runtimeConfig.OPENTALENT_MANAGER_ID = 3
+    WebsiteListMenuBuilder.OPENTALENT_MANAGER_ID = 3
 
     const result = menuBuilder.build() as MenuGroup