[Server] Serve deck storage listings through the database interface (#7851)

deckListHelper still prepared the folder and deck-file statements inline through
Servatrice_DatabaseInterface, and the four deck commands reached checkSql,
getUserIdInDB and getDeckFromDatabase through a concrete pointer. Add
DeckListFolderRecord, DeckListFileRecord, getDeckListFolders and
getDeckListFiles to Server_DatabaseInterface with fail-closed defaults, serve
all four commands from the injected interface, and drop the sqlInterface member
so the handler no longer holds a database implementation at all. Folder
ordering, recursion order, public-only pruning and every response code are
unchanged.
This commit is contained in:
BruebachL 2026-11-10 12:16:30 +01:00 • committed by GitHub
parent 1822d16a72
commit 99bdcebf2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 106 additions and 40 deletions

View file

@ -182,6 +182,33 @@ public:
{
return 0;
}
/** @brief One folder row of a user's deck storage tree. */
struct DeckListFolderRecord
{
int id = 0;
QString name;
bool isPublic = false;
};
/** @brief One deck file row of a user's deck storage tree. */
struct DeckListFileRecord
{
int id = 0;
QString name;
qint64 uploadTime = 0;
bool isPublic = false;
QString bannerCardName;
QString bannerCardProvider;
QString colorIdentity;
QStringList tags;
};
virtual bool getDeckListFolders(int /* folderId */, int /* userId */, QList<DeckListFolderRecord> & /* folders */)
{
return false;
}
virtual bool getDeckListFiles(int /* folderId */, int /* userId */, QList<DeckListFileRecord> & /* files */)
{
return false;
}
/** @brief Id of the folder at a "/"-separated path for one user, 0 for the root, -1 when absent. */
virtual int getDeckPathId(const QString & /* path */, int /* userId */)
{