```
feat: 添加飞书用户模块和订阅功能支持 - 新增feishu_users模块用于处理飞书用户身份验证和权限管理 - 新增subscriptions模块用于处理订阅相关功能 - 新增personalization模块用于个性化服务 - 在alembic迁移配置中注册新的模型模块 - 在API路由器中添加feishu_users和subscriptions路由 - 实现事件调度服务的改进,包括错误处理和状态更新优化 - 添加飞书命令处理的权限检查机制 - 实现飞书应用票据事件处理 - 改进审计日志记录功能 ```
This commit is contained in:
65
app/modules/subscriptions/constants.py
Normal file
65
app/modules/subscriptions/constants.py
Normal file
@@ -0,0 +1,65 @@
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class SubscriptionTargetType(StrEnum):
|
||||
USER = "user"
|
||||
CHAT = "chat"
|
||||
|
||||
|
||||
class SubscriptionScheduleType(StrEnum):
|
||||
ONCE = "once"
|
||||
DAILY = "daily"
|
||||
WEEKDAY = "weekday"
|
||||
WEEKLY = "weekly"
|
||||
MONTHLY = "monthly"
|
||||
INTERVAL = "interval"
|
||||
|
||||
|
||||
class PushSubscriptionStatus(StrEnum):
|
||||
ACTIVE = "active"
|
||||
PAUSED = "paused"
|
||||
CANCELLED = "cancelled"
|
||||
COMPLETED = "completed"
|
||||
|
||||
|
||||
class PushDeliveryStatus(StrEnum):
|
||||
PENDING = "pending"
|
||||
PROCESSING = "processing"
|
||||
RETRY = "retry"
|
||||
SENT = "sent"
|
||||
FAILED = "failed"
|
||||
SKIPPED = "skipped"
|
||||
|
||||
|
||||
class SubscriptionAuditAction(StrEnum):
|
||||
CREATE = "subscription.create"
|
||||
PAUSE = "subscription.pause"
|
||||
RESUME = "subscription.resume"
|
||||
CANCEL = "subscription.cancel"
|
||||
UPDATE_TIMEZONE = "subscription.update_timezone"
|
||||
UPDATE_QUIET_HOURS = "subscription.update_quiet_hours"
|
||||
DELIVERY_SENT = "subscription.delivery.sent"
|
||||
DELIVERY_FAILED = "subscription.delivery.failed"
|
||||
DELIVERY_SKIPPED = "subscription.delivery.skipped"
|
||||
|
||||
|
||||
DEFAULT_SUBSCRIPTION_TIMEZONE = "Asia/Shanghai"
|
||||
MAX_ACTIVE_SUBSCRIPTIONS = 50
|
||||
MAX_DAILY_DELIVERIES = 96
|
||||
MIN_INTERVAL_MINUTES = 15
|
||||
DELIVERY_RETRY_DELAYS_SECONDS = (60, 300, 900)
|
||||
SUBSCRIPTION_LEASE_SECONDS = 120
|
||||
DELIVERY_LEASE_SECONDS = 300
|
||||
|
||||
SUBSCRIPTION_NOT_FOUND = "Subscription not found"
|
||||
DELIVERY_NOT_FOUND = "Subscription delivery not found"
|
||||
SUBSCRIPTION_LIMIT_REACHED = "A user may enable at most 50 subscriptions"
|
||||
DAILY_DELIVERY_LIMIT_REACHED = "Daily delivery limit reached"
|
||||
INVALID_SCHEDULE = "Unsupported or invalid schedule expression"
|
||||
INVALID_TIMEZONE = "Invalid IANA timezone"
|
||||
INVALID_QUIET_HOURS = "Quiet hours must use different HH:MM start and end values"
|
||||
INVALID_PRIVATE_TARGET = "Private subscriptions must target the current user's open_id"
|
||||
INVALID_GROUP_TARGET = "Group subscriptions must be created by an administrator in the current group"
|
||||
INACTIVE_USER = "Feishu user is disabled"
|
||||
EMPTY_PROMPT = "Subscription prompt is required"
|
||||
|
||||
Reference in New Issue
Block a user