can restart modemPool and detected disabled sim card
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import datetime
|
||||
import json
|
||||
|
||||
import firebase_admin
|
||||
from firebase_admin import credentials, firestore
|
||||
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo, PublishType
|
||||
from pojo.contact_pojo import ContactPojo
|
||||
|
||||
ERROR_COLLECTION_NAME = "error_items"
|
||||
TIMEOUT = "timeout_items"
|
||||
|
||||
|
||||
class DataManager:
|
||||
def __init__(self):
|
||||
cred = credentials.Certificate("appointment.json")
|
||||
self._app = firebase_admin.initialize_app(cred)
|
||||
self._db = firestore.client()
|
||||
|
||||
def get_all_error_items(self):
|
||||
pass
|
||||
|
||||
def save(self, result: ReserveResultPojo):
|
||||
if result.type == PublishType.SUCCESS:
|
||||
# get id
|
||||
id = result.url.split("/")[-1]
|
||||
result.id = id
|
||||
document_name = str(datetime.date.today())
|
||||
doc_ref = self._db.collection(document_name).document(result.id)
|
||||
doc_ref.set(result.to_firestore_dict())
|
||||
else:
|
||||
doc_ref = self._db.collection(ERROR_COLLECTION_NAME).document(result.phone)
|
||||
doc_ref.set(result.to_firestore_dict())
|
||||
|
||||
def save_timeout_contact(self, contact: ContactPojo):
|
||||
doc_ref = self._db.collection(TIMEOUT).document(str(contact.phone))
|
||||
doc_ref.set(contact.to_firestore_dict())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
manager = DataManager()
|
||||
manager.save()
|
||||
Reference in New Issue
Block a user