feat: add volunteer shift signup app
Initial source, tests, migrations, and local Docker setup for the Hope Food Pantry volunteer scheduler.
This commit is contained in:
commit
f1a46e2ba7
129 files changed
+25290
No files matched your search
@@ -0,0 +1,25 @@
|
||||
// Spawned with `node --import tsx`. Those .ts specifiers are intentional.
|
||||
// tsconfig excludes this file because tsc does not allow that import style.
|
||||
import { openDatabaseFile } from '../src/db.ts';
|
||||
import { reserveSignup, type ReserveInput } from '../src/signup.ts';
|
||||
|
||||
const data = JSON.parse(process.env.HOPE_RACE ?? '') as { databaseFile: string; input: ReserveInput };
|
||||
const db = openDatabaseFile(data.databaseFile);
|
||||
try {
|
||||
const result = reserveSignup(db, data.input);
|
||||
process.stdout.write(JSON.stringify({
|
||||
ok: result.ok,
|
||||
reason: result.ok ? null : result.reason,
|
||||
replay: result.ok ? result.replay : false,
|
||||
}));
|
||||
} catch (err) {
|
||||
process.stdout.write(JSON.stringify({
|
||||
ok: false,
|
||||
reason: 'error',
|
||||
replay: false,
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
}));
|
||||
process.exitCode = 1;
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
Reference in new issue
Block a user