Dashboard (content library, publishing queue with approvals, inbox, team management, AI runs), Meta connector, branded PDF reports, agent skills, and Docker packaging (Dockerfile, docker-compose with Caddy HTTPS, backup and path-relocation scripts). Client data, live data and secrets are excluded via .gitignore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
// Link existing client folders to their Facebook Page / Instagram account (client.json),
|
|
// and to their Odoo "<Client> - Social Media Handling" project when one exists.
|
|
import { autoLink, listClients, saveLink } from "../clients.js";
|
|
import * as odoo from "../odoo.js";
|
|
|
|
const results = await autoLink();
|
|
for (const r of results) console.log(r.page ? `linked ${r.slug} → ${r.page}${r.ig ? ` (@${r.ig})` : ""}` : `no match ${r.slug} (link it from the dashboard)`);
|
|
|
|
if (odoo.configured()) {
|
|
const projects = await odoo.projects();
|
|
const norm = (s) => s.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
for (const c of listClients()) {
|
|
if (c.odooProject) continue;
|
|
const key = norm(c.name);
|
|
const match =
|
|
projects.find((p) => norm(p.name).startsWith(key) && /social media/i.test(p.name)) ||
|
|
projects.find((p) => norm(p.name) === key) ||
|
|
projects.find((p) => norm(p.name).startsWith(key));
|
|
if (match) {
|
|
saveLink(c.slug, { odooProject: { id: match.id, name: match.name } });
|
|
console.log(`odoo ${c.slug} → ${match.name}`);
|
|
}
|
|
}
|
|
}
|