444d2ca7dd
* Revert "Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)"
This reverts commit 63e6581162.
* Use pino-http instead of express pino logger
* Use correct reference to knex and do not instantiate HttpLogger prematurely
* Adds missing dependency for pino to webhook-service
* Do not instantiate middleware when passed to express
* Refactor to move logging into shared
* Copy shared packages into dockerfiles
* Build shared workspace in docker build-stage for fileimport & webhook
30 lines
1009 B
TypeScript
30 lines
1009 B
TypeScript
import { CommandModule } from 'yargs'
|
|
import { initializeQueue } from '@/modules/notifications/services/queue'
|
|
import { sendActivityNotifications } from '@/modules/activitystream/services/summary'
|
|
import { publishNotification } from '@/modules/notifications/services/publication'
|
|
import { cliLogger } from '@/logging/logging'
|
|
|
|
const command: CommandModule = {
|
|
command: 'send [days]',
|
|
describe:
|
|
'Send activity summary notifications for the past days specified in the argument.',
|
|
builder(yargs) {
|
|
return yargs.positional('days', {
|
|
describe: 'Number of days to look for activities',
|
|
type: 'number',
|
|
default: 7
|
|
})
|
|
},
|
|
handler: async (argv) => {
|
|
initializeQueue()
|
|
const numberOfDays = argv.days as number
|
|
const end = new Date()
|
|
const start = new Date(end.getTime())
|
|
start.setDate(start.getDate() - numberOfDays)
|
|
await sendActivityNotifications(start, end, publishNotification)
|
|
cliLogger.info('Sent activity notifications')
|
|
}
|
|
}
|
|
|
|
export = command
|