feat: added group management UI
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
const { PrismaClient } = require('@prisma/client')
|
||||
const { PrismaPg } = require('@prisma/adapter-pg')
|
||||
const { Pool } = require('pg')
|
||||
|
||||
// Создаем соединение через pg (как того требует Driver Adapter в Prisma 7)
|
||||
const connectionString = process.env.DATABASE_URL
|
||||
const pool = new Pool({ connectionString })
|
||||
const adapter = new PrismaPg(pool)
|
||||
|
||||
const prisma = new PrismaClient({ adapter })
|
||||
|
||||
async function main() {
|
||||
const userId = 'GqbpMyUW0NaxjIy5nvCiXCiQu9t2' // Твой UID из лога
|
||||
|
||||
console.log('🚀 Initializing admin using Driver Adapter for UID:', userId)
|
||||
|
||||
const user = await prisma.user.upsert({
|
||||
where: { id: userId },
|
||||
update: {
|
||||
role: 'admin'
|
||||
},
|
||||
create: {
|
||||
id: userId,
|
||||
email: 'admin@xflow.kz',
|
||||
username: 'alex_admin',
|
||||
password: 'firebase_auth',
|
||||
role: 'admin',
|
||||
profile: {
|
||||
create: {
|
||||
displayName: 'Alex Admin',
|
||||
bio: 'XFlow Infrastructure Creator',
|
||||
joinedAt: new Date()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('✅ Success! Admin user created/updated:', user.username)
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error('❌ Error initializing admin:', e)
|
||||
process.exit(1)
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect()
|
||||
await pool.end()
|
||||
})
|
||||
@@ -0,0 +1,42 @@
|
||||
const { PrismaClient } = require('@prisma/client')
|
||||
const { PrismaPg } = require('@prisma/adapter-pg')
|
||||
const { Pool } = require('pg')
|
||||
|
||||
const connectionString = process.env.DATABASE_URL
|
||||
const pool = new Pool({ connectionString })
|
||||
const adapter = new PrismaPg(pool)
|
||||
const prisma = new PrismaClient({ adapter })
|
||||
|
||||
async function main() {
|
||||
const adminId = 'GqbpMyUW0NaxjIy5nvCiXCiQu9t2'
|
||||
|
||||
console.log('📦 Seeding Mindmaps to PostgreSQL...')
|
||||
|
||||
// 1. Создаем основную карту "Обзор Проекта XFlow"
|
||||
const xflowCanvas = await prisma.canvas.upsert({
|
||||
where: { id: 'xflow-project' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'xflow-project',
|
||||
name: 'Обзор Проекта XFlow',
|
||||
ownerId: adminId,
|
||||
isPublic: true,
|
||||
nodes: [
|
||||
{ id: 'arch-1', type: 'text', x: 100, y: 100, width: 320, height: 180, text: '# 🏗️ Основная Архитектура\n\n- **Nuxt 3** - Vue 3 фреймворк\n- **TailwindCSS** - Стилизация\n- **Vue Flow** - Движок канваса\n- **Firebase** - Аутентификация\n- **PostgreSQL + Prisma** - Хранение данных\n- **PWA** - Progressive Web App' },
|
||||
{ id: 'be-1', type: 'text', x: 500, y: 250, width: 280, height: 160, text: '# ⚙️ Backend API\n\n- `/api/canvas/*` - Prisma CRUD\n- `/api/groups/*` - Групповой доступ\n- `/api/admin/*` - Админка\n- **Gitea Actions** - Автодеплой' }
|
||||
],
|
||||
edges: [
|
||||
{ id: 'e1', fromNode: 'arch-1', fromSide: 'right', toNode: 'be-1', toSide: 'left' }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
console.log('✅ Success! Mindmap "Обзор Проекта XFlow" is now in the database.')
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect()
|
||||
await pool.end()
|
||||
})
|
||||
Reference in New Issue
Block a user