12 lines
416 B
Python
12 lines
416 B
Python
from sqlalchemy.ext.asyncio import AsyncSession
|
|
from sqlalchemy.future import select
|
|
from app.db.models import File
|
|
|
|
|
|
async def save_file_metadata(db: AsyncSession, filename: str, filepath: str, content_type: str, size: int):
|
|
new_file = File(filename=filename, filepath=filepath, content_type=content_type, size=size)
|
|
db.add(new_file)
|
|
await db.commit()
|
|
await db.refresh(new_file)
|
|
return new_file
|