diff --git a/back/db_manipultations.py b/back/db_manipultations.py index 364762b..7ebbc33 100644 --- a/back/db_manipultations.py +++ b/back/db_manipultations.py @@ -13,16 +13,16 @@ tom = UserDatabase(name="Tom", phone="89999999", email="pupka", password="1234", # db.refresh(tom) # обновляем состояние объекта # Пробное объявление 1 -a1 = Announcement(user_id=1, category="cat", best_by="201223", adress="abd", longtitude=23, latitude=22, +a1 = Announcement(user_id=1, category="cat", best_by="201223", address="abd", longtitude=23, latitude=22, description="abv", src="111", metro="Lesnaya", booked_by=2) # Пробное объявление 2 -a2 = Announcement(user_id=1, category="dog", best_by="221223", adress="abd", longtitude=50, latitude=12, +a2 = Announcement(user_id=1, category="dog", best_by="221223", address="abd", longtitude=50, latitude=12, description="vvv", src="110", metro="Petrogradskaya", booked_by=2) -a3 = Announcement(user_id=1, category="a", best_by="221223", adress="abd", longtitude=20, latitude=25, +a3 = Announcement(user_id=1, category="a", best_by="221223", address="abd", longtitude=20, latitude=25, description="vvv", src="101", metro="metro", booked_by=2) -trash1 = Trashbox(name="Tom", adress="abd", longtitude=23, latitude=22, category="indisposable") +trash1 = Trashbox(name="Tom", address="abd", longtitude=23, latitude=22, category="indisposable") # db.add(a1) # добавляем в бд # db.add(a2) # добавляем в бд diff --git a/back/main.py b/back/main.py index 34cb222..dc16df0 100644 --- a/back/main.py +++ b/back/main.py @@ -76,7 +76,7 @@ def single_annoncement(user_id:int): try: annoncement = db.get(Announcement, user_id) return {"id": annoncement.id, "user_id": annoncement.user_id, "name": annoncement.name, - "category": annoncement.category, "best_by": annoncement.best_by, "adress": annoncement.adress, + "category": annoncement.category, "best_by": annoncement.best_by, "address": annoncement.address, "description": annoncement.description, "metro": annoncement.metro, "latitude": annoncement.latitude, "longtitude":annoncement.longtitude, "trashId": annoncement.trashId, "src":annoncement.src, "booked_by":annoncement.booked_by} @@ -102,7 +102,7 @@ def put_in_db(name: Annotated[str, Form()], category: Annotated[str, Form()], be uploaded_name = "/uploads/"+destination.name - temp_ancmt = Announcement(user_id=userId, name=name, category=category, best_by=bestBy, adress=address, longtitude=longtitude, latitude=latitude, description=description, src=uploaded_name, metro=metro, trashId=trashId) + temp_ancmt = Announcement(user_id=userId, name=name, category=category, best_by=bestBy, address=address, longtitude=longtitude, latitude=latitude, description=description, src=uploaded_name, metro=metro, trashId=trashId) db.add(temp_ancmt) # добавляем в бд db.commit() # сохраняем изменения db.refresh(temp_ancmt) # обновляем состояние объекта diff --git a/back/models.py b/back/models.py index be1504c..88cd529 100644 --- a/back/models.py +++ b/back/models.py @@ -23,7 +23,7 @@ class Announcement(Base): #класс объявления name = Column(String) # название объявления category = Column(String)#категория продукта из объявления best_by = Column(Integer)#срок годности продукта из объявления - adress = Column(String) + address = Column(String) longtitude = Column(Integer) latitude = Column(Integer) description = Column(String)#описание продукта в объявлении @@ -38,7 +38,7 @@ class Trashbox(Base):#класс мусорных баков id = Column(Integer, primary_key=True, index=True)#айди name = Column(String, nullable=True)#имя пользователя - adress = Column(String) + address = Column(String) latitude = Column(Integer) longtitude = Column(Integer) category = Column(String)#категория продукта из объявления