mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[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:
parent
23781af1f0
commit
7734a94f83
4 changed files with 157 additions and 79 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue