|
|
|
|
@ -190,18 +190,18 @@ def create_items(
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# construct a list of schemas.Item items
|
|
|
|
|
spreadsheet_item_list = [
|
|
|
|
|
schemas.ItemCreate(
|
|
|
|
|
**{
|
|
|
|
|
key: row[i]
|
|
|
|
|
for i, key in enumerate(schemas.ItemCreate.__fields__.keys())
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
for row in sheet["data"]
|
|
|
|
|
]
|
|
|
|
|
# dump all the data into database
|
|
|
|
|
try:
|
|
|
|
|
# construct a list of schemas.Item items
|
|
|
|
|
spreadsheet_item_list = [
|
|
|
|
|
schemas.ItemCreate(
|
|
|
|
|
**{
|
|
|
|
|
key: row[i]
|
|
|
|
|
for i, key in enumerate(schemas.ItemCreate.__fields__.keys())
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
for row in sheet["data"]
|
|
|
|
|
]
|
|
|
|
|
# dump all the data into database
|
|
|
|
|
accepted, processed = crud.insert_items(db=db, items=spreadsheet_item_list)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
raise HTTPException(
|
|
|
|
|
|