OurBigBook logoOurBigBook Docs OurBigBook logoOurBigBook.comSite Source Code
Check the counts of issues per article for user barack-obama only with -c, but don't fix anything:
web/bin/normalize -c -u barack-obama article-issue-count
Print the full correct normalized state with -p:
web/bin/normalize -f -u barack-obama issue-follower-count
Fix the counts of issue follower if any are wrong with -f, thus potentially altering the database:
web/bin/normalize -f -u barack-obama issue-follower-count
web/bin/normalize
#!/usr/bin/env node
// https://docs.ourbigbook.com/file/web/bin/normalize

const path = require('path')

const commander = require('commander')

const models = require('../models')

// main
const program = commander.program

program.description('View, check or update (i.e. normalize redundant database data: https://docs.ourbigbook.com/ourbigbook-web-dynamic-article-tree https://docs.ourbigbook.com/_file/web/bin/normalize')
program.option('-c, --check', 'check if something is up-to-date', false);
program.option('-f, --fix', 'fix before printing', false);
program.option('-p, --print', 'print the final state after any update if any', false);
program.option(
  '-u, --username <username>',
  'which user to check or fix for. If not given do it for all users. Can be given multiple times.',
  (value, previous) => previous.concat([value]),
  [],
);
program.parse(process.argv);
const opts = program.opts()
const whats = program.args
const sequelize = models.getSequelize(path.dirname(__dirname))
;(async () => {
  await models.normalize({
    check: opts.check,
    fix: opts.fix,
    log: true,
    print: opts.print,
    sequelize,
    usernames: opts.username,
    whats,
  })
})().finally(() => { return sequelize.close() });

Ancestors (6)

  1. Web CLI utils
  2. OurBigBook Web directory structure
  3. OurBigBook Web architecture
  4. OurBigBook Web development
  5. OurBigBook Web
  6. Home