Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

config.py 1.1 KiB

12345678910111213141516171819202122232425262728293031323334353637
  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 = "localhost"
  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. settings = Settings()
  14. def createAdminAcc():
  15. from db.session import SessionLocal
  16. from db.repository.user import create_new_user
  17. from schemas.user import UserCreate
  18. from db.models.user import User
  19. db = SessionLocal()
  20. user = UserCreate(
  21. Email="madi.turgunov@nu.edu.kz",
  22. Password="1234567",
  23. Name="Madi",
  24. LastName="Turgunov",
  25. ContactNumber="+77071234567",
  26. Role="Admin",
  27. BirthDate="2000-01-01T00:00:00+06:00",
  28. )
  29. if db.query(User).filter(User.Email == user.Email).first():
  30. return False
  31. create_new_user(user=user, db=db)
  32. return True