This document outlines new requirements identified after completing the career application authentication system.
Problem: AI assistant shows "no functions available in offline mode" even when user is online.
Investigation Needed:
- Check
apps/docs/azure-functions/src/functions/ai.ts - Review offline detection logic
- Verify network connectivity checks
- Test function availability in online mode
Files to Review:
apps/docs/azure-functions/src/functions/ai.tsapps/docs/azure-functions/src/services/ai.service.tsapps/docs/src/services/auth.tsapps/docs/functions/src/ai/index.ts
Requirement: After Google OAuth login, redirect user to profile confirmation page where they can verify/edit:
- First name
- Last name
- Email (read-only from Google)
- Optional: Profile picture
Implementation Steps:
- Create
/profile/confirmpage in marketing app - Add route to redirect after successful Google OAuth
- Store profile confirmation state
- Allow users to skip or complete profile
- Update user record with confirmed data
Files to Create/Modify:
apps/marketing/src/app/profile/confirm/page.tsxapps/marketing/src/app/profile/confirm/confirm.module.css- Update
apps/marketing/src/app/login/page.tsxfor OAuth flow - Update
apps/api/src/handlers.rsto support profile updates
Requirement: Add a "Skip Tour" button that can be toggled on/off via configuration.
Implementation Steps:
- Add
ENABLE_TOUR_SKIPto environment variables - Create tour configuration file
- Add skip button to tour component
- Store user's tour completion/skip preference
- Respect skip preference on subsequent visits
Configuration:
// apps/marketing/src/config/tour.ts
export const TOUR_CONFIG = {
enableSkip: process.env.NEXT_PUBLIC_ENABLE_TOUR_SKIP === 'true',
steps: [...],
};Files to Create/Modify:
apps/marketing/src/config/tour.tsapps/marketing/.env.example(add NEXT_PUBLIC_ENABLE_TOUR_SKIP)- Tour component (TBD - need to locate existing tour implementation)
Requirement: Migrate from SQLite to Azure Cosmos DB with Entra authentication.
Major Changes Required:
- Replace SQLite with Azure Cosmos DB client
- Implement Cosmos DB connection management
- Update all queries to use Cosmos DB API
- Integrate Microsoft Entra (formerly Azure AD)
- Replace email-based auth with Entra OAuth
- Update token management and session handling
- Create abstraction layer (see section 5)
- Implement Cosmos DB repository layer
- Create data migration scripts
- Update deployment configuration
- Update environment variables and secrets
New Dependencies:
# Cargo.toml
azure_data_cosmos = "0.20"
azure_identity = "0.20"
azure_core = "0.20"Configuration Required:
- Azure Cosmos DB connection string
- Entra tenant ID
- Entra client ID and secret
- Cosmos DB database and container names
Requirement: Add proper abstraction layer with migration support for database operations.
// apps/api/src/repository/mod.rs
pub trait Repository<T> {
async fn create(&self, entity: &T) -> Result<String, RepositoryError>;
async fn get(&self, id: &str) -> Result<Option<T>, RepositoryError>;
async fn update(&self, id: &str, entity: &T) -> Result<(), RepositoryError>;
async fn delete(&self, id: &str) -> Result<(), RepositoryError>;
async fn list(&self, filter: &Filter) -> Result<Vec<T>, RepositoryError>;
}
pub trait Migrator {
async fn current_version(&self) -> Result<u32, MigrationError>;
async fn migrate_to(&self, version: u32) -> Result<(), MigrationError>;
async fn migrate_latest(&self) -> Result<(), MigrationError>;
async fn rollback(&self, version: u32) -> Result<(), MigrationError>;
}- Entity Layer: Define domain models
- Repository Layer: Abstract database operations
- Migration Layer: Version-controlled schema changes
- Provider Layer: SQLite, Cosmos DB implementations
// apps/api/src/migrations/mod.rs
pub struct Migration {
pub version: u32,
pub name: &'static str,
pub up: Box<dyn Fn(&dyn DatabaseProvider) -> BoxFuture<'static, Result<(), MigrationError>>>,
pub down: Box<dyn Fn(&dyn DatabaseProvider) -> BoxFuture<'static, Result<(), MigrationError>>>,
}apps/api/src/
├── repository/
│ ├── mod.rs # Repository traits
│ ├── user.rs # User repository
│ ├── session.rs # Session repository
│ └── application.rs # Application repository
├── providers/
│ ├── mod.rs # Provider trait
│ ├── sqlite.rs # SQLite implementation
│ └── cosmos.rs # Cosmos DB implementation
├── migrations/
│ ├── mod.rs # Migration framework
│ ├── sqlite/ # SQLite migrations
│ └── cosmos/ # Cosmos DB migrations
└── entities/
├── mod.rs
├── user.rs
├── session.rs
└── application.rs
-
High Priority:
- Azure Cosmos DB migration (blocking for production)
- Entra authentication integration
- ORM/Abstraction layer
-
Medium Priority:
- Google OAuth profile confirmation flow
- Docs site AI assistant fix
-
Low Priority:
- Skip tour button (nice-to-have feature)
- Azure Cosmos DB + Entra Migration: 3-5 days
- ORM/Abstraction Layer: 2-3 days
- Profile Confirmation Flow: 1 day
- AI Assistant Fix: 0.5-1 day
- Skip Tour Button: 0.5 day
Total: ~7-10 days of development work
- Unit Tests: Test each repository implementation
- Integration Tests: Test migration paths
- E2E Tests: Test complete authentication flow
- Load Tests: Verify Cosmos DB performance
- Security Tests: Verify Entra token validation
- Update deployment documentation
- Document Azure resource requirements
- Update environment configuration guide
- Add Cosmos DB schema documentation
- Document migration procedures