Spaces:
Build error
Build error
Álvaro Valenzuela Valdes commited on
Commit ·
5d69ab9
1
Parent(s): bc31c2f
fix: remove demo/fake data seeding to ensure only real API data is shown
Browse files- backend/app/main.py +6 -77
backend/app/main.py
CHANGED
|
@@ -47,87 +47,16 @@ async def startup_event():
|
|
| 47 |
print("Auto-seeding database...")
|
| 48 |
# Basic Company Profile - Independent check
|
| 49 |
if not db.query(CompanyProfileModel).first():
|
| 50 |
-
print("Seeding Company Profile...")
|
| 51 |
db.add(CompanyProfileModel(
|
| 52 |
-
name="
|
| 53 |
-
industry="
|
| 54 |
-
services="
|
| 55 |
-
experience="
|
| 56 |
regions="Nacional",
|
| 57 |
-
documents_available="
|
| 58 |
))
|
| 59 |
db.commit()
|
| 60 |
-
|
| 61 |
-
# Software Tenders
|
| 62 |
-
tenders_to_add = [
|
| 63 |
-
TenderModel(
|
| 64 |
-
code="2394-15-LR24",
|
| 65 |
-
name="ERP Implementation - Health Sector",
|
| 66 |
-
description="Large scale ERP for hospital network.",
|
| 67 |
-
buyer="Servicio de Salud",
|
| 68 |
-
status="Publicada",
|
| 69 |
-
closing_date=datetime.now() + timedelta(days=15),
|
| 70 |
-
estimated_amount=450000000,
|
| 71 |
-
region="Metropolitana",
|
| 72 |
-
sector="Software",
|
| 73 |
-
source="Mercado Público",
|
| 74 |
-
items=[],
|
| 75 |
-
attachments=[]
|
| 76 |
-
),
|
| 77 |
-
TenderModel(
|
| 78 |
-
code="5021-10-LP24",
|
| 79 |
-
name="AI Platform for Crime Analysis",
|
| 80 |
-
description="Machine learning and predictive models.",
|
| 81 |
-
buyer="Subsecretaría de Prevención del Delito",
|
| 82 |
-
status="Publicada",
|
| 83 |
-
closing_date=datetime.now() + timedelta(days=10),
|
| 84 |
-
estimated_amount=180000000,
|
| 85 |
-
region="Nacional",
|
| 86 |
-
sector="AI & Software",
|
| 87 |
-
source="Mercado Público",
|
| 88 |
-
items=[],
|
| 89 |
-
attachments=[]
|
| 90 |
-
),
|
| 91 |
-
TenderModel(
|
| 92 |
-
code="1022-5-LP24",
|
| 93 |
-
name="Cybersecurity Operations Center (SOC)",
|
| 94 |
-
description="24/7 monitoring and incident response.",
|
| 95 |
-
buyer="Ministerio del Interior",
|
| 96 |
-
status="Publicada",
|
| 97 |
-
closing_date=datetime.now() + timedelta(days=5),
|
| 98 |
-
estimated_amount=320000000,
|
| 99 |
-
region="Metropolitana",
|
| 100 |
-
sector="Cybersecurity",
|
| 101 |
-
source="Mercado Público",
|
| 102 |
-
items=[],
|
| 103 |
-
attachments=[]
|
| 104 |
-
),
|
| 105 |
-
TenderModel(
|
| 106 |
-
code="8821-2-LR24",
|
| 107 |
-
name="Cloud Migration Strategy",
|
| 108 |
-
description="Migration of legacy systems to AWS/Azure.",
|
| 109 |
-
buyer="Tesorería General",
|
| 110 |
-
status="Publicada",
|
| 111 |
-
closing_date=datetime.now() + timedelta(days=25),
|
| 112 |
-
estimated_amount=120000000,
|
| 113 |
-
region="Valparaíso",
|
| 114 |
-
sector="Cloud",
|
| 115 |
-
source="Mercado Público",
|
| 116 |
-
items=[
|
| 117 |
-
{"name": "Migration Service", "quantity": 1, "unit": "Unit"},
|
| 118 |
-
{"name": "Cloud Storage 100TB", "quantity": 1, "unit": "Year"}
|
| 119 |
-
],
|
| 120 |
-
attachments=[
|
| 121 |
-
{"name": "Bases_Tecnicas.pdf", "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"},
|
| 122 |
-
{"name": "Anexo_Economico.docx", "url": "https://calibre-ebook.com/downloads/demos/demo.docx"}
|
| 123 |
-
]
|
| 124 |
-
)
|
| 125 |
-
]
|
| 126 |
-
for t in tenders_to_add:
|
| 127 |
-
if not db.query(TenderModel).filter(TenderModel.code == t.code).first():
|
| 128 |
-
db.add(t)
|
| 129 |
-
|
| 130 |
-
db.commit()
|
| 131 |
except Exception as e:
|
| 132 |
print(f"Seed error: {e}")
|
| 133 |
finally:
|
|
|
|
| 47 |
print("Auto-seeding database...")
|
| 48 |
# Basic Company Profile - Independent check
|
| 49 |
if not db.query(CompanyProfileModel).first():
|
| 50 |
+
print("Seeding Generic Company Profile...")
|
| 51 |
db.add(CompanyProfileModel(
|
| 52 |
+
name="My Company",
|
| 53 |
+
industry="Consulting",
|
| 54 |
+
services="General Services",
|
| 55 |
+
experience="1 year",
|
| 56 |
regions="Nacional",
|
| 57 |
+
documents_available="None"
|
| 58 |
))
|
| 59 |
db.commit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
except Exception as e:
|
| 61 |
print(f"Seed error: {e}")
|
| 62 |
finally:
|