fix: add missing readBooks translations
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
This commit is contained in:
27
scripts/emergency-directus-fix.js
Normal file
27
scripts/emergency-directus-fix.js
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
require('dotenv').config();
|
||||
const DIRECTUS_URL = process.env.DIRECTUS_URL || 'https://cms.dk0.dev';
|
||||
const DIRECTUS_TOKEN = process.env.DIRECTUS_STATIC_TOKEN;
|
||||
|
||||
async function api(endpoint, method = 'GET', body = null) {
|
||||
const url = `${DIRECTUS_URL}/${endpoint}`;
|
||||
const options = {
|
||||
method,
|
||||
headers: { 'Authorization': `Bearer ${DIRECTUS_TOKEN}`, 'Content-Type': 'application/json' }
|
||||
};
|
||||
if (body) options.body = JSON.stringify(body);
|
||||
const response = await fetch(url, options);
|
||||
const data = await response.json().catch(() => ({}));
|
||||
return { ok: response.ok, data };
|
||||
}
|
||||
|
||||
async function emergencyFix() {
|
||||
console.log('Fixing...');
|
||||
await api('collections/book_reviews', 'PATCH', { meta: { hidden: true } });
|
||||
await api('collections/book_reviews', 'PATCH', { meta: { hidden: false, icon: 'book' } });
|
||||
await api('fields/book_reviews/translations', 'PATCH', {
|
||||
meta: { interface: 'translations', options: { languageField: 'languages_code' } }
|
||||
});
|
||||
console.log('Done. Please reload in Incognito.');
|
||||
}
|
||||
emergencyFix().catch(console.error);
|
||||
Reference in New Issue
Block a user