mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-09 17:20:17 +00:00
Added the Services layer to the code to do the database operation
This commit is contained in:
parent
0a9c2952ec
commit
8ad57b548f
@@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
@@ -16,3 +18,11 @@ class Entry(Base):
|
||||
secondary=photo_entry_association,
|
||||
back_populates="entries")
|
||||
fk_TravelDiary_id = Column(Integer, ForeignKey("TravelDiary.id"))
|
||||
def __init__(self, title: str, text: str, date: str, travel_diary_id: int, **kw: Any):
|
||||
super().__init__(**kw)
|
||||
self.title = title
|
||||
self.text = text
|
||||
self.date = date
|
||||
self.fk_TravelDiary_id = travel_diary_id
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import Column, String, Integer
|
||||
|
||||
from ..database import Base
|
||||
@@ -6,3 +8,7 @@ class TravelDiary(Base):
|
||||
__tablename__ = "TravelDiary"
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String)
|
||||
|
||||
def __init__(self, name: str, **kw: Any):
|
||||
super().__init__(**kw)
|
||||
self.name = name
|
||||
|
||||
Reference in New Issue
Block a user