34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
|  | package repositories | ||
|  | 
 | ||
|  | import ( | ||
|  | 	"context" | ||
|  | 	"tyapi-server/internal/domains/article/entities" | ||
|  | ) | ||
|  | 
 | ||
|  | // ScheduledTaskRepository 定时任务仓储接口 | ||
|  | type ScheduledTaskRepository interface { | ||
|  | 	// Create 创建定时任务记录 | ||
|  | 	Create(ctx context.Context, task entities.ScheduledTask) (entities.ScheduledTask, error) | ||
|  | 	 | ||
|  | 	// GetByTaskID 根据Asynq任务ID获取任务记录 | ||
|  | 	GetByTaskID(ctx context.Context, taskID string) (entities.ScheduledTask, error) | ||
|  | 	 | ||
|  | 	// GetByArticleID 根据文章ID获取任务记录 | ||
|  | 	GetByArticleID(ctx context.Context, articleID string) (entities.ScheduledTask, error) | ||
|  | 	 | ||
|  | 	// Update 更新任务记录 | ||
|  | 	Update(ctx context.Context, task entities.ScheduledTask) error | ||
|  | 	 | ||
|  | 	// Delete 删除任务记录 | ||
|  | 	Delete(ctx context.Context, taskID string) error | ||
|  | 	 | ||
|  | 	// MarkAsCancelled 标记任务为已取消 | ||
|  | 	MarkAsCancelled(ctx context.Context, taskID string) error | ||
|  | 	 | ||
|  | 	// GetActiveTasks 获取活动状态的任务列表 | ||
|  | 	GetActiveTasks(ctx context.Context) ([]entities.ScheduledTask, error) | ||
|  | 	 | ||
|  | 	// GetExpiredTasks 获取过期的任务列表 | ||
|  | 	GetExpiredTasks(ctx context.Context) ([]entities.ScheduledTask, error) | ||
|  | } |