miner
All checks were successful
Deploy / deploy-staging (push) Successful in 1m10s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-08-21 23:37:27 +02:00
parent b3b3a27257
commit d8d1ad96ee
4 changed files with 99 additions and 8 deletions

View File

@@ -1144,6 +1144,37 @@ final class MiningRepository
return $this->normalizeRow($fetch->fetch() ?: []);
}
public function deletePurchasedMiner(string $projectKey, int $minerId): void
{
if ($minerId <= 0) {
return;
}
$delete = $this->pdo->prepare(
'DELETE FROM ' . $this->table('purchased_miners') . '
WHERE id = :id AND project_key = :project_key AND owner_sub = :owner_sub'
);
$delete->execute([
'id' => $minerId,
'project_key' => $projectKey,
'owner_sub' => $this->ownerSub,
]);
if ($delete->rowCount() > 0) {
return;
}
// Older rows without an owner assignment remain deletable like the existing read/update fallback.
$legacyDelete = $this->pdo->prepare(
'DELETE FROM ' . $this->table('purchased_miners') . '
WHERE id = :id AND project_key = :project_key AND owner_sub IS NULL'
);
$legacyDelete->execute([
'id' => $minerId,
'project_key' => $projectKey,
]);
}
public function getMinerOffer(string $projectKey, int $offerId): ?array
{
$stmt = $this->pdo->prepare('SELECT * FROM ' . $this->table('miner_offers') . ' WHERE project_key = :project_key AND id = :id LIMIT 1');