Files
NexaPG/backend/app/schemas/target.py
nessi fa8958934f
Some checks are pending
PostgreSQL Compatibility Matrix / PG14 smoke (push) Waiting to run
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 28s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 6s
Add multi-database discovery and grouping features
This update introduces optional automatic discovery and onboarding of all databases on a PostgreSQL instance. It also enhances the frontend UI with grouped target display and navigation, making it easier to view and manage related databases. Additionally, new backend endpoints and logic ensure seamless integration of these features.
2026-02-12 16:54:22 +01:00

59 lines
1.2 KiB
Python

from datetime import datetime
from pydantic import BaseModel, Field
class TargetBase(BaseModel):
name: str
host: str
port: int = 5432
dbname: str
username: str
sslmode: str = "prefer"
use_pg_stat_statements: bool = True
owner_user_ids: list[int] = Field(default_factory=list)
tags: dict = Field(default_factory=dict)
class TargetCreate(TargetBase):
password: str
discover_all_databases: bool = False
class TargetConnectionTestRequest(BaseModel):
host: str
port: int = 5432
dbname: str
username: str
password: str
sslmode: str = "prefer"
class TargetUpdate(BaseModel):
name: str | None = None
host: str | None = None
port: int | None = None
dbname: str | None = None
username: str | None = None
password: str | None = None
sslmode: str | None = None
use_pg_stat_statements: bool | None = None
owner_user_ids: list[int] | None = None
tags: dict | None = None
class TargetOut(TargetBase):
id: int
created_at: datetime
model_config = {"from_attributes": True}
class TargetOwnerOut(BaseModel):
user_id: int
email: str
role: str
class TargetOwnersUpdate(BaseModel):
user_ids: list[int] = Field(default_factory=list)