more name checks and add proper soft deletes to bots

This commit is contained in:
nytmyr
2024-12-22 00:05:45 -06:00
parent 600376274f
commit 2460f78015
3 changed files with 37 additions and 21 deletions
+5 -2
View File
@@ -186,6 +186,7 @@ bool BotDatabase::QueryNameAvailablity(const std::string& bot_name, bool& availa
if (
bot_name.empty() ||
bot_name.size() > 60 ||
!database.CheckNameFilter(bot_name) ||
database.IsNameUsed(bot_name)
) {
return false;
@@ -246,6 +247,8 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
SELECT `account_id` FROM `character_data` WHERE `id` = {}
)
)
AND
`name` NOT LIKE '%-deleted-%'
),
owner_id
)
@@ -272,7 +275,7 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
const auto& l = BotDataRepository::GetWhere(
database,
fmt::format(
"`owner_id` = {}",
"`owner_id` = {} AND `name` NOT LIKE '%-deleted-%'",
owner_id
)
);
@@ -319,7 +322,7 @@ bool BotDatabase::LoadBotID(const std::string& bot_name, uint32& bot_id, uint8&
const auto& l = BotDataRepository::GetWhere(
database,
fmt::format(
"`name` = '{}' LIMIT 1",
"`name` = '{}' AND `name` NOT LIKE '%-deleted-%' LIMIT 1",
Strings::Escape(bot_name)
)
);