File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 1-
21from datetime import datetime
3- from bson import ObjectId
4- from fastapi import FastAPI , HTTPException
5- from fastapi .middleware .cors import CORSMiddleware
62
3+ from bson import ObjectId
74from database import schemas_collection
85from datamodel import SchemaDefinition , UpdateSchema
6+ from fastapi import FastAPI , HTTPException
7+ from fastapi .middleware .cors import CORSMiddleware
98
109# Initialize FastAPI application
1110app = FastAPI ()
1918 allow_headers = ["*" ],
2019)
2120
21+
2222@app .get ("/schemas" )
2323async def get_all_schemas ():
2424 """
@@ -74,7 +74,9 @@ async def update_schema(id: str, update: UpdateSchema):
7474 dict: Success message.
7575 """
7676 # Prepare update fields (ignore None values)
77- update_fields = {key : value for key , value in update .dict ().items () if value is not None }
77+ update_fields = {
78+ key : value for key , value in update .dict ().items () if value is not None
79+ }
7880
7981 result = schemas_collection .update_one (
8082 {"_id" : ObjectId (id )},
@@ -102,9 +104,3 @@ async def delete_schema(id: str):
102104
103105 if result .deleted_count == 0 :
104106 raise HTTPException (status_code = 404 , detail = "Schema not found" )
105-
106-
107-
108-
109-
110-
You can’t perform that action at this time.
0 commit comments