Started using Bootstrap for styling, moved app factory, added tests, started work on login and registration templates, and more

This commit is contained in:
2024-05-05 16:15:55 -04:00
parent 5d9ffffb79
commit 4503603915
19 changed files with 327 additions and 86 deletions

View File

@@ -17,12 +17,18 @@ class Visit(db.Model):
date_time = db.Column(db.DateTime, nullable=False)
owner_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
owner = db.relationship('User', back_populates='visits')
visit_type = db.Column(Enum(VisitType), default=VisitType.MEDIUM_MINUTE_WALK)
visit_type = db.Column(Enum(VisitType), default=VisitType.MEDIUM_WALK)
dog_id = db.Column(db.Integer, db.ForeignKey('dogs.id'), nullable=False)
dogs = db.relationship('Dog', back_populates='visits')
created_at = db.Column(db.DateTime, default=datetime.utcnow)
updated_at = db.Column(db.DateTime, onupdate=datetime.utcnow)
def __str__(self):
return self.date_time
def __repr__(self):
return self.to_dict()
def get_date(self):
year = self.date_time.year
month = self.date_time.month
@@ -42,9 +48,14 @@ class Visit(db.Model):
def to_dict(self):
return {
'ID': self.id,
'Date-Time': self.date_time,
'Owner-ID': self.owner_id,
'Dog-ID': self.dog_id
'id': self.id,
'date_time': self.date_time,
'owner_id': self.owner_id,
'owner': self.owner,
'visit_type': self.visit_type,
'dog_id': self.dog_id,
'dogs': self.dogs,
'created_at': self.created_at,
'updated_at': self.update_at
}

View File

@@ -2,8 +2,8 @@ from enum import Enum
from enum import auto
class VisitType(Enum):
SMALL_MINUTE_WALK = auto()
MEDIUM_MINUTE_WALK = auto()
LARGE_MINUTE_WALK = auto()
HOUSE_SITTING = auto()
SMALL_WALK = '15-minute walk'
MEDIUM_WALK = '30-minute walk'
LARGE_WALK = '45-minute walk'
HOUSE_SITTING = 'House sitting'