mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
feat(backend): renamed endpoints for consistency
This commit is contained in:
@@ -13,7 +13,7 @@ from app.models.user import User
|
|||||||
router = APIRouter(prefix="/categories", tags=["categories"])
|
router = APIRouter(prefix="/categories", tags=["categories"])
|
||||||
|
|
||||||
|
|
||||||
@router.post("/", response_model=CategoryRead, status_code=status.HTTP_201_CREATED)
|
@router.post("/create", response_model=CategoryRead, status_code=status.HTTP_201_CREATED)
|
||||||
async def create_category(
|
async def create_category(
|
||||||
payload: CategoryCreate,
|
payload: CategoryCreate,
|
||||||
session: AsyncSession = Depends(get_async_session),
|
session: AsyncSession = Depends(get_async_session),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def _to_read_model(tx: Transaction) -> TransactionRead:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/", response_model=TransactionRead, status_code=status.HTTP_201_CREATED)
|
@router.post("/create", response_model=TransactionRead, status_code=status.HTTP_201_CREATED)
|
||||||
async def create_transaction(
|
async def create_transaction(
|
||||||
payload: TransactionCreate,
|
payload: TransactionCreate,
|
||||||
session: AsyncSession = Depends(get_async_session),
|
session: AsyncSession = Depends(get_async_session),
|
||||||
@@ -88,7 +88,7 @@ async def get_transaction(
|
|||||||
return _to_read_model(tx)
|
return _to_read_model(tx)
|
||||||
|
|
||||||
|
|
||||||
@router.patch("/{transaction_id}", response_model=TransactionRead)
|
@router.patch("/{transaction_id}/edit", response_model=TransactionRead)
|
||||||
async def update_transaction(
|
async def update_transaction(
|
||||||
transaction_id: int,
|
transaction_id: int,
|
||||||
payload: TransactionUpdate,
|
payload: TransactionUpdate,
|
||||||
@@ -130,7 +130,7 @@ async def update_transaction(
|
|||||||
return _to_read_model(tx)
|
return _to_read_model(tx)
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/{transaction_id}", status_code=status.HTTP_204_NO_CONTENT)
|
@router.delete("/{transaction_id}/delete", status_code=status.HTTP_204_NO_CONTENT)
|
||||||
async def delete_transaction(
|
async def delete_transaction(
|
||||||
transaction_id: int,
|
transaction_id: int,
|
||||||
session: AsyncSession = Depends(get_async_session),
|
session: AsyncSession = Depends(get_async_session),
|
||||||
|
|||||||
Reference in New Issue
Block a user