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,32 +28,43 @@ 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) {
BookCase::updateOrCreate( try {
[ BookCase::updateOrCreate(
'id' => $case['id'], [
], 'id' => $case['id'],
[ ],
'title' => $case['title'], [
'latitude' => (float)$case['lat'], 'id' => $case['id'],
'longitude' => (float)$case['lon'], 'title' => $case['title'],
'address' => $case['address'], 'latitude' => (float) $case['lat'],
'type' => $case['type'], 'longitude' => (float) $case['lon'],
'open' => $case['open'], 'address' => $case['address'],
'comment' => $case['comment'], 'type' => $case['type'],
'contact' => $case['contact'], 'open' => $case['open'],
'bcz' => $case['bcz'], 'comment' => $case['comment'],
'digital' => $case['digital'] ?? false, 'contact' => $case['contact'],
'icontype' => $case['icontype'], 'bcz' => $case['bcz'],
'deactivated' => $case['deactivated'], 'digital' => $case['digital'] ?? false,
'deactreason' => $case['deactreason'], 'icontype' => $case['icontype'],
'entrytype' => $case['entrytype'], 'deactivated' => $case['deactivated'],
'homepage' => $case['homepage'], 'deactreason' => $case['deactreason'],
'created_by' => 1, 'entrytype' => $case['entrytype'],
] 'homepage' => $case['homepage'],
); '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": ""
} }