Add phone and membership request modal
This commit is contained in:
1 parent
d7376c055c
commit
93f0187706
6 files changed
+110
-56
No files matched your search
@@ -83,10 +83,10 @@ publicRouter.post(
|
||||
validate(demandeSchema),
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const { nom, fonction, entreprise, email } = req.data;
|
||||
const { nom, fonction, entreprise, email, tel } = req.data;
|
||||
await query(
|
||||
'INSERT INTO demandes_adhesion (nom, fonction, entreprise, email) VALUES ($1, $2, $3, $4)',
|
||||
[nom, fonction, entreprise, email]
|
||||
'INSERT INTO demandes_adhesion (nom, fonction, entreprise, email, tel) VALUES ($1, $2, $3, $4, $5)',
|
||||
[nom, fonction, entreprise, email, tel]
|
||||
);
|
||||
res.status(201).json({ ok: true });
|
||||
} catch (err) {
|
||||
|
||||
@@ -24,6 +24,7 @@ export const demandeSchema = z.object({
|
||||
fonction: trimmed(120).optional().default(''),
|
||||
entreprise: trimmed(120, 1),
|
||||
email: trimmed(254, 3).email(),
|
||||
tel: trimmed(30, 6),
|
||||
});
|
||||
|
||||
export const inscriptionPublicSchema = z.object({
|
||||
|
||||
@@ -135,9 +135,11 @@ CREATE TABLE IF NOT EXISTS demandes_adhesion (
|
||||
fonction TEXT NOT NULL DEFAULT '' CHECK (char_length(fonction) <= 120),
|
||||
entreprise TEXT NOT NULL CHECK (char_length(entreprise) BETWEEN 1 AND 120),
|
||||
email CITEXT NOT NULL CHECK (char_length(email) <= 254),
|
||||
tel TEXT CHECK (char_length(tel) <= 30),
|
||||
statut TEXT NOT NULL DEFAULT 'nouvelle' CHECK (statut IN ('nouvelle', 'traitee')),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
ALTER TABLE demandes_adhesion ADD COLUMN IF NOT EXISTS tel TEXT CHECK (char_length(tel) <= 30);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS site_content (
|
||||
key TEXT PRIMARY KEY,
|
||||
|
||||
Reference in new issue
Block a user