deactivate bookcases

This commit is contained in:
HolgerHatGarKeineNode
2023-02-16 21:01:53 +01:00
parent e5ef6a2b91
commit 8625bfc5fd
12 changed files with 57 additions and 35 deletions

View File

@@ -28,12 +28,16 @@ class SyncOpenBooks extends Command
{ {
$response = Http::post('https://openbookcase.de/api/listarea/83.08995477111446/-200.56640625000003/-38.13455657705413/221.30859375000003'); $response = Http::post('https://openbookcase.de/api/listarea/83.08995477111446/-200.56640625000003/-38.13455657705413/221.30859375000003');
$ids = collect($response->json()['cases'])->pluck('id');
foreach ($response->json()['cases'] as $case) { foreach ($response->json()['cases'] as $case) {
try {
BookCase::updateOrCreate( BookCase::updateOrCreate(
[ [
'id' => $case['id'], 'id' => $case['id'],
], ],
[ [
'id' => $case['id'],
'title' => $case['title'], 'title' => $case['title'],
'latitude' => (float) $case['lat'], 'latitude' => (float) $case['lat'],
'longitude' => (float) $case['lon'], 'longitude' => (float) $case['lon'],
@@ -52,8 +56,15 @@ class SyncOpenBooks extends Command
'created_by' => 1, 'created_by' => 1,
] ]
); );
} catch (\Exception $e) {
$this->error($e->getMessage());
} }
return Command::SUCCESS; return Command::SUCCESS;
} }
BookCase::query()
->whereNotIn('id', $ids)
->update(['deactivated' => true]);
}
} }

View File

@@ -766,5 +766,6 @@
"Article already tweeted": "Artikel bereits getwittert", "Article already tweeted": "Artikel bereits getwittert",
"Is this a news article?": "Dieser Artikel ist ein News-Artikel", "Is this a news article?": "Dieser Artikel ist ein News-Artikel",
"Are your sure?": "Bist du dir sicher?", "Are your sure?": "Bist du dir sicher?",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -763,5 +763,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -763,5 +763,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -764,5 +764,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -764,5 +764,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -764,5 +764,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -764,5 +764,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -764,5 +764,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -764,5 +764,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -726,5 +726,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }

View File

@@ -738,5 +738,6 @@
"Article already tweeted": "", "Article already tweeted": "",
"Is this a news article?": "", "Is this a news article?": "",
"Are your sure?": "", "Are your sure?": "",
"Nostr public key": "" "Nostr public key": "",
"Amount": ""
} }