| import asyncio |
| import json |
| from cbh.core.config import settings |
| from bson import ObjectId |
|
|
|
|
| pricing_map = { |
| "v0": 30, |
| "Lovable": 30, |
| "Bolt": 25, |
| "Replit": 20, |
| "Orchids": 21, |
| "Rork": 20, |
| "FlutterFlow": 39, |
| "Adalo": 36, |
| "Draftbit": 20, |
| "Appy Pie": 16, |
| "Uizard": 19, |
| "Visily": 14, |
| "UX Pilot": 10, |
| "Motiff AI": 20, |
| "Framer": 30, |
| "Durable": 22, |
| "CodeDesign.ai": 29, |
| "Readdy": 25, |
| "Cursor": 20, |
| "Windsurf": 20, |
| "Claude Code": 20, |
| "Codex": 35, |
| } |
|
|
| pricing_map = {k.lower(): v for k, v in pricing_map.items()} |
|
|
|
|
| async def fix_data(): |
| platforms = await settings.DB_CLIENT.platforms.find( |
| {}, {"_id": 1, "id": 1} |
| ).to_list(None) |
| await asyncio.gather( |
| *[ |
| settings.DB_CLIENT.platforms.update_one( |
| {"_id": platform["_id"]}, |
| {"$set": {"id": str(ObjectId(platform["_id"]))}}, |
| ) |
| for platform in platforms |
| ] |
| ) |
|
|
|
|
| async def update_pricing(): |
| platforms = await settings.DB_CLIENT.platforms.find( |
| {}, {"_id": 1, "id": 1, "name": 1} |
| ).to_list(None) |
| for platform in platforms: |
| pl_name = platform["name"].lower() |
| if price := pricing_map.get(pl_name): |
| await settings.DB_CLIENT.platforms.update_one( |
| {"_id": platform["_id"]}, |
| {"$set": {"pricing": price}}, |
| ) |
|
|
|
|
| if __name__ == "__main__": |
| asyncio.run(update_pricing()) |
|
|