feat: implement permissions and actions management
- Add permissions logic for status options in corrective actions. - Create tests for permissions functionality. - Implement queries for user authentication and actions management. - Develop Actions page to display and manage corrective actions. - Create authentication pages for login, setup, and password reset. - Add IncidentDetail page to view incident details and associated actions. - Implement Settings page for user management and password changes.
This commit is contained in:
1 parent
708da6b9f7
commit
3f6dff5f24
94 files changed
+7213
-643
No files matched your search
+12
-1
@@ -5,10 +5,19 @@ import { join } from 'node:path'
|
||||
import { createApp } from './app.ts'
|
||||
import { loadConfig } from './config.ts'
|
||||
import { openDatabase } from './db/client.ts'
|
||||
import { createMailer } from './mail.ts'
|
||||
import { Notifier } from './notifications.ts'
|
||||
import { FileStorage } from './storage.ts'
|
||||
|
||||
const config = loadConfig()
|
||||
const database = await openDatabase(config.databaseUrl)
|
||||
const app = createApp({ db: database.db, config })
|
||||
const notifier = new Notifier(database.db, createMailer(config), config)
|
||||
const app = createApp({ db: database.db, config, notifier, storage: new FileStorage(config.uploadDir) })
|
||||
|
||||
// Hourly check for corrective actions that are due or overdue; each gets at most one reminder a day.
|
||||
const sendReminders = () => notifier.sendDueReminders().catch((error) => console.error('[reminders] failed:', error))
|
||||
const reminderTimer = setInterval(sendReminders, 60 * 60 * 1000)
|
||||
setTimeout(sendReminders, 30_000).unref()
|
||||
|
||||
// In production the server also serves the built web app.
|
||||
if (existsSync(join(config.staticDir, 'index.html'))) {
|
||||
@@ -30,7 +39,9 @@ const server = serve({ fetch: app.fetch, port: config.port }, ({ port }) => {
|
||||
|
||||
for (const signal of ['SIGINT', 'SIGTERM'] as const) {
|
||||
process.on(signal, () => {
|
||||
clearInterval(reminderTimer)
|
||||
server.close(async () => {
|
||||
await notifier.flush()
|
||||
await database.close()
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user