signing petition through fetch request instead of direct db connection

This commit is contained in:
John Costa
2025-11-10 21:23:09 +00:00
parent 42e4abf438
commit 2a563bbd7a
10 changed files with 131 additions and 14 deletions

34
packages/types/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules
# output
out
dist
*.tgz
# code coverage
coverage
*.lcov
# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# caches
.eslintcache
.cache
*.tsbuildinfo
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

11
packages/types/index.ts Normal file
View File

@@ -0,0 +1,11 @@
import z from "zod";
export const signPetitionSchema = z.object({
email: z.string(),
name: z.string().trim().min(1).max(30).nullable(),
comment: z.string().trim().min(10).max(10_000).nullable(),
})
export const signedPetitionSchema = signPetitionSchema.extend({
id: z.uuid(),
})

View File

@@ -0,0 +1,15 @@
{
"name": "types",
"module": "index.ts",
"type": "module",
"private": true,
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
},
"dependencies": {
"zod": "^4.1.12"
}
}

View File

@@ -0,0 +1,29 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}