fix a bug for updatin price
This commit is contained in:
parent
dd8b7e1209
commit
c7a25e2d86
Binary file not shown.
|
|
@ -51,6 +51,10 @@ class AutoController:
|
|||
@staticmethod
|
||||
def update(db: Session, _model: str, _id: int, _input: dict):
|
||||
m = model_name_to_class(_model)
|
||||
# print(_model)
|
||||
dbbb = db.query(m).filter(m.id == _id).first()
|
||||
_input["plan_id"] = dbbb.plan_id
|
||||
# print(_input)
|
||||
_input['updated_at']=datetime.datetime.now()
|
||||
db.query(m).filter(m.id == _id).update(_input)
|
||||
db.commit()
|
||||
|
|
@ -70,6 +74,7 @@ class AutoController:
|
|||
def delete(db: Session, _model: str, _id: int):
|
||||
m = model_name_to_class(_model)
|
||||
obj = db.query(m).filter(m.id == _id).one()
|
||||
print(obj)
|
||||
db.delete(obj)
|
||||
db.commit()
|
||||
return True
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -465,8 +465,7 @@ class SubscriptionContract(Base):
|
|||
storage_limit = Column(Float(53), nullable=False)
|
||||
storage_usage = Column(Float(53), nullable=False)
|
||||
user_usage = Column(Integer, nullable=False)
|
||||
|
||||
owner = relationship('AccountLawyeruser')
|
||||
owner = relationship('AccountLawyeruser' , foreign_keys=[owner_id])
|
||||
plan = relationship('SubscriptionPlan')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,10 @@ def put(
|
|||
_model: str,
|
||||
_id: int,
|
||||
payload=Body(...)):
|
||||
print(payload , _id)
|
||||
db = next(get_db())
|
||||
payload["plan_id"] = payload["plan_id"]["value"]
|
||||
# return "Hi"
|
||||
return AutoController.update(db, get_model_route(_model), _id, payload)
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue