Commit graph

10 commits

Author SHA1 Message Date
DJP
2b42b4e42e Store DAM metadata JSON in database description field + test Box template
Database:
- Store full DAM metadata JSON in description field (5KB limit)
- Includes Box links and upload folder ID
- Full asset metadata preserved

Box Metadata Template Testing:
- Simplified to send just test string first
- Log endpoint and values being sent
- Try 5 field name variations
- Will identify correct field name from logs

Next test will show which field name works for Box template.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 17:09:58 -04:00
DJP
3cdf33f929 Simplify Box metadata and try multiple field name variations
Box metadata changes:
- Simplified JSON (only essential fields, not full 2MB metadata)
- Try 4 field name variations: DAM-Metadata, DAMMetadata, damMetadata, dam_metadata
- Log which variation works
- Fallback to description if all fail

This will help identify the correct field name for the template.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 16:40:14 -04:00
DJP
576dd72081 Fix Box metadata template name and database columns
Box Metadata Template:
- Fixed template key: 'ferrerodammetadata' (lowercase)
- Fixed field name: 'DAM-Metadata' (exact from template)
- Should now properly attach metadata to Box files

Database Fix:
- Removed non-existent columns: box_file_id, box_url, dam_metadata_json
- Using only existing columns from master_assets table
- Storing Box URL in description field as workaround
- Will add proper columns in DB migration later

Next: Box metadata template should work, DB inserts should succeed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 16:23:38 -04:00
DJP
d8e542a569 Add PostgreSQL database integration and Box metadata template
Database Integration:
- IDGenerator now connects to PostgreSQL (localhost:5433)
- Generates tracking IDs with uniqueness check against master_assets table
- Fallback to random if database unavailable
- Direct PDO connection to ferrero_tracking database

DatabaseClient:
- Stores master assets in PostgreSQL
- Records: tracking_id, opentext_id, Box links, full metadata JSON
- Updates on conflict (upsert pattern)
- Stores box_file_id and box_url for reference

Box Metadata Enhancement:
- Uses Box metadata template API (enterprise/ferreroDAMMetadata)
- Stores full DAM metadata JSON in 'Ferrero-DAM-Metadata' field
- Fallback to file description if template not configured
- Handles template conflicts (updates existing)

Box Upload Results Now Show:
- Unique tracking ID (from database)
- Box file links (clickable)
- Database storage status
- ID source (database_direct, random, etc.)

Complete workflow: DAM → Download → Generate ID → Upload to Box → Store in DB

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 15:39:32 -04:00
DJP
0c799aebe7 Implement proper Box JWT authentication with RSA signing
Box now uses JWT (JSON Web Token) authentication:
- Signs JWT with RSA private key from config
- Uses RS256 algorithm
- Enterprise-level access
- No expiring developer tokens

JWT Flow:
1. Create JWT header with publicKeyID
2. Create claims with enterprise ID
3. Sign with encrypted private key + passphrase
4. Exchange JWT for access token
5. Token auto-refreshes as needed

Config loaded from: Box-config.json (complete JWT config)

This is the proper production-ready authentication method.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 14:07:52 -04:00
DJP
fd3676e8d0 Use Box developer token for now - OAuth app not configured
Box OAuth requires app to be configured for client credentials grant.
Using developer token as fallback (valid 60 minutes).

User needs to:
1. Go to https://app.box.com/developers/console
2. Generate new Developer Token
3. Update token in code (expires hourly)

OR configure Box app for OAuth 2.0 client credentials grant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 13:51:57 -04:00
DJP
eb16f2f6e9 Remove enterprise subject from Box OAuth - not authorized
Box app is not configured for enterprise client credentials.
Using standard client_credentials grant without subject type.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 13:51:27 -04:00
DJP
c4ccbae765 Fix Box to use OAuth 2.0 client credentials instead of developer token
Box now uses proper OAuth flow:
- Client ID: l2atwxxq4xna7phcjr2uifm4mbah69qp
- Client Secret: 6XcuCQ6akpk9daE0UHaGSv3mSxWaER4l
- Enterprise ID: 43984435
- Grant type: client_credentials with box_subject_type

Loads credentials from Box-config.json for security.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 13:30:28 -04:00
DJP
52e7c4afc9 Add detailed Box API error logging 2025-10-28 13:27:26 -04:00
DJP
36d45ae188 Add Box.com integration for asset storage with unique ID tracking
New Box Integration Features:
- BoxClient class for Box API operations
- IDGenerator for 6-character unique IDs (A-Z a-z 0-9)
- Auto-create campaign folders in Box
- Rename files with unique ID suffix (filename_ID.ext)
- Upload metadata JSON to Box custom fields
- Track Box file IDs and URLs

Download Workflow Enhancement:
- New button: '📥📦 Download & Upload to Box'
- Downloads from DAM → Uploads to Box
- Each file gets unique 6-char ID
- Creates campaign folder: {campaign_id}_{campaign_name}
- Results show: original → renamed filename with ID

Box Configuration:
- Developer Token: e7Q1kS6rOM1tH2ezzCg4KgRfcyNW2JHI
- Root Folder: 348304357505
- OAuth creds in Box-config.json

ID Generation:
- Phase 1: Random 6-char (current)
- Phase 2: PostgreSQL DB via REST API (ready to integrate)

Metadata Storage:
- Stored in Box file description (custom metadata field later)
- Full DAM metadata JSON preserved
- Includes: asset_id, campaign info, all metadata fields

Ready for testing! Download workflow now stores assets in Box with tracking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 13:11:49 -04:00