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:
@@ -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' });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user