Move DB queries related to 'annotations' in a separate module

This commit is contained in:
Samantaz Fox
2021-12-06 17:24:49 +01:00
parent 85cf27119c
commit 914cfbd953
3 changed files with 26 additions and 2 deletions

View File

@@ -239,7 +239,7 @@ module Invidious::Routes::API::V1::Videos
case source
when "archive"
if CONFIG.cache_annotations && (cached_annotation = PG_DB.query_one?("SELECT * FROM annotations WHERE id = $1", id, as: Annotation))
if CONFIG.cache_annotations && (cached_annotation = Invidious::Database::Annotations.select(id))
annotations = cached_annotation.annotations
else
index = CHARS_SAFE.index(id[0]).not_nil!.to_s.rjust(2, '0')