Files
xiaoxia-saas/packages/ports/project_repository.py
T
Xiaoxia AI f0cf4e2c14
Deploy / Deploy Staging (push) Failing after 6s
Deploy / Deploy Production (push) Has been skipped
Tests / test (push) Failing after 6s
Tests / lint (push) Failing after 5s
feat(quota): add quota checking and management system
- Implement QuotaChecker for project and storage limits
- Check project count before creation (respect max_projects)
- Check storage availability before upload
- Get quota status with usage percentages
- Update storage usage (increase/decrease)
- Define warning levels (normal/warning/critical/exceeded)
- Add ProjectRepository interface for project counting
- Add 14 comprehensive unit tests (all passed)

Phase 4 Task 22/68 completed
2026-06-17 07:24:14 +08:00

31 lines
709 B
Python

"""
Project 仓储接口
"""
from abc import ABC, abstractmethod
from typing import Optional
from packages.domain.entities import Project
class ProjectRepository(ABC):
"""Project 仓储接口"""
@abstractmethod
def save(self, project: Project) -> None:
"""保存项目"""
pass
@abstractmethod
def find_by_id(self, project_id: str) -> Optional[Project]:
"""根据 ID 查找项目"""
pass
@abstractmethod
def count_by_workspace(self, workspace_id: str) -> int:
"""统计工作空间的项目数量"""
pass
@abstractmethod
def delete(self, project_id: str) -> bool:
"""删除项目"""
pass