tools: private tools tracker (/trackers/tools): inventory of tools, batteries and consumables by category, +/- quantities, add/edit dialog, scripts/tools-run.sh for bots
Deploy production / deploy (push) Successful in 1m39s
Deploy production / deploy (push) Successful in 1m39s
This commit is contained in:
1 parent
42711253b7
commit
7f71e88953
18 files changed
+47392
-3
No files matched your search
@@ -368,6 +368,28 @@ try {
|
||||
throw new Error(`radio schema tables/grants are wrong: ${JSON.stringify(radio)}`);
|
||||
const [{ n: radioFreqs }] = await client`select count(*)::int as n from radio.frequencies`;
|
||||
if (!radioFreqs) throw new Error('radio.frequencies is empty, expected the seeded frequencies');
|
||||
// Tools tracker (owner-only): 1 = items; the migration seeds Stan's first 5 items.
|
||||
const [tools] = await client`
|
||||
select
|
||||
count(*) filter (where has_table_privilege(c.oid, 'select, insert, update, delete')) as app_rw,
|
||||
count(*) filter (
|
||||
where exists (
|
||||
select 1 from aclexplode(c.relacl) a join pg_roles r on r.oid = a.grantee
|
||||
where r.rolname = 'personal_ro'
|
||||
)
|
||||
) as ro_read,
|
||||
count(*) as tables,
|
||||
has_schema_privilege('public', 'tools', 'usage') as public_usage
|
||||
from pg_class c join pg_namespace n on n.oid = c.relnamespace
|
||||
where n.nspname = 'tools' and c.relkind = 'r'
|
||||
`;
|
||||
if (
|
||||
Number(tools.tables) !== 1 ||
|
||||
Number(tools.app_rw) !== 1 ||
|
||||
Number(tools.ro_read) !== 0 ||
|
||||
tools.public_usage
|
||||
)
|
||||
throw new Error(`tools schema tables/grants are wrong: ${JSON.stringify(tools)}`);
|
||||
// Energy tracker reads the ned-collector tables (SELECT only).
|
||||
const [energy] = await client`
|
||||
select count(*) as hours, max(valid_from) as latest from energy.ned_utilization
|
||||
@@ -377,7 +399,7 @@ try {
|
||||
if (!Number(energy.hours))
|
||||
console.warn('Warning: energy.ned_utilization has no hourly data from the last 7 days');
|
||||
console.log(
|
||||
`health: ${health.tables} tables, tasks: ${tasks.tables} tables, groceries: ${groceries.tables} tables, stats: ${stats.tables} tables, ai: ${ai.tables} tables, movies: ${movies.tables} tables, worldtodo: ${worldtodo.tables} tables (${worldtodoTasks} tasks), notes: ${notes.tables} tables, math: ${math.tables} tables (${mathChapters} chapters), plant: ${plant.tables} tables (${plantEntries} entries), radio: ${radio.tables} tables (${radioFreqs} frequencies), app read/write, personal_ro none; energy: ${energy.hours} hourly rows, latest ${energy.latest ? new Date(energy.latest).toISOString() : 'none'}`
|
||||
`health: ${health.tables} tables, tasks: ${tasks.tables} tables, groceries: ${groceries.tables} tables, stats: ${stats.tables} tables, ai: ${ai.tables} tables, movies: ${movies.tables} tables, worldtodo: ${worldtodo.tables} tables (${worldtodoTasks} tasks), notes: ${notes.tables} tables, math: ${math.tables} tables (${mathChapters} chapters), plant: ${plant.tables} tables (${plantEntries} entries), radio: ${radio.tables} tables (${radioFreqs} frequencies), tools: ${tools.tables} tables, app read/write, personal_ro none; energy: ${energy.hours} hourly rows, latest ${energy.latest ? new Date(energy.latest).toISOString() : 'none'}`
|
||||
);
|
||||
const [catalog] = await client`
|
||||
select
|
||||
|
||||
Reference in new issue
Block a user