miner
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user