Features - User Management (Phase 4.1): - Database: Add user_modules table for fine-grained module permissions - Database: Add 4 user permissions (view/create/edit/delete) to role_permissions - Backend: UserService (780 lines) - CRUD with tenant isolation - Backend: UserController + UserRoutes (648 lines) - 13 API endpoints - Backend: Batch import users from Excel - Frontend: UserListPage (412 lines) - list/filter/search/pagination - Frontend: UserFormPage (341 lines) - create/edit with module config - Frontend: UserDetailPage (393 lines) - details/tenant/module management - Frontend: 3 modal components (592 lines) - import/assign/configure - API: GET/POST/PUT/DELETE /api/admin/users/* endpoints Architecture Upgrade - Module Permission System: - Backend: Add getUserModules() method in auth.service - Backend: Login API returns modules array in user object - Frontend: AuthContext adds hasModule() method - Frontend: Navigation filters modules based on user.modules - Frontend: RouteGuard checks requiredModule instead of requiredVersion - Frontend: Remove deprecated version-based permission system - UX: Only show accessible modules in navigation (clean UI) - UX: Smart redirect after login (avoid 403 for regular users) Fixes: - Fix UTF-8 encoding corruption in ~100 docs files - Fix pageSize type conversion in userService (String to Number) - Fix authUser undefined error in TopNavigation - Fix login redirect logic with role-based access check - Update Git commit guidelines v1.2 with UTF-8 safety rules Database Changes: - CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled) - ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code) - INSERT 4 permissions + role assignments - UPDATE PUBLIC tenant with 8 module subscriptions Technical: - Backend: 5 new files (~2400 lines) - Frontend: 10 new files (~2500 lines) - Docs: 1 development record + 2 status updates + 1 guideline update - Total: ~4900 lines of code Status: User management 100% complete, module permission system operational
130 lines
3.7 KiB
PowerShell
130 lines
3.7 KiB
PowerShell
# Node.js后端 - 重新构建并推送镜像到ACR
|
||
# 创建时间: 2025-12-24
|
||
# 原因: 修复缺少config目录的问题
|
||
|
||
Write-Host "============================================" -ForegroundColor Cyan
|
||
Write-Host "🚀 Node.js后端 - 重新构建镜像" -ForegroundColor Cyan
|
||
Write-Host "============================================" -ForegroundColor Cyan
|
||
Write-Host ""
|
||
|
||
# 1. 确认当前目录
|
||
$currentDir = Get-Location
|
||
Write-Host "📁 当前目录: $currentDir" -ForegroundColor Yellow
|
||
if ($currentDir.Path -notlike "*\backend") {
|
||
Write-Host "❌ 错误: 请在 backend 目录下运行此脚本!" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
# 2. 检查必需文件
|
||
Write-Host ""
|
||
Write-Host "🔍 检查必需文件..." -ForegroundColor Yellow
|
||
$requiredFiles = @("Dockerfile", "dist", "config", "package.json", "prisma")
|
||
foreach ($file in $requiredFiles) {
|
||
if (Test-Path $file) {
|
||
Write-Host " ✅ $file" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " ❌ $file 不存在!" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
}
|
||
|
||
# 3. 登录ACR
|
||
Write-Host ""
|
||
Write-Host "🔐 登录阿里云容器镜像服务 (ACR)..." -ForegroundColor Yellow
|
||
docker login `
|
||
--username=gofeng117@163.com `
|
||
--password=fengzhibo117 `
|
||
crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com
|
||
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-Host "❌ ACR登录失败!" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
Write-Host "✅ ACR登录成功" -ForegroundColor Green
|
||
|
||
# 4. 构建镜像
|
||
Write-Host ""
|
||
Write-Host "🏗️ 开始构建Docker镜像..." -ForegroundColor Yellow
|
||
Write-Host " 镜像名称: backend-service:v1.1" -ForegroundColor Cyan
|
||
Write-Host " 修复内容: 添加config目录(agents.yaml等配置文件)" -ForegroundColor Cyan
|
||
Write-Host ""
|
||
|
||
$imageName = "crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/backend-service"
|
||
$imageTag = "v1.1"
|
||
|
||
docker build -t "${imageName}:${imageTag}" .
|
||
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-Host "❌ 镜像构建失败!" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
Write-Host "✅ 镜像构建成功: ${imageName}:${imageTag}" -ForegroundColor Green
|
||
|
||
# 5. 推送镜像到ACR
|
||
Write-Host ""
|
||
Write-Host "📤 推送镜像到ACR..." -ForegroundColor Yellow
|
||
docker push "${imageName}:${imageTag}"
|
||
|
||
if ($LASTEXITCODE -ne 0) {
|
||
Write-Host "❌ 镜像推送失败!" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
Write-Host "✅ 镜像推送成功" -ForegroundColor Green
|
||
|
||
# 6. 同时打上latest标签(可选)
|
||
Write-Host ""
|
||
Write-Host "🏷️ 打上latest标签..." -ForegroundColor Yellow
|
||
docker tag "${imageName}:${imageTag}" "${imageName}:latest"
|
||
docker push "${imageName}:latest"
|
||
Write-Host "✅ latest标签已推送" -ForegroundColor Green
|
||
|
||
# 7. 完成
|
||
Write-Host ""
|
||
Write-Host "============================================" -ForegroundColor Cyan
|
||
Write-Host "🎉 镜像构建和推送完成!" -ForegroundColor Green
|
||
Write-Host "============================================" -ForegroundColor Cyan
|
||
Write-Host ""
|
||
Write-Host "📋 镜像信息:" -ForegroundColor Yellow
|
||
Write-Host " 公网地址: ${imageName}:${imageTag}" -ForegroundColor Cyan
|
||
Write-Host " VPC地址: crpi-cd5ij4pjt65mweeo-vpc.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/backend-service:${imageTag}" -ForegroundColor Cyan
|
||
Write-Host ""
|
||
Write-Host "📝 下一步操作:" -ForegroundColor Yellow
|
||
Write-Host " 1. 登录SAE控制台: https://sae.console.aliyun.com/" -ForegroundColor White
|
||
Write-Host " 2. 找到应用: nodejs-backend-test" -ForegroundColor White
|
||
Write-Host " 3. 配置管理 → 部署配置 → 镜像设置" -ForegroundColor White
|
||
Write-Host " 4. 修改镜像版本为: v1.1" -ForegroundColor White
|
||
Write-Host " 5. 保存并重新部署" -ForegroundColor White
|
||
Write-Host ""
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|