You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.py 1.3 KiB

1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
12345678910111213141516171819202122232425262728293031323334353637383940
  1. class Settings:
  2. PROJECT_NAME: str = "VMS"
  3. PROJECT_VERSION: str = "1.0.0"
  4. POSTGRES_USER: str = "VMSBase"
  5. POSTGRES_PASSWORD = "VMSBasePass"
  6. POSTGRES_SERVER: str = "db"
  7. POSTGRES_PORT: str = "5432"
  8. POSTGRES_DB: str = "VMSData"
  9. DATABASE_URL = f"postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_SERVER}:{POSTGRES_PORT}/{POSTGRES_DB}"
  10. ACCESS_TOKEN_EXPIRE: int = 60 * 24 * 7 # 7 days
  11. SECRET_KEY: str = "tH357aC6oA7ofCaN3yTffYkRh"
  12. ALGORITHM: str = "HS256"
  13. ALLOWED_TASK_STATUS: list = ["Pending", "In Progress", "Completed", "Cancelled"]
  14. ALLOWED_ROLES: list = ["Admin", "Driver", "Maintenance", "Fueling"]
  15. settings = Settings()
  16. def createAdminAcc():
  17. from db.session import SessionLocal
  18. from db.repository.user import create_new_user
  19. from schemas.user import UserCreate
  20. from db.models.user import User
  21. db = SessionLocal()
  22. user = UserCreate(
  23. Email="madi.turgunov@nu.edu.kz",
  24. Password="1234567",
  25. Name="Madi",
  26. LastName="Turgunov",
  27. ContactNumber="+77071234567",
  28. Role="Admin",
  29. GovernmentId="123456789",
  30. Address="Nazarbayev University",
  31. )
  32. if db.query(User).filter(User.Email == user.Email).first():
  33. return False
  34. create_new_user(user=user, db=db)
  35. return True