mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-18 11:59:26 +00:00
♻️ refactor imports
This commit is contained in:
parent
976b730de5
commit
3d542b0055
9 changed files with 22 additions and 22 deletions
|
|
@ -1,8 +1,8 @@
|
|||
from fastapi import Depends, FastAPI, APIRouter, HTTPException, status
|
||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||
from pydantic import BaseModel
|
||||
from ..services.auth import *
|
||||
from ..services.users import *
|
||||
from src.services.auth import *
|
||||
from src.services.users import *
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
router = APIRouter()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
from fastapi import Depends, FastAPI, APIRouter
|
||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||
from pydantic import BaseModel
|
||||
from ..services.auth import *
|
||||
from ..services.users import *
|
||||
from src.services.auth import *
|
||||
from src.services.users import *
|
||||
|
||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/token")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
|||
from passlib.context import CryptContext
|
||||
from jose import JWTError, jwt
|
||||
from datetime import datetime, timedelta
|
||||
from ..services.users import *
|
||||
from ..services.security import *
|
||||
from src.services.users import *
|
||||
from src.services.security import *
|
||||
|
||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/token")
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from typing import List
|
|||
from uuid import uuid4
|
||||
from pydantic import BaseModel
|
||||
from src.services.users import User
|
||||
from ..services.database import create_config_collection, check_database, create_database, learnhouseDB, learnhouseDB
|
||||
from ..services.security import *
|
||||
from src.services.database import create_config_collection, check_database, create_database, learnhouseDB, learnhouseDB
|
||||
from src.services.security import *
|
||||
from fastapi import FastAPI, HTTPException, status, Request, Response, BackgroundTasks
|
||||
from datetime import datetime
|
||||
|
||||
|
|
@ -233,8 +233,6 @@ async def update_coursechapter(coursechapter_object: CourseChapter, coursechapt
|
|||
async def delete_coursechapter(coursechapter_id: str, current_user: User):
|
||||
await check_database()
|
||||
|
||||
|
||||
|
||||
coursechapters = learnhouseDB["coursechapters"]
|
||||
|
||||
coursechapter = coursechapters.find_one(
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from typing import List
|
|||
from uuid import uuid4
|
||||
from pydantic import BaseModel
|
||||
from src.services.users import User
|
||||
from ..services.database import create_config_collection, check_database, create_database, learnhouseDB, learnhouseDB
|
||||
from ..services.security import *
|
||||
from src.services.database import create_config_collection, check_database, create_database, learnhouseDB, learnhouseDB
|
||||
from src.services.security import *
|
||||
from fastapi import FastAPI, HTTPException, status, Request, Response, BackgroundTasks
|
||||
from datetime import datetime
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from typing import List
|
|||
from uuid import uuid4
|
||||
from pydantic import BaseModel
|
||||
from src.services.users import User
|
||||
from ..services.database import create_config_collection, check_database, create_database, learnhouseDB, learnhouseDB
|
||||
from ..services.security import *
|
||||
from src.services.database import create_config_collection, check_database, create_database, learnhouseDB, learnhouseDB
|
||||
from src.services.security import *
|
||||
from fastapi import FastAPI, HTTPException, status, Request, Response, BackgroundTasks
|
||||
from datetime import datetime
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ from typing import List
|
|||
from uuid import uuid4
|
||||
from pydantic import BaseModel
|
||||
from src.services.users import User
|
||||
from ..services.database import check_database, learnhouseDB, learnhouseDB
|
||||
from ..services.security import *
|
||||
from ..services.houses import House
|
||||
from src.services.database import check_database, learnhouseDB, learnhouseDB
|
||||
from src.services.security import *
|
||||
from src.services.houses import House
|
||||
from fastapi import HTTPException, status
|
||||
from datetime import datetime
|
||||
|
||||
|
|
@ -155,7 +155,8 @@ async def verify_user_permissions(action: str, current_user: User):
|
|||
|
||||
isOwner = "owner" in user["user_type"]
|
||||
isEditor = "editor" in user["user_type"]
|
||||
|
||||
|
||||
# TODO: verify for all actions.
|
||||
if action == "delete":
|
||||
if isEditor:
|
||||
raise HTTPException(
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from passlib.context import CryptContext
|
|||
from jose import JWTError, jwt
|
||||
import logging
|
||||
from passlib.hash import pbkdf2_sha256
|
||||
from ..services.database import check_database
|
||||
from ..services.database import check_database, learnhouseDB, learnhouseDB
|
||||
from src.services.database import check_database
|
||||
from src.services.database import check_database, learnhouseDB, learnhouseDB
|
||||
|
||||
### 🔒 JWT ##############################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from pydantic import BaseModel
|
||||
from ..services.database import check_database, learnhouseDB, learnhouseDB
|
||||
from ..services.security import *
|
||||
from src.services.database import check_database, learnhouseDB, learnhouseDB
|
||||
from src.services.security import *
|
||||
from fastapi import HTTPException, status
|
||||
from datetime import datetime
|
||||
|
||||
|
|
@ -24,6 +24,7 @@ class UserInDB(User):
|
|||
|
||||
#### Classes ####################################################
|
||||
|
||||
# TODO : user actions security
|
||||
|
||||
async def get_user(username: str):
|
||||
check_database()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue