All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 6s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 6s
This commit implements the addition of `target_owners` and `alert_notification_events` tables, enabling management of responsible users for targets. Backend and frontend components are updated to allow viewing, assigning, and notifying target owners about critical alerts via email.
58 lines
1.2 KiB
Python
58 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
|
|
|
|
|
|
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)
|