[Server] Move deck file writes into the database interface (#7834)

Deleting a deck, inserting an uploaded deck, and updating one in place were SQL statements in the socket handler, including the dynamic is_public clause and the follow-up visibility read. Add DeckFileData and DeckFileWriteResult to Server_DatabaseInterface with create/update/delete operations, implement them in Servatrice_DatabaseInterface with the same statements and bind order, and let cmdDeckUpload and cmdDeckDel ask the injected interface.
This commit is contained in:
BruebachL 2026-11-10 12:16:23 +01:00 • committed by GitHub
parent 23781af1f0
commit 7734a94f83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 157 additions and 79 deletions

View file

@ -218,6 +218,36 @@ public:
virtual void deleteDeckFolder(int /* folderId */)
{
}
/** @brief The mutable deck-file columns, as the upload command supplies them. */
struct DeckFileData
{
QString name;
QString content;
bool isPublic = false;
QString bannerCardName;
QString bannerCardProvider;
QString colorIdentity;
QString tagsJson;
};
struct DeckFileWriteResult
{
DeckStorageResult result = DeckStorageResult::Failed;
int deckId = 0;
bool isPublic = false;
};
virtual DeckFileWriteResult createDeckFile(int /* folderId */, int /* userId */, const DeckFileData & /* data */)
{
return DeckFileWriteResult{};
}
virtual DeckFileWriteResult
updateDeckFile(int /* deckId */, int /* userId */, const DeckFileData & /* data */, bool /* updateVisibility */)
{
return DeckFileWriteResult{};
}
virtual DeckStorageResult deleteDeckFile(int /* deckId */, int /* userId */)
{
return DeckStorageResult::Failed;
}
virtual bool removeForgotPassword(const QString & /* user */)
{
return false;