- Auto-create/update OmgEntry when Project.job_number changes (PATCH /api/projects); delete stale entry on clear; sync name/client when those fields change too - Backfill script: scripts/backfill_omg_from_projects.py - Projects List-view: add OMG # column with link to /omg?highlight=<job_number>; Grid-view badge also made clickable; OmgView supports ?highlight= deep-link with scroll+highlight - AzureWorkItem: add omg_number column (migration 0009), extracted from fields_json[Custom.OMGDeliverableNumber] on sync; DevOps table shows OMG # column with CC-project link when matched; toolbar badge shows count of items without OMG # - Session no longer lost on F5: refresh_token moved to HttpOnly+SameSite=Lax cookie; authStore.init() restores session on app start; axios interceptor retries on 401 via cookie refresh before logging out; POST /api/auth/logout clears cookie Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Backfill omg_entries from projects that have a job_number but no matching entry.
|
|
docker compose exec app python scripts/backfill_omg_from_projects.py
|
|
"""
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
|
|
from sqlalchemy import select
|
|
|
|
from src.database import AsyncSessionLocal
|
|
from src.models import OmgEntry, Project
|
|
|
|
|
|
async def main():
|
|
async with AsyncSessionLocal() as db:
|
|
result = await db.execute(
|
|
select(Project).where(Project.job_number != "")
|
|
)
|
|
projects = result.scalars().all()
|
|
|
|
created = 0
|
|
for proj in projects:
|
|
existing = await db.execute(
|
|
select(OmgEntry).where(
|
|
OmgEntry.user_id == proj.user_id,
|
|
OmgEntry.job_number == proj.job_number,
|
|
)
|
|
)
|
|
if existing.scalar_one_or_none():
|
|
continue
|
|
db.add(OmgEntry(
|
|
user_id=proj.user_id,
|
|
name=proj.display_name,
|
|
client=proj.client,
|
|
job_number=proj.job_number,
|
|
))
|
|
created += 1
|
|
|
|
await db.commit()
|
|
print(f"Backfilled {created} OMG entries from {len(projects)} projects with job_number.")
|
|
|
|
|
|
asyncio.run(main())
|