utxo-prague/utils/team.js

26 řádky
669 B
JavaScript
Surový Normální zobrazení Historie

2022-02-08 09:25:11 +01:00
import { UTXOEngine } from "./engine.js";
const utxo = new UTXOEngine({ silent: true });
await utxo.init();
const entryId = "22";
const entry = utxo.entries[entryId];
const pt = entry.specs.team.teams;
const teams = Object.keys(pt).map((id) => Object.assign({ id }, pt[id]));
console.log("----");
function members(t) {
return t.members.map((m) => m === t.lead ? "@" + m : m).sort((m) =>
m.substring(0, 1) === "@" ? -1 : 1
).join(", ");
}
for (const t of teams.filter((t) => !t.parent)) {
console.log(`[${t.id}] +${members(t)}`);
for (const st of teams.filter((tx) => tx.parent === t.id)) {
console.log(` \\\__ [${st.id}] +${members(st)}`);
}
}