class FeedItem(db.Entity): feed = orm.Required(Feed) enclosure_url = orm.Optional(str) enclosure_path = orm.Optional(str) timestamp = orm.Optional(datetime, index=True) read = orm.Required(bool, index=True, default=bool) viewed = orm.Required(bool, index=True, default=bool) starred = orm.Required(bool, index=True, default=bool) title = orm.Required(str) text = orm.Optional(str) url = orm.Required(str, unique=True) orm.composite_index(read, timestamp)
class Location(db.Entity): """An entity to flexibly link an object with its location.""" object_class = Required(str) object_id = Required(int) composite_index(object_class, object_id) location_class = Required(str) location_id = Required(int) index = Required(int, unique=True) @property def str_id(self): """Return the string identifier (object_class:object_id).""" return f"{self.object_class}:{self.object_id}"