Реализован интерфейс согласий
This commit is contained in:
@@ -30,6 +30,11 @@ SEED = {
|
||||
True,
|
||||
),
|
||||
"consent.personal_data.version": ("2026-06-10", "string", True),
|
||||
"consent.privacy_policy.document_url": (
|
||||
"https://www.han0107.ru/privacy",
|
||||
"string",
|
||||
True,
|
||||
),
|
||||
"consent.user_agreement.required": ("true", "boolean", True),
|
||||
"consent.user_agreement.document_url": (
|
||||
"https://www.han0107.ru/user-agreement",
|
||||
@@ -38,6 +43,11 @@ SEED = {
|
||||
),
|
||||
"consent.user_agreement.version": ("2026-06-10", "string", True),
|
||||
"consent.marketing.required": ("false", "boolean", True),
|
||||
"consent.marketing.document_url": (
|
||||
"https://www.han0107.ru/privacy/ads-agree",
|
||||
"string",
|
||||
True,
|
||||
),
|
||||
"consent.marketing.version": ("2026-06-10", "string", True),
|
||||
"chat.attachments.allowed_extensions": (
|
||||
"jpg,jpeg,png,webp,heic,heif,pdf",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Seed consent.privacy_policy.document_url for personal_data consent UI.
|
||||
|
||||
Revision ID: 0006_privacy_policy
|
||||
Revises: 0005_otp_settings
|
||||
Create Date: 2026-07-23
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0006_privacy_policy"
|
||||
down_revision: str | None = "0005_otp_settings"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"""
|
||||
INSERT INTO han_app.app_settings
|
||||
(setting_key, setting_value, value_type, is_public, description,
|
||||
record_status, updated_at)
|
||||
VALUES
|
||||
('consent.privacy_policy.document_url',
|
||||
'https://www.han0107.ru/privacy', 'string', true,
|
||||
'Privacy policy URL shown next to personal_data consent', 'A', now())
|
||||
ON CONFLICT (setting_key) DO NOTHING
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Privacy policy consent URL migration is forward-only")
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Seed consent.marketing.document_url for marketing consent UI link.
|
||||
|
||||
Revision ID: 0007_marketing_doc
|
||||
Revises: 0006_privacy_policy
|
||||
Create Date: 2026-07-23
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0007_marketing_doc"
|
||||
down_revision: str | None = "0006_privacy_policy"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"""
|
||||
INSERT INTO han_app.app_settings
|
||||
(setting_key, setting_value, value_type, is_public, description,
|
||||
record_status, updated_at)
|
||||
VALUES
|
||||
('consent.marketing.document_url',
|
||||
'https://www.han0107.ru/privacy/ads-agree', 'string', true,
|
||||
'Marketing communications consent document URL', 'A', now())
|
||||
ON CONFLICT (setting_key) DO NOTHING
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
raise RuntimeError("Marketing consent document URL migration is forward-only")
|
||||
@@ -476,12 +476,22 @@ async def app_config(request: Request, response: Response, settings: SnapshotDep
|
||||
},
|
||||
"operator": {"call_phone": values["operator.call.phone"]},
|
||||
"consents": {
|
||||
name: {
|
||||
"required": settings.boolean(f"consent.{name}.required"),
|
||||
"document_url": values.get(f"consent.{name}.document_url"),
|
||||
"version": values[f"consent.{name}.version"],
|
||||
}
|
||||
for name in ("personal_data", "user_agreement", "marketing")
|
||||
"personal_data": {
|
||||
"required": settings.boolean("consent.personal_data.required"),
|
||||
"document_url": values.get("consent.personal_data.document_url"),
|
||||
"privacy_policy_document_url": values.get(
|
||||
"consent.privacy_policy.document_url"
|
||||
),
|
||||
"version": values["consent.personal_data.version"],
|
||||
},
|
||||
**{
|
||||
name: {
|
||||
"required": settings.boolean(f"consent.{name}.required"),
|
||||
"document_url": values.get(f"consent.{name}.document_url"),
|
||||
"version": values[f"consent.{name}.version"],
|
||||
}
|
||||
for name in ("user_agreement", "marketing")
|
||||
},
|
||||
},
|
||||
"attachments": {
|
||||
"allowed_extensions": settings.strings("chat.attachments.allowed_extensions"),
|
||||
|
||||
@@ -69,10 +69,12 @@ REQUIRED_SETTINGS = {
|
||||
"consent.personal_data.required",
|
||||
"consent.personal_data.document_url",
|
||||
"consent.personal_data.version",
|
||||
"consent.privacy_policy.document_url",
|
||||
"consent.user_agreement.required",
|
||||
"consent.user_agreement.document_url",
|
||||
"consent.user_agreement.version",
|
||||
"consent.marketing.required",
|
||||
"consent.marketing.document_url",
|
||||
"consent.marketing.version",
|
||||
"chat.attachments.allowed_extensions",
|
||||
"chat.attachments.allowed_mime_types",
|
||||
|
||||
Reference in New Issue
Block a user