Skip to content

Commit cabd525

Browse files
authored
Update README.md
1 parent 0b79e43 commit cabd525

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,15 @@ from fastapi_quickcrud import CrudMethods
161161
from fastapi_quickcrud import sqlalchemy_to_pydantic
162162
from fastapi_quickcrud.misc.memory_sql import sync_memory_db
163163

164-
app = FastAPI()
165-
166-
Base = declarative_base()
167-
metadata = Base.metadata
168-
169164
from sqlalchemy import CHAR, Column, Integer
170165
from sqlalchemy.ext.declarative import declarative_base
171166

167+
app = FastAPI()
168+
172169
Base = declarative_base()
173170
metadata = Base.metadata
174171

172+
175173
class Child(Base):
176174
__tablename__ = 'right'
177175
id = Column(Integer, primary_key=True)
@@ -190,14 +188,15 @@ friend_model_set = sqlalchemy_to_pydantic(db_model=Child,
190188
],
191189
exclude_columns=[])
192190

193-
post_model = friend_model_set.POST[CrudMethods.CREATE_ONE]
194191

192+
post_model = friend_model_set.POST[CrudMethods.CREATE_ONE]
195193
sync_memory_db.create_memory_table(Child)
194+
196195
@app.post("/hello",
197-
status_code=201,
196+
status_code=201,
198197
tags=["Child"],
199-
response_model=post_model.responseModel,
200-
dependencies=[])
198+
response_model=post_model.responseModel,
199+
dependencies=[])
201200
async def my_api(
202201
query: post_model.requestBodyModel = Depends(post_model.requestBodyModel),
203202
session=Depends(sync_memory_db.get_memory_db_session)
@@ -208,6 +207,8 @@ async def my_api(
208207
session.refresh(db_item)
209208
return db_item.__dict__
210209

210+
211+
211212
uvicorn.run(app, host="0.0.0.0", port=8000, debug=False)
212213

213214
```

0 commit comments

Comments
 (0)