feat: Add 4 endpoints via editor
This commit is contained in:
parent
920b5f10d0
commit
069a4f9ee7
13
endpoints/rentcollection.delete.py
Normal file
13
endpoints/rentcollection.delete.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Simplified DELETE template
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.delete("/rentcollection", status_code=status.HTTP_204_NO_CONTENT) # Operates on the base path
|
||||||
|
async def delete_rentcollection( # Function name reflects resource (plural)
|
||||||
|
# db: Session = Depends(get_db) # Example dependency
|
||||||
|
):
|
||||||
|
"""Endpoints for rentcollection: Delete resource(s)"""
|
||||||
|
# TODO: Implement logic to delete rentcollection (e.g., clear collection or delete specific item based on criteria?)
|
||||||
|
print(f"Deleting rentcollection")
|
||||||
|
return None # Return No Content on success
|
14
endpoints/rentcollection.get.py
Normal file
14
endpoints/rentcollection.get.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
# TODO: Import db session, schemas, models as needed
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/rentcollection") # Operates on the base path
|
||||||
|
async def get_rentcollection( # Function name reflects resource (plural)
|
||||||
|
# db: Session = Depends(get_db) # Example dependency
|
||||||
|
):
|
||||||
|
"""Endpoints for rentcollection: Get resource(s)"""
|
||||||
|
# TODO: Implement logic to fetch rentcollection (e.g., a list or single object)
|
||||||
|
print(f"Fetching rentcollection")
|
||||||
|
return [] # Placeholder
|
20
endpoints/rentcollection.post.py
Normal file
20
endpoints/rentcollection.post.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, status, HTTPException
|
||||||
|
# TODO: Import db session, schemas, models as needed
|
||||||
|
# from pydantic import BaseModel # Example
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
# TODO: Define request body schema if needed
|
||||||
|
# class rentcollection_Create(BaseModel):
|
||||||
|
# name: str # Example field
|
||||||
|
|
||||||
|
@router.post("/rentcollection", status_code=status.HTTP_201_CREATED) # Operates on the base path
|
||||||
|
async def create_rentcollection(
|
||||||
|
# item: rentcollection_Create, # Example request body
|
||||||
|
# db: Session = Depends(get_db) # Example dependency
|
||||||
|
):
|
||||||
|
"""Endpoints for rentcollection: Create resource"""
|
||||||
|
# TODO: Implement logic to create a new rentcollection
|
||||||
|
print(f"Creating new rentcollection") # with data: {item.dict()}")
|
||||||
|
return {"message": "rentcollection created successfully"} # Placeholder
|
20
endpoints/rentcollection.put.py
Normal file
20
endpoints/rentcollection.put.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Simplified PUT template
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
|
# TODO: Import db session, schemas, models as needed
|
||||||
|
# from pydantic import BaseModel # Example
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
# TODO: Define request body schema if needed
|
||||||
|
# class rentcollection_Update(BaseModel): # Schema might represent the whole collection or item
|
||||||
|
# data: list # Example field
|
||||||
|
|
||||||
|
@router.put("/rentcollection") # Operates on the base path
|
||||||
|
async def update_rentcollection( # Function name reflects resource (plural)
|
||||||
|
# item: rentcollection_Update, # Example request body
|
||||||
|
# db: Session = Depends(get_db) # Example dependency
|
||||||
|
):
|
||||||
|
"""Endpoints for rentcollection: Update resource(s)"""
|
||||||
|
# TODO: Implement logic to update rentcollection (e.g., replace collection or update specific item based on body)
|
||||||
|
print(f"Updating rentcollection") # with data: {item.dict()}")
|
||||||
|
return {"message": "rentcollection updated successfully"} # Placeholder
|
Loading…
x
Reference in New Issue
Block a user