feat: add full project - backend, frontend, docker, specs and configs

This commit is contained in:
MatheusAlves96 2026-04-20 23:59:45 -03:00
parent b77c7d5a01
commit e6cb06255b
24489 changed files with 61341 additions and 36 deletions

View file

@ -0,0 +1,67 @@
import uuid
from app.extensions import db
# Association table N:N between Property and Amenity — no model class needed
property_amenity = db.Table(
"property_amenity",
db.Column(
"property_id",
db.UUID(as_uuid=True),
db.ForeignKey("properties.id", ondelete="CASCADE"),
primary_key=True,
),
db.Column(
"amenity_id",
db.Integer,
db.ForeignKey("amenities.id", ondelete="CASCADE"),
primary_key=True,
),
)
class PropertyType(db.Model):
"""Hierarchical property type: Residencial > Apartamento"""
__tablename__ = "property_types"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(100), nullable=False)
slug = db.Column(db.String(120), unique=True, nullable=False, index=True)
parent_id = db.Column(
db.Integer,
db.ForeignKey("property_types.id", ondelete="SET NULL"),
nullable=True,
index=True,
)
# Self-referential relationship
subtypes = db.relationship(
"PropertyType",
backref=db.backref("parent", remote_side=[id]),
lazy="select",
)
def __repr__(self) -> str:
return f"<PropertyType {self.slug!r}>"
class Amenity(db.Model):
"""Tagged feature/amenity for a property (characteristic, leisure, condo, security)"""
__tablename__ = "amenities"
GROUPS = ("caracteristica", "lazer", "condominio", "seguranca")
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(100), nullable=False)
slug = db.Column(db.String(120), unique=True, nullable=False, index=True)
group = db.Column(
db.Enum(
"caracteristica", "lazer", "condominio", "seguranca", name="amenity_group"
),
nullable=False,
)
def __repr__(self) -> str:
return f"<Amenity {self.slug!r} group={self.group!r}>"