26 lines
591 B
Python
26 lines
591 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from . import models, schemas
|
|
|
|
|
|
def create_record(db: Session, record: schemas.Record):
|
|
db_record = models.Record(
|
|
region=record.region,
|
|
area=record.area,
|
|
town=record.town,
|
|
street=record.street,
|
|
start=record.start,
|
|
finish=record.finish,
|
|
branch=record.branch,
|
|
res=record.res,
|
|
comment=record.comment,
|
|
building_id=record.building_id,
|
|
lat=record.lat,
|
|
lng=record.lng,
|
|
)
|
|
db.add(db_record)
|
|
db.commit()
|
|
db.refresh(db_record)
|
|
|
|
return db_record
|