optimize local db
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
from sqlalchemy import Column, String, Integer, DateTime, func
|
||||
from sqlalchemy.orm import declarative_base
|
||||
|
||||
import definitions
|
||||
from pojo.contact_pojo import ContactPojo
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
@@ -22,23 +20,4 @@ class ContactInErrorPojo(Base):
|
||||
position: int = Column(Integer)
|
||||
error_type = Column(Integer)
|
||||
update_at = Column(DateTime, onupdate=func.now())
|
||||
create_at = Column(DateTime, default=func.now())
|
||||
|
||||
|
||||
def get_captcha_error_contact_from_contact(contact: ContactPojo, error_type: int) -> ContactInErrorPojo:
|
||||
captcha_error = ContactInErrorPojo()
|
||||
captcha_error.mail = contact.mail
|
||||
captcha_error.ccid = contact.ccid
|
||||
captcha_error.phone = contact.phone
|
||||
captcha_error.passport = contact.passport
|
||||
captcha_error.first_name = contact.first_name
|
||||
captcha_error.last_name = contact.last_name
|
||||
captcha_error.position = contact.position
|
||||
captcha_error.error_type = error_type
|
||||
return captcha_error
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
contact = ContactPojo(mail="panleici3m@gmail.com", phone_number="649114592", ccid="", position=0,
|
||||
passport_number="3322111", first_name="Lei", last_name="PAAaN")
|
||||
definitions.local_db_manager.insert_or_update(get_captcha_error_contact_from_contact(contact, ERROR_TYPE_CAPTCHA))
|
||||
create_at = Column(DateTime, default=func.now())
|
||||
Reference in New Issue
Block a user