add user? new page? new web
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
import uuid
|
||||
@@ -9,6 +9,7 @@ from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from bd.tables.organization import Organization
|
||||
from bd.tables.group import Group
|
||||
from route.auth_utils import get_current_user
|
||||
|
||||
router = APIRouter(tags=["organizations"], prefix="/organizations")
|
||||
|
||||
@@ -30,7 +31,7 @@ def get_session():
|
||||
|
||||
|
||||
@router.post("/", status_code=201)
|
||||
def create_organization(payload: OrganizationCreate):
|
||||
def create_organization(payload: OrganizationCreate, _: object = Depends(get_current_user)):
|
||||
Session = get_session()
|
||||
try:
|
||||
gid = uuid.UUID(payload.group_id)
|
||||
@@ -70,7 +71,7 @@ def get_organization(org_id: str):
|
||||
|
||||
|
||||
@router.put("/{org_id}")
|
||||
def update_organization(org_id: str, payload: OrganizationUpdate):
|
||||
def update_organization(org_id: str, payload: OrganizationUpdate, _: object = Depends(get_current_user)):
|
||||
Session = get_session()
|
||||
try:
|
||||
oid = uuid.UUID(org_id)
|
||||
@@ -98,7 +99,7 @@ def update_organization(org_id: str, payload: OrganizationUpdate):
|
||||
|
||||
|
||||
@router.delete("/{org_id}", status_code=204)
|
||||
def delete_organization(org_id: str):
|
||||
def delete_organization(org_id: str, _: object = Depends(get_current_user)):
|
||||
Session = get_session()
|
||||
try:
|
||||
oid = uuid.UUID(org_id)
|
||||
|
||||
Reference in New Issue
Block a user