Ajit Panday commited on
Commit
7bff0d0
·
1 Parent(s): 561ef55

Fix customer list display and make database fields optional

Browse files
Files changed (2) hide show
  1. app/models.py +6 -6
  2. app/static/admin.html +1 -1
app/models.py CHANGED
@@ -23,12 +23,12 @@ class Customer(Base):
23
  created_at = Column(DateTime, default=datetime.utcnow)
24
  updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
25
 
26
- # Database credentials
27
- db_host = Column(String(100), nullable=False)
28
- db_port = Column(Integer, nullable=False, default=3306) # Default MySQL port
29
- db_user = Column(String(100), nullable=False)
30
- db_password = Column(String(100), nullable=False)
31
- db_name = Column(String(100), nullable=False)
32
 
33
  # Relationship with call records
34
  call_records = relationship("CallRecord", back_populates="customer", cascade="all, delete-orphan")
 
23
  created_at = Column(DateTime, default=datetime.utcnow)
24
  updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
25
 
26
+ # Database credentials (optional for API-based architecture)
27
+ db_host = Column(String(100), nullable=True)
28
+ db_port = Column(Integer, nullable=True, default=3306) # Default MySQL port
29
+ db_user = Column(String(100), nullable=True)
30
+ db_password = Column(String(100), nullable=True)
31
+ db_name = Column(String(100), nullable=True)
32
 
33
  # Relationship with call records
34
  call_records = relationship("CallRecord", back_populates="customer", cascade="all, delete-orphan")
app/static/admin.html CHANGED
@@ -392,7 +392,7 @@
392
  loading.style.display = 'block';
393
 
394
  try {
395
- const response = await fetch('/api/v1/customers', {
396
  headers: {
397
  'Authorization': `Bearer ${accessToken}`
398
  }
 
392
  loading.style.display = 'block';
393
 
394
  try {
395
+ const response = await fetch('/api/v1/customers/', {
396
  headers: {
397
  'Authorization': `Bearer ${accessToken}`
398
  }