frontend admin refakctorálás

This commit is contained in:
Roo
2026-07-08 08:03:57 +00:00
parent 07b59032ce
commit 2e0abc62a7
455 changed files with 14428 additions and 21651 deletions

View File

@@ -9,6 +9,7 @@ from .gamification import (
UserContribution,
Season,
)
from .validation_rule import ValidationRule
__all__ = [
"PointRule",
@@ -19,4 +20,5 @@ __all__ = [
"UserBadge",
"UserContribution",
"Season",
"ValidationRule",
]

View File

@@ -0,0 +1,53 @@
# /opt/docker/dev/service_finder/backend/app/models/gamification/validation_rule.py
"""
ValidationRule model — Gamification schema.
Stores dynamic global provider validation rules (thresholds) that drive
the ValidationEngine. Rules are key-value pairs with integer values,
seeded at initialization and editable via the admin panel.
Schema: gamification.validation_rules
"""
from typing import Optional
from datetime import datetime
from sqlalchemy import String, Integer, DateTime, func
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class ValidationRule(Base):
"""
Global provider validation rules / thresholds.
Each row defines a single rule_key → rule_value mapping used by
the ValidationEngine to compute trust scores and auto-approval
thresholds for service providers.
Seed data (base rules):
BOT_BASE_SCORE = 20 # Default trust score for robot-discovered entries
FIRST_ENTRY_SCORE = 40 # Score awarded for the first user entry
USER_CONFIRM_BASE = 20 # Base score per user confirmation vote
AUTO_APPROVE_THRESHOLD = 80 # Minimum validation_level to auto-promote
"""
__tablename__ = "validation_rules"
__table_args__ = {"schema": "gamification", "extend_existing": True}
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
rule_key: Mapped[str] = mapped_column(
String(100), unique=True, nullable=False, index=True,
comment="Unique rule identifier, e.g. 'BOT_BASE_SCORE'"
)
rule_value: Mapped[int] = mapped_column(
Integer, nullable=False, default=0,
comment="Integer value for this rule (score, threshold, etc.)"
)
description: Mapped[Optional[str]] = mapped_column(
String(500), nullable=True,
comment="Human-readable description of what this rule controls"
)
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), server_default=func.now()
)
updated_at: Mapped[Optional[datetime]] = mapped_column(
DateTime(timezone=True), onupdate=func.now()
)