Compare commits
No commits in common. "6b8fb3b47062685aa51b6586d09d7ecda0152d55" and "76b60e5556fcf4b6826e71bd06e0346a2a767386" have entirely different histories.
6b8fb3b470
...
76b60e5556
12 changed files with 6 additions and 445 deletions
|
|
@ -1,49 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: be\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
|
||||||
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr ""
|
|
||||||
|
|
@ -24,12 +24,12 @@ msgstr "How do I know that I can trust this page?"
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
#: src/snapshots/templates/article-template.html.j2:73
|
||||||
msgid ""
|
msgid ""
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
"This story is a copy of an article from <a href=\"%(site_url)\" class"
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
"=\"snap-trust-header__sitelink\">%(site_title)</a>. It is delivered to "
|
||||||
"you from a trusted archive to assure its availability over time."
|
"you from a trusted archive to assure its availability over time."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
"This story is a copy of an article from <a href=\"%(site_url)\" class"
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
"=\"snap-trust-header__sitelink\">%(site_title)</a>. It is delivered to "
|
||||||
"you from a trusted archive to assure its availability over time."
|
"you from a trusted archive to assure its availability over time."
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
#: src/snapshots/templates/article-template.html.j2:76
|
||||||
|
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: 2026-03-08 15:54+0000\n"
|
|
||||||
"Last-Translator: irl <irl@sr2.uk>\n"
|
|
||||||
"Language-Team: Spanish <https://hosted.weblate.org/projects/sr2/snapdirect/"
|
|
||||||
"es/>\n"
|
|
||||||
"Language: es\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
||||||
"X-Generator: Weblate 5.17-dev\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr "¿Cómo sé que puedo confiar en esta página?"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
"Esta historia es una copia de un artículo de <a href=\"{site_url}\" "
|
|
||||||
"class=\"snap-trust-header__sitelink\">{site_title}</a>. Se la entregamos "
|
|
||||||
"desde un archivo confiable para garantizar su disponibilidad a lo largo del "
|
|
||||||
"tiempo."
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr "Ver el código fuente del artículo"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr "Estas abandonando esta pagina"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
"Este enlace te redirigirá a un sitio web externo. Si no está disponible en "
|
|
||||||
"tu región, es posible que no lo puedas acceder."
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr "Continuar"
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: fa\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr ""
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: ka\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr ""
|
|
||||||
|
|
@ -23,8 +23,8 @@ msgstr ""
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
#: src/snapshots/templates/article-template.html.j2:73
|
||||||
msgid ""
|
msgid ""
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
"This story is a copy of an article from <a href=\"%(site_url)\" class"
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
"=\"snap-trust-header__sitelink\">%(site_title)</a>. It is delivered to "
|
||||||
"you from a trusted archive to assure its availability over time."
|
"you from a trusted archive to assure its availability over time."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: prs\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr ""
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: ps\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr ""
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
# Translations template for PROJECT.
|
|
||||||
# Copyright (C) 2026 ORGANIZATION
|
|
||||||
# This file is distributed under the same license as the PROJECT project.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
||||||
"POT-Creation-Date: 2026-03-07 17:05+0000\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: ru\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
|
||||||
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
||||||
"Generated-By: Babel 2.17.0\n"
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:66
|
|
||||||
msgid "How do I know that I can trust this page?"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:73
|
|
||||||
msgid ""
|
|
||||||
"This story is a copy of an article from <a href=\"{site_url}\" class"
|
|
||||||
"=\"snap-trust-header__sitelink\">{site_title}</a>. It is delivered to "
|
|
||||||
"you from a trusted archive to assure its availability over time."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:76
|
|
||||||
msgid "View the article source"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:143
|
|
||||||
msgid "You are leaving this page"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:163
|
|
||||||
msgid ""
|
|
||||||
"This link will redirect you to an external website. If it’s not available"
|
|
||||||
" in your region, you may not be able to access it."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: src/snapshots/templates/article-template.html.j2:165
|
|
||||||
msgid "Continue"
|
|
||||||
msgstr ""
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
import contextlib
|
|
||||||
from typing import Annotated, Iterator, Generator
|
|
||||||
|
|
||||||
from fastapi import Depends
|
|
||||||
from sqlalchemy import (
|
|
||||||
MetaData, create_engine, Connection,
|
|
||||||
)
|
|
||||||
from sqlalchemy.orm import sessionmaker, Session
|
|
||||||
|
|
||||||
from src.config import settings
|
|
||||||
from src.constants import DB_NAMING_CONVENTION
|
|
||||||
|
|
||||||
engine = create_engine(
|
|
||||||
str(settings.DATABASE_URL),
|
|
||||||
pool_size=settings.DATABASE_POOL_SIZE,
|
|
||||||
pool_recycle=settings.DATABASE_POOL_TTL,
|
|
||||||
pool_pre_ping=settings.DATABASE_POOL_PRE_PING,
|
|
||||||
)
|
|
||||||
metadata = MetaData(naming_convention=DB_NAMING_CONVENTION)
|
|
||||||
sm = sessionmaker(autocommit=False, expire_on_commit=False, bind=engine)
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
|
||||||
def get_db_connection() -> Iterator[Connection]:
|
|
||||||
with engine.connect() as connection:
|
|
||||||
try:
|
|
||||||
yield connection
|
|
||||||
except Exception:
|
|
||||||
connection.rollback()
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
|
||||||
def get_db_session() -> Iterator[Session]:
|
|
||||||
session = sm()
|
|
||||||
try:
|
|
||||||
yield session
|
|
||||||
except Exception:
|
|
||||||
session.rollback()
|
|
||||||
raise
|
|
||||||
finally:
|
|
||||||
session.close()
|
|
||||||
|
|
||||||
|
|
||||||
def get_db() -> Generator[Session, None]:
|
|
||||||
with get_db_session() as session:
|
|
||||||
yield session
|
|
||||||
|
|
||||||
|
|
||||||
DbSession = Annotated[Session, Depends(get_db)]
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
from datetime import datetime
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from sqlalchemy import DateTime, JSON, func
|
|
||||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
||||||
from src.database import metadata
|
|
||||||
|
|
||||||
|
|
||||||
class CustomBase(DeclarativeBase):
|
|
||||||
type_annotation_map = {
|
|
||||||
datetime: DateTime(timezone=True),
|
|
||||||
dict[str, Any]: JSON,
|
|
||||||
}
|
|
||||||
metadata = metadata
|
|
||||||
|
|
||||||
class ActivatedMixin:
|
|
||||||
active: Mapped[bool] = mapped_column(default=True)
|
|
||||||
|
|
||||||
|
|
||||||
class DeletedTimestampMixin:
|
|
||||||
deleted_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
|
||||||
|
|
||||||
|
|
||||||
class DescriptionMixin:
|
|
||||||
description: Mapped[str]
|
|
||||||
|
|
||||||
|
|
||||||
class IdMixin:
|
|
||||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
||||||
|
|
||||||
|
|
||||||
class TimestampMixin:
|
|
||||||
created_at: Mapped[datetime] = mapped_column(default=func.now())
|
|
||||||
updated_at: Mapped[datetime] = mapped_column(default=func.now(), onupdate=func.now())
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
from sqlalchemy.orm import Mapped
|
|
||||||
|
|
||||||
from src.models import CustomBase, IdMixin
|
|
||||||
|
|
||||||
|
|
||||||
class Snapshot(CustomBase, IdMixin):
|
|
||||||
__tablename__ = "snapshot"
|
|
||||||
|
|
||||||
url: Mapped[str]
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue