LifeMate — Personal, Family & Learning Companion
feat: list current user's family workspaces
davoodmehraban89 committed
Oct 5, 2026 at 07:41 UTC
a23c5813658be63239a9ec5026380ca99ceed8ba
1 file changed
+12
backend/src/server.js
+12
@@ -362,6 +362,18 @@ app.patch('/v1/profile', auth, async (req, res) => {
362
res.json(r.rows[0]);
363
});
364
365
+app.get('/v1/families', auth, async (req, res) => {
366
+ const r = await pool.query(
367
+ `select f.id,f.name,m.role,m.is_admin
368
+ from family_membership m
369
+ join family_workspace f on f.id=m.family_id
370
+ where m.user_id=$1 and m.ended_at is null and f.archived_at is null
371
+ order by f.created_at`,
372
+ [req.identity.sub],
373
+ );
374
+ res.json({ families: r.rows });
375
+});
376
+
377
app.post('/v1/families', auth, async (req, res) => {
378
const name = String(req.body.name ?? '').trim();
379
if (!name) return res.status(400).json({ error: 'invalid_name' });