feat: add location crud
All checks were successful
Deploy to Production / deploy (push) Successful in 1m2s
All checks were successful
Deploy to Production / deploy (push) Successful in 1m2s
This commit is contained in:
@@ -4,7 +4,15 @@ from typing import Any
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from app.core.security import get_password_hash, verify_password
|
||||
from app.models import Item, ItemCreate, User, UserCreate, UserUpdate
|
||||
from app.models import (
|
||||
Item,
|
||||
ItemCreate,
|
||||
Location,
|
||||
LocationCreate,
|
||||
User,
|
||||
UserCreate,
|
||||
UserUpdate,
|
||||
)
|
||||
|
||||
|
||||
def create_user(*, session: Session, user_create: UserCreate) -> User:
|
||||
@@ -66,3 +74,11 @@ def create_item(*, session: Session, item_in: ItemCreate, owner_id: uuid.UUID) -
|
||||
session.commit()
|
||||
session.refresh(db_item)
|
||||
return db_item
|
||||
|
||||
|
||||
def create_location(*, session: Session, location_in: LocationCreate, owner_id: uuid.UUID) -> Location:
|
||||
db_location = Location.model_validate(location_in, update={"owner_id": owner_id})
|
||||
session.add(db_location)
|
||||
session.commit()
|
||||
session.refresh(db_location)
|
||||
return db_location
|
||||
|
||||
Reference in New Issue
Block a user