feat: add SQL/SQLite, AppSec, Capstone incident-tracker, Gitea Actions CI and spaced repetition
Test and Lint / quality (push) Successful in 34s
Test and Lint / quality (push) Successful in 34s
This commit is contained in:
1 parent
0ac80d60d4
commit
9430a194c3
18 files changed
+422
-7
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import json
|
||||
import sqlite3
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import typer
|
||||
|
||||
VALID_SEVERITIES = frozenset({"low", "medium", "high", "critical"})
|
||||
|
||||
|
||||
class InvalidIncidentError(ValueError):
|
||||
"""Niepoprawne dane wejściowe incydentu."""
|
||||
|
||||
|
||||
class IncidentNotFoundError(KeyError):
|
||||
"""Nie znaleziono incydentu o podanym ID."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Incident:
|
||||
id: int
|
||||
title: str
|
||||
severity: str
|
||||
status: str
|
||||
|
||||
|
||||
class IncidentStore:
|
||||
def __init__(self, db_path: Path) -> None:
|
||||
self._db_path = db_path
|
||||
|
||||
def init_schema(self) -> None:
|
||||
_ = sqlite3
|
||||
raise NotImplementedError("Utwórz tabelę incidents (id, title, severity, status)")
|
||||
|
||||
def add(self, title: str, severity: str) -> Incident:
|
||||
raise NotImplementedError("Zwaliduj title i severity, zapisz w SQLite i zwróć Incident")
|
||||
|
||||
def list_incidents(self, severity: str | None = None) -> list[Incident]:
|
||||
raise NotImplementedError("Zwróć incydenty (opcjonalnie przefiltrowane po severity)")
|
||||
|
||||
def resolve(self, incident_id: int) -> Incident:
|
||||
raise NotImplementedError("Zmień status na 'resolved' lub rzuć IncidentNotFoundError")
|
||||
|
||||
def stats(self) -> dict[str, int]:
|
||||
raise NotImplementedError("Zwróć {'open': X, 'resolved': Y}")
|
||||
|
||||
|
||||
def build_cli(db_path: Path) -> typer.Typer:
|
||||
_ = (json, db_path, typer.Typer)
|
||||
raise NotImplementedError("Zarejestruj podkomendy add, list, resolve, stats wypisujące JSON")
|
||||
Reference in new issue
Block a user