modsetter--surfsense
6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
63 行
1.4 KiB
Python
63 行
1.4 KiB
Python
"""
|
|
Schemas for incentive tasks API.
|
|
"""
|
|
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from app.db import INCENTIVE_TASKS_CONFIG, IncentiveTaskType
|
|
|
|
|
|
class IncentiveTaskInfo(BaseModel):
|
|
"""Information about an available incentive task."""
|
|
|
|
task_type: IncentiveTaskType
|
|
title: str
|
|
description: str
|
|
# Credit reward in USD micro-units (1_000_000 == $1.00).
|
|
credit_micros_reward: int
|
|
action_url: str
|
|
completed: bool
|
|
completed_at: datetime | None = None
|
|
|
|
|
|
class IncentiveTasksResponse(BaseModel):
|
|
"""Response containing all available incentive tasks with completion status."""
|
|
|
|
tasks: list[IncentiveTaskInfo]
|
|
total_credit_micros_earned: int
|
|
|
|
|
|
class CompleteTaskRequest(BaseModel):
|
|
"""Request to mark a task as completed."""
|
|
|
|
task_type: IncentiveTaskType
|
|
|
|
|
|
class CompleteTaskResponse(BaseModel):
|
|
"""Response after completing a task."""
|
|
|
|
success: bool
|
|
message: str
|
|
credit_micros_awarded: int
|
|
new_balance_micros: int
|
|
|
|
|
|
class TaskAlreadyCompletedResponse(BaseModel):
|
|
"""Response when task was already completed."""
|
|
|
|
success: bool
|
|
message: str
|
|
completed_at: datetime
|
|
|
|
|
|
def get_task_info(task_type: IncentiveTaskType) -> dict | None:
|
|
"""Get task configuration by type."""
|
|
return INCENTIVE_TASKS_CONFIG.get(task_type)
|
|
|
|
|
|
def get_all_task_types() -> list[IncentiveTaskType]:
|
|
"""Get all configured task types."""
|
|
return list(INCENTIVE_TASKS_CONFIG.keys())
|