Rename terminology to industry standard terms
- Grove → Project - Tree → Package - Fruit → Artifact - Graft → Tag - Cultivate → Upload - Harvest → Download Updated across: - Backend models, schemas, and routes - Frontend types, API client, and components - README documentation - API endpoints now use /project/:project/packages pattern
This commit is contained in:
@@ -11,8 +11,8 @@ import uuid
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
class Grove(Base):
|
||||
__tablename__ = "groves"
|
||||
class Project(Base):
|
||||
__tablename__ = "projects"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
name = Column(String(255), unique=True, nullable=False)
|
||||
@@ -22,39 +22,39 @@ class Grove(Base):
|
||||
updated_at = Column(DateTime(timezone=True), default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
created_by = Column(String(255), nullable=False)
|
||||
|
||||
trees = relationship("Tree", back_populates="grove", cascade="all, delete-orphan")
|
||||
permissions = relationship("AccessPermission", back_populates="grove", cascade="all, delete-orphan")
|
||||
packages = relationship("Package", back_populates="project", cascade="all, delete-orphan")
|
||||
permissions = relationship("AccessPermission", back_populates="project", cascade="all, delete-orphan")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_groves_name", "name"),
|
||||
Index("idx_groves_created_by", "created_by"),
|
||||
Index("idx_projects_name", "name"),
|
||||
Index("idx_projects_created_by", "created_by"),
|
||||
)
|
||||
|
||||
|
||||
class Tree(Base):
|
||||
__tablename__ = "trees"
|
||||
class Package(Base):
|
||||
__tablename__ = "packages"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
grove_id = Column(UUID(as_uuid=True), ForeignKey("groves.id", ondelete="CASCADE"), nullable=False)
|
||||
project_id = Column(UUID(as_uuid=True), ForeignKey("projects.id", ondelete="CASCADE"), nullable=False)
|
||||
name = Column(String(255), nullable=False)
|
||||
description = Column(Text)
|
||||
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
updated_at = Column(DateTime(timezone=True), default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
grove = relationship("Grove", back_populates="trees")
|
||||
grafts = relationship("Graft", back_populates="tree", cascade="all, delete-orphan")
|
||||
harvests = relationship("Harvest", back_populates="tree", cascade="all, delete-orphan")
|
||||
consumers = relationship("Consumer", back_populates="tree", cascade="all, delete-orphan")
|
||||
project = relationship("Project", back_populates="packages")
|
||||
tags = relationship("Tag", back_populates="package", cascade="all, delete-orphan")
|
||||
uploads = relationship("Upload", back_populates="package", cascade="all, delete-orphan")
|
||||
consumers = relationship("Consumer", back_populates="package", cascade="all, delete-orphan")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_trees_grove_id", "grove_id"),
|
||||
Index("idx_trees_name", "name"),
|
||||
Index("idx_packages_project_id", "project_id"),
|
||||
Index("idx_packages_name", "name"),
|
||||
{"extend_existing": True},
|
||||
)
|
||||
|
||||
|
||||
class Fruit(Base):
|
||||
__tablename__ = "fruits"
|
||||
class Artifact(Base):
|
||||
__tablename__ = "artifacts"
|
||||
|
||||
id = Column(String(64), primary_key=True) # SHA256 hash
|
||||
size = Column(BigInteger, nullable=False)
|
||||
@@ -65,70 +65,70 @@ class Fruit(Base):
|
||||
ref_count = Column(Integer, default=1)
|
||||
s3_key = Column(String(1024), nullable=False)
|
||||
|
||||
grafts = relationship("Graft", back_populates="fruit")
|
||||
harvests = relationship("Harvest", back_populates="fruit")
|
||||
tags = relationship("Tag", back_populates="artifact")
|
||||
uploads = relationship("Upload", back_populates="artifact")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_fruits_created_at", "created_at"),
|
||||
Index("idx_fruits_created_by", "created_by"),
|
||||
Index("idx_artifacts_created_at", "created_at"),
|
||||
Index("idx_artifacts_created_by", "created_by"),
|
||||
)
|
||||
|
||||
|
||||
class Graft(Base):
|
||||
__tablename__ = "grafts"
|
||||
class Tag(Base):
|
||||
__tablename__ = "tags"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
tree_id = Column(UUID(as_uuid=True), ForeignKey("trees.id", ondelete="CASCADE"), nullable=False)
|
||||
package_id = Column(UUID(as_uuid=True), ForeignKey("packages.id", ondelete="CASCADE"), nullable=False)
|
||||
name = Column(String(255), nullable=False)
|
||||
fruit_id = Column(String(64), ForeignKey("fruits.id"), nullable=False)
|
||||
artifact_id = Column(String(64), ForeignKey("artifacts.id"), nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
created_by = Column(String(255), nullable=False)
|
||||
|
||||
tree = relationship("Tree", back_populates="grafts")
|
||||
fruit = relationship("Fruit", back_populates="grafts")
|
||||
history = relationship("GraftHistory", back_populates="graft", cascade="all, delete-orphan")
|
||||
package = relationship("Package", back_populates="tags")
|
||||
artifact = relationship("Artifact", back_populates="tags")
|
||||
history = relationship("TagHistory", back_populates="tag", cascade="all, delete-orphan")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_grafts_tree_id", "tree_id"),
|
||||
Index("idx_grafts_fruit_id", "fruit_id"),
|
||||
Index("idx_tags_package_id", "package_id"),
|
||||
Index("idx_tags_artifact_id", "artifact_id"),
|
||||
)
|
||||
|
||||
|
||||
class GraftHistory(Base):
|
||||
__tablename__ = "graft_history"
|
||||
class TagHistory(Base):
|
||||
__tablename__ = "tag_history"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
graft_id = Column(UUID(as_uuid=True), ForeignKey("grafts.id", ondelete="CASCADE"), nullable=False)
|
||||
old_fruit_id = Column(String(64), ForeignKey("fruits.id"))
|
||||
new_fruit_id = Column(String(64), ForeignKey("fruits.id"), nullable=False)
|
||||
tag_id = Column(UUID(as_uuid=True), ForeignKey("tags.id", ondelete="CASCADE"), nullable=False)
|
||||
old_artifact_id = Column(String(64), ForeignKey("artifacts.id"))
|
||||
new_artifact_id = Column(String(64), ForeignKey("artifacts.id"), nullable=False)
|
||||
changed_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
changed_by = Column(String(255), nullable=False)
|
||||
|
||||
graft = relationship("Graft", back_populates="history")
|
||||
tag = relationship("Tag", back_populates="history")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_graft_history_graft_id", "graft_id"),
|
||||
Index("idx_tag_history_tag_id", "tag_id"),
|
||||
)
|
||||
|
||||
|
||||
class Harvest(Base):
|
||||
__tablename__ = "harvests"
|
||||
class Upload(Base):
|
||||
__tablename__ = "uploads"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
fruit_id = Column(String(64), ForeignKey("fruits.id"), nullable=False)
|
||||
tree_id = Column(UUID(as_uuid=True), ForeignKey("trees.id"), nullable=False)
|
||||
artifact_id = Column(String(64), ForeignKey("artifacts.id"), nullable=False)
|
||||
package_id = Column(UUID(as_uuid=True), ForeignKey("packages.id"), nullable=False)
|
||||
original_name = Column(String(1024))
|
||||
harvested_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
harvested_by = Column(String(255), nullable=False)
|
||||
uploaded_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
uploaded_by = Column(String(255), nullable=False)
|
||||
source_ip = Column(String(45))
|
||||
|
||||
fruit = relationship("Fruit", back_populates="harvests")
|
||||
tree = relationship("Tree", back_populates="harvests")
|
||||
artifact = relationship("Artifact", back_populates="uploads")
|
||||
package = relationship("Package", back_populates="uploads")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_harvests_fruit_id", "fruit_id"),
|
||||
Index("idx_harvests_tree_id", "tree_id"),
|
||||
Index("idx_harvests_harvested_at", "harvested_at"),
|
||||
Index("idx_uploads_artifact_id", "artifact_id"),
|
||||
Index("idx_uploads_package_id", "package_id"),
|
||||
Index("idx_uploads_uploaded_at", "uploaded_at"),
|
||||
)
|
||||
|
||||
|
||||
@@ -136,15 +136,15 @@ class Consumer(Base):
|
||||
__tablename__ = "consumers"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
tree_id = Column(UUID(as_uuid=True), ForeignKey("trees.id", ondelete="CASCADE"), nullable=False)
|
||||
package_id = Column(UUID(as_uuid=True), ForeignKey("packages.id", ondelete="CASCADE"), nullable=False)
|
||||
project_url = Column(String(2048), nullable=False)
|
||||
last_access = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
|
||||
tree = relationship("Tree", back_populates="consumers")
|
||||
package = relationship("Package", back_populates="consumers")
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_consumers_tree_id", "tree_id"),
|
||||
Index("idx_consumers_package_id", "package_id"),
|
||||
Index("idx_consumers_last_access", "last_access"),
|
||||
)
|
||||
|
||||
@@ -153,17 +153,17 @@ class AccessPermission(Base):
|
||||
__tablename__ = "access_permissions"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
grove_id = Column(UUID(as_uuid=True), ForeignKey("groves.id", ondelete="CASCADE"), nullable=False)
|
||||
project_id = Column(UUID(as_uuid=True), ForeignKey("projects.id", ondelete="CASCADE"), nullable=False)
|
||||
user_id = Column(String(255), nullable=False)
|
||||
level = Column(String(20), nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
expires_at = Column(DateTime(timezone=True))
|
||||
|
||||
grove = relationship("Grove", back_populates="permissions")
|
||||
project = relationship("Project", back_populates="permissions")
|
||||
|
||||
__table_args__ = (
|
||||
CheckConstraint("level IN ('read', 'write', 'admin')", name="check_level"),
|
||||
Index("idx_access_permissions_grove_id", "grove_id"),
|
||||
Index("idx_access_permissions_project_id", "project_id"),
|
||||
Index("idx_access_permissions_user_id", "user_id"),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user