From fc9f1c5c053a4188bde4fb26d9d70eaab7d53b3c Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Thu, 16 Jun 2022 02:18:43 +0300 Subject: [PATCH] file headers Signed-off-by: HeshamTB --- sql_app/TODO | 10 +++++++--- sql_app/auth_helper.py | 4 +++- sql_app/crud.py | 3 +++ sql_app/crypto.py | 2 ++ sql_app/database.py | 3 +++ sql_app/init_db.py | 4 +++- sql_app/main.py | 5 ++++- sql_app/models.py | 5 ++++- sql_app/schemas.py | 3 +++ sql_app/utils.py | 3 +++ 10 files changed, 35 insertions(+), 7 deletions(-) diff --git a/sql_app/TODO b/sql_app/TODO index 1f2d03e..a80df07 100644 --- a/sql_app/TODO +++ b/sql_app/TODO @@ -15,7 +15,7 @@ - [X] Expose data analysis - [X] Load backend onto RPi - [X] Test connections in lab network -- [ ] Define emrgancy triggers (manual and automatic) +- [X] Define emrgancy triggers (manual and automatic) - [ ] Expose temporary control in case of emergancy - Triggers - Acccess @@ -36,6 +36,10 @@ - [ ] Write unit tests - [ ] Develop a program to visualize the data - [ ] CLI frontend - - +- [X] Emergaency +- [X] Send state with accesslist +- [X] Split monitor into different class +- [ ] Make a script that adds types, and thier basic database ops?? (avoid writing boiler-plate) +- [ ] Make a script that emulates a door and monitor +- [ ] Check file premissions on .env file, if global reject eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJibHVldG9vdGhfbWFjIjoic3RyaW5nIn0.ELl5AfBR1NdM4_OFhl_SCTm9EMPpqjiCKOSS0CrOJps \ No newline at end of file diff --git a/sql_app/auth_helper.py b/sql_app/auth_helper.py index ff9a66b..93b2ba8 100644 --- a/sql_app/auth_helper.py +++ b/sql_app/auth_helper.py @@ -1,3 +1,5 @@ +# May 2022 +# Hesham T. Banafa from typing import Optional from decouple import config @@ -65,4 +67,4 @@ def valid_monitor_token(token: str, db: Session): mac_signed = payload.get("bluetooth_mac") monitor = crud.get_monitor_bluetooth(db, mac_signed) - return monitor \ No newline at end of file + return monitor diff --git a/sql_app/crud.py b/sql_app/crud.py index 8fbd404..38f0ac1 100644 --- a/sql_app/crud.py +++ b/sql_app/crud.py @@ -1,3 +1,6 @@ +# March 2022 +# Hesham T. Banafa + # CRUD (Create, Read, Update, Delete) from db from sqlalchemy import select, join diff --git a/sql_app/crypto.py b/sql_app/crypto.py index a4fd8f5..e73d31e 100644 --- a/sql_app/crypto.py +++ b/sql_app/crypto.py @@ -1,3 +1,5 @@ +# March 2022 +# Hesham T. Banafa import os from hashlib import pbkdf2_hmac diff --git a/sql_app/database.py b/sql_app/database.py index c3c1892..9cedaa6 100644 --- a/sql_app/database.py +++ b/sql_app/database.py @@ -1,3 +1,6 @@ +# March 2022 +# Hesham T. Banafa + from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker diff --git a/sql_app/init_db.py b/sql_app/init_db.py index 1abba88..afc84b7 100644 --- a/sql_app/init_db.py +++ b/sql_app/init_db.py @@ -1,3 +1,5 @@ +# June 2022 +# Hesham T. Banafa from . import crud, main, schemas, auth_helper from decouple import config @@ -132,4 +134,4 @@ def init(): init_open_close_requests() init_user_connections() init_link_room_monitor() - \ No newline at end of file + diff --git a/sql_app/main.py b/sql_app/main.py index 3a1730b..9513651 100644 --- a/sql_app/main.py +++ b/sql_app/main.py @@ -1,3 +1,6 @@ +# March 2022 +# Hesham T. Banafa + from fastapi import Depends, FastAPI, HTTPException, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm, OAuth2AuthorizationCodeBearer from fastapi.security.api_key import APIKey @@ -447,4 +450,4 @@ def get_allowed_usernames(request: schemas.IotDoorPollingRequest, def get(db: Session = Depends(get_db)): mon = crud.get_monitor(db, "ff:ff:ff:ff") - return mon.door \ No newline at end of file + return mon.door diff --git a/sql_app/models.py b/sql_app/models.py index 831ba73..6639c63 100644 --- a/sql_app/models.py +++ b/sql_app/models.py @@ -1,3 +1,6 @@ +# March 2022 +# Hesham T. Banafa + from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DateTime from sqlalchemy.orm import relationship @@ -96,4 +99,4 @@ class EmergancyNotice(Base): smoke_sensor_reading = Column(Integer) timestamp = Column(DateTime) -# TODO: Add table to store active sessions. May periodically clear. \ No newline at end of file +# TODO: Add table to store active sessions. May periodically clear. diff --git a/sql_app/schemas.py b/sql_app/schemas.py index f9d8686..8110b3d 100644 --- a/sql_app/schemas.py +++ b/sql_app/schemas.py @@ -1,3 +1,6 @@ +# March 2022 +# Hesham T. Banafa + from typing import Any, List, Optional from pydantic import BaseModel diff --git a/sql_app/utils.py b/sql_app/utils.py index 50ec5e8..be65e9d 100644 --- a/sql_app/utils.py +++ b/sql_app/utils.py @@ -1,3 +1,5 @@ +# May 2022 +# Hesham T. Banafa from .database import SessionLocal @@ -11,3 +13,4 @@ def get_db(): EMERG_TEMP = 50 EMERG_SMOKE = 1000 EMERG_OPEN_TIME_SEC = 500 +