f0cf4e2c14
- 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
31 lines
709 B
Python
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
|