My Wiki!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devops:xhr:dev:local_dev [2025/10/22 15:13] – [Scripts:] tddevops:xhr:dev:local_dev [2025/10/23 16:00] (current) – [Run] td
Line 3: Line 3:
  
 # Front-end # Front-end
 +
 ## .env file ## .env file
 ``` ```
Line 8: Line 9:
 export API_HOST=http://localhost:8080 --> use local backend (devlocal repo, identitiy-management-service?? as proxy) export API_HOST=http://localhost:8080 --> use local backend (devlocal repo, identitiy-management-service?? as proxy)
 ``` ```
- +### AI agent
-## AI agent+
  
 platform-frontend-app/src/shared/services/sse/SseServiceImpl.ts:54-56 platform-frontend-app/src/shared/services/sse/SseServiceImpl.ts:54-56
Line 18: Line 18:
         const url = `${baseUrl}${path}         const url = `${baseUrl}${path}
 ``` ```
 +### Run
 +
 +```
 +. .env
 +npm run dev
 +```
 +
 +### dev user
 +
 +thuy.dang+001@x-hr.co
 +1S2N
 +
 +# Start Agent
 +Change APP_PORT=8090 in .env to avoid conflict with devlocal services (identity management)
 +
 +```
 +. .venv/bin/activate
 +uv sync
 +alembic upgrade head
 +export PYTHONPATH=$(pwd)
 +uv run agent
 +```
 +
 # identitiy-management-service # identitiy-management-service
  
 +## Build option gradle
 +identity-management-service/gradle.properties:27-28
 +```
 +gpr.user=thuydang
 +gpr.key=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
 +```
  
 +## CORS
 +
 +### Allow OPTIONS for CORS
 +identity-management-service/common/src/main/java/co/xhr/identitymanagement/common/config/AuthorizationServerConfig.java:34-34
 +```
 +               .requestMatchers(org.springframework.http.HttpMethod.OPTIONS, "/**").permitAll() // A
 +```
 +
 +### Add cors headers
 +
 +identity-management-service/rest/src/main/java/co/xhr/identitymanagement/rest/configuration/WebConfiguration.java:1-54
 +```
 +package co.xhr.identitymanagement.rest.configuration;
 +
 +import org.springframework.beans.factory.annotation.Value;
 +import org.springframework.context.annotation.Configuration;
 +import org.springframework.web.servlet.config.annotation.CorsRegistry;
 +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 +
 +/**
 + * Web configuration for CORS settings
 + */
 +@Configuration
 +public class WebConfiguration implements WebMvcConfigurer {
 +
 +    @Value("${frontend.base-url:https://app.x-hr.ai}")
 +    private String frontendBaseUrl;
 +
 +    @Value("${frontend.domain:localhost}")
 +    private String frontendDomain;
 +
 +    @Override
 +    public void addCorsMappings(CorsRegistry registry) {
 +        registry.addMapping("/v*/**")
 +                .allowedOriginPatterns(
 +                        frontendBaseUrl,
 +                        "http://localhost:*",
 +                        "https://localhost:*",
 +                        "http://" + frontendDomain + ":*",
 +                        "https://" + frontendDomain + ":*",
 +                        "http://localhost:5173",
 +                        "http://localhost:3000",
 +                        "http://localhost:8080"
 +                )
 +                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")
 +                .allowedHeaders(
 +                           "Origin",
 +                           "Content-Type",
 +                           "Accept",
 +                           "Authorization",
 +                           "X-Requested-With",
 +                           "Access-Control-Request-Method",
 +                           "Access-Control-Request-Headers",
 +                           "Access-Control-Allow-Origin",
 +                           "X-Tenant-ID",
 +                           "X-Company-ID",
 +                           "X-Correlation-ID",
 +                           "x-correlation-id",
 +                           "x-session-id",
 +                           "x-tenant-id",
 +                           "x-company-id"
 +                   )
 +                .allowCredentials(true)
 +                .maxAge(3600);
 +    }
 +}
 +```
  
  
Line 131: Line 227:
 ``` ```
 ### Troubleshooting ### Troubleshooting
 +#### Pass email form:
 +
 ``` ```
 curl -X POST http://localhost:8080/v1/im/auth/express-login \ curl -X POST http://localhost:8080/v1/im/auth/express-login \
Line 136: Line 234:
   -d '{"email": "demo@demo.com"}'   -d '{"email": "demo@demo.com"}'
  
 +```
 +
 +#### Get Token and me
 +
 +```
 +TOKEN=$(curl -X POST http://localhost:8080/v1/im/auth/login \\n  -H "Content-Type: application/json" \\n  -d '{"email": "demo@demo.com", "password": "DemoDemo" }' | jq -r '.data.access_token'   
 +echo $TOKEN  
 +curl http://localhost:8080/v1/im/me \\n  -H "Content-Type: application/json" \\n-H "Authorization: Bearer ${TOKEN}"  
 ``` ```
  

Navigation