Adding AugmentedItem notes
This commit is contained in:
1 parent
30a13644ce
commit
34679d53e8
10 files changed
+254
-12
No files matched your search
@@ -0,0 +1,19 @@
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.models.augmented_part import AugmentedPart, AugmentedPartNote
|
||||
from app.models.user import User
|
||||
|
||||
|
||||
async def create(
|
||||
db: AsyncSession, *, augmented_part: AugmentedPart, author: User, body: str
|
||||
) -> AugmentedPartNote:
|
||||
note = AugmentedPartNote(
|
||||
augmented_part_id=augmented_part.id,
|
||||
user_id=author.id,
|
||||
username=author.full_name or author.email,
|
||||
body=body,
|
||||
)
|
||||
db.add(note)
|
||||
await db.commit()
|
||||
await db.refresh(note)
|
||||
return note
|
||||
Reference in new issue
Block a user