feat: remove global admin, open registration, clear DB seed

- All users are equal — no is_admin superuser
- Removed AdminPanel, Shield button from sidebar
- isOwnerOrAdmin checks only by chat role (owner/admin)
- Removed auto-seed of admin user on startup
- DB already cleared on server

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ai
2026-05-25 15:45:59 +03:00
parent 2fd6b14e1a
commit dbf328b197
5 changed files with 7 additions and 26 deletions

View File

@@ -339,13 +339,13 @@ export default async function chatRoutes(app: FastifyInstance) {
// Delete chat (owner only)
app.delete('/:id', async (req, reply) => {
const { id: userId, isAdmin } = req.user as { id: string; isAdmin: boolean };
const { id: userId } = req.user as { id: string };
const { id } = req.params as { id: string };
const { rows: [member] } = await pool.query(
'SELECT role FROM chat_members WHERE chat_id = $1 AND user_id = $2', [id, userId]
);
if (!member || (member.role !== 'owner' && !isAdmin)) {
if (!member || member.role !== 'owner') {
return reply.status(403).send({ error: 'No permission' });
}