Files
finance/backend/app/audit/models.py
T
k1nq d582f15681 feat: add tests for import polling, login page, money utilities, and query keys
- Implemented tests for import polling functionality, ensuring correct behavior for active and terminal import statuses.
- Created tests for the login page, validating user interactions and error handling.
- Added unit tests for money utility functions, covering parsing, formatting, and summation of monetary values.
- Developed tests for query keys, ensuring proper scoping and invalidation roots.

chore: setup testing environment and configuration

- Added setup file for testing with Vitest and Testing Library.
- Configured TypeScript and Vite for the frontend project.
- Created Docker and Nginx configurations for local development and production environments.
- Established a PostgreSQL initialization script for setting up application roles.

docs: add README and environment configuration for infra

- Included README for the infra directory, detailing local development setup and service descriptions.
- Created an example environment configuration file for local development with placeholders for sensitive information.
2026-09-14 09:26:33 +05:00

26 lines
947 B
Python

import uuid
from typing import Any
from sqlalchemy import JSON, ForeignKey, String, Uuid
from sqlalchemy.orm import Mapped, mapped_column
from app.db.base import Base, PkMixin, TimestampMixin
class AuditEvent(Base, PkMixin, TimestampMixin):
"""Append-only domain/security event. Never stores raw financial payloads."""
__tablename__ = "audit_events"
__table_args__ = (
{"comment": "Append-only audit trail; updates and deletes are blocked by trigger in PG."},
)
space_id: Mapped[uuid.UUID | None] = mapped_column(
Uuid, ForeignKey("financial_spaces.id", ondelete="SET NULL"), nullable=True, index=True
)
user_id: Mapped[uuid.UUID | None] = mapped_column(
Uuid, ForeignKey("users.id", ondelete="SET NULL"), nullable=True, index=True
)
event_type: Mapped[str] = mapped_column(String(64), nullable=False)
detail: Mapped[dict[str, Any] | None] = mapped_column(JSON, nullable=True)