labi1240 / projectsAPI

0 stars 0 forks source link

Sweep: i want to add the slug data of projects in the api response #1

Open labi1240 opened 5 months ago

labi1240 commented 5 months ago

Here is the sample of Data

for the url http://127.0.0.1:8000/projects/prince-george-landing. What i want is to add the "slug": "prince-george-landing", inside you can write it as project name just have to add the - - in projects

"_id": "842d135f-4c3a-46ad-952c-73d87ad538a3", "name": "Prince George Landing", "status": "Pending", "price": "Not available", "incentives": "Not available", "address": "17 Baldwin Street,", "developer": "Stockworth Developments", "buildingType": "Condo & Townhouse", "unitsStories": "85 Units,", "bedrooms": "1 - 3 Bedrooms", "sizeSqFt": "Not available", "estimatedCompletion": "Preconstruction",

Checklist - [X] Modify `models.py` ✓ https://github.com/labi1240/projectsAPI/commit/3b5c3e855c64e4d5939ac0f6cc6c95643c5a5f7a [Edit](https://github.com/labi1240/projectsAPI/edit/sweep/i_want_to_add_the_slug_data_of_projects/models.py) - [X] Running GitHub Actions for `models.py` ✓ [Edit](https://github.com/labi1240/projectsAPI/edit/sweep/i_want_to_add_the_slug_data_of_projects/models.py) - [X] Modify `mongodb_utils.py` ✓ https://github.com/labi1240/projectsAPI/commit/b734b2c6f6d9d8e031b2382f2595bc5c892e0a76 [Edit](https://github.com/labi1240/projectsAPI/edit/sweep/i_want_to_add_the_slug_data_of_projects/mongodb_utils.py) - [X] Running GitHub Actions for `mongodb_utils.py` ✓ [Edit](https://github.com/labi1240/projectsAPI/edit/sweep/i_want_to_add_the_slug_data_of_projects/mongodb_utils.py) - [X] Modify `main.py` ! No changes made [Edit](https://github.com/labi1240/projectsAPI/edit/sweep/i_want_to_add_the_slug_data_of_projects/main.py) - [X] Running GitHub Actions for `main.py` ✗ [Edit](https://github.com/labi1240/projectsAPI/edit/sweep/i_want_to_add_the_slug_data_of_projects/main.py)
sweep-ai[bot] commented 5 months ago

🚀 Here's the PR! #3

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: b442cace71)
Install Sweep Configs: Pull Request

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/labi1240/projectsAPI/blob/5f0b4d96dda06b0bc5fd272c2a03e46063ccb1a9/main.py#L1-L44 https://github.com/labi1240/projectsAPI/blob/5f0b4d96dda06b0bc5fd272c2a03e46063ccb1a9/models.py#L1-L75 https://github.com/labi1240/projectsAPI/blob/5f0b4d96dda06b0bc5fd272c2a03e46063ccb1a9/mongodb_utils.py#L1-L54

Step 2: ⌨️ Coding

--- 
+++ 
@@ -66,6 +66,7 @@
     createdAt: Optional[datetime] = None
     updatedAt: Optional[datetime] = None
     v: Optional[int] = Field(None, alias="__v")
+    slug: Optional[str] = None

     class Config:
         allow_population_by_field_name = True

Ran GitHub Actions for 3b5c3e855c64e4d5939ac0f6cc6c95643c5a5f7a:

--- 
+++ 
@@ -25,6 +25,8 @@
     collection = get_database()[COLLECTION_NAME]
     # Use a case-insensitive search
     project = await collection.find_one({"name": {"$regex": f"^{name}$", "$options": "i"}})
+    if project:
+        project['slug'] = project['name'].replace(' ', '-')
     return project

 async def retrieve_projects(
@@ -52,5 +54,6 @@
     }
     projects = []
     async for project in collection.find(filter_params):
+        project['slug'] = project['name'].replace(' ', '-')
         projects.append(project)
     return projects

Ran GitHub Actions for b734b2c6f6d9d8e031b2382f2595bc5c892e0a76:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/i_want_to_add_the_slug_data_of_projects.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.

This is an automated message generated by Sweep AI.

labi1240 commented 5 months ago
Sweeping

0%

Actions (click)


❌ Unable to Complete PR

It looks like an issue has occurred around fetching the files. Perhaps the repo failed to initialized. If this error persists contact team@sweep.dev.

@labi1240, editing this issue description to include more details will automatically make me relaunch. Please join our Discord server for support (tracking_id=a6c7f55f05)

For bonus GPT-4 tickets, please report this bug on Discord (tracking ID: a6c7f55f05).


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description.

This is an automated message generated by Sweep AI.

labi1240 commented 5 months ago

❯ uvicorn main:app --reload INFO: Will watch for changes in these directories: ['/Users/lovepreetgill/developer/[001]_API/FastAPI'] INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [74222] using StatReload /Users/lovepreetgill/developer/[001]_API/FastAPI/newenv/lib/python3.11/site-packages/pydantic/_internal/_config.py:322: UserWarning: Valid config keys have changed in V2:

labi1240 commented 5 months ago

❯ uvicorn main:app --reload INFO: Will watch for changes in these directories: ['/Users/lovepreetgill/developer/[001]_API/FastAPI'] INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [74222] using StatReload /Users/lovepreetgill/developer/[001]_API/FastAPI/newenv/lib/python3.11/site-packages/pydantic/_internal/_config.py:322: UserWarning: Valid config keys have changed in V2: