Files
studio-launcher-be/prisma/seed.ts
T
2026-07-01 18:01:05 +09:00

384 lines
12 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
const appNotices = [
{
id: 'app-notice-ads-ide-v1-1-0',
appKey: 'ADS IDE',
title: 'v1.0.1 업데이트 안내',
body: 'ADS IDE 신규 기능 및 성능 개선 사항이 포함된 업데이트가 배포되었습니다.',
linkUrl: 'https://www.futuredrive.net/solutions/astudio',
createdAt: new Date('2025-04-23T00:00:00.000Z'),
priority: 0,
},
{
id: 'app-notice-ads-ide-maintenance-2025-04-10',
appKey: 'ADS IDE',
title: '정기 점검 안내',
body: '4월 15일 02:00 ~ 04:00 서버 정기 점검이 진행됩니다.',
linkUrl: 'https://www.futuredrive.net/solutions/astudio',
createdAt: new Date('2025-04-10T00:00:00.000Z'),
priority: 0,
},
{
id: 'app-notice-data-management-retention-2025-04-18',
appKey: 'Data Management',
title: '데이터 보존 정책 변경 안내',
body: '5월 1일부터 로그 데이터 보존 기간이 90일로 변경됩니다.',
createdAt: new Date('2025-04-18T00:00:00.000Z'),
priority: 0,
},
{
id: 'app-notice-fms-v2-3-1',
appKey: 'FMS',
title: 'FMS v2.3.1 배포',
body: '차량 관제 대시보드 UI 개선 및 실시간 알림 기능이 추가되었습니다.',
createdAt: new Date('2025-04-20T00:00:00.000Z'),
priority: 0,
},
{
id: 'app-notice-ads-education-curriculum-2025-04-15',
appKey: 'ADS Education',
title: '신규 커리큘럼 추가',
body: '자율주행 센서 융합 과정이 새롭게 추가되었습니다.',
createdAt: new Date('2025-04-15T00:00:00.000Z'),
priority: 0,
},
{
id: 'app-notice-calibration-lidar-2025-04-21',
appKey: 'Calibration',
title: 'LiDAR 캘리브레이션 개선',
body: '다중 LiDAR 동시 캘리브레이션 지원이 추가되었습니다.',
createdAt: new Date('2025-04-21T00:00:00.000Z'),
priority: 0,
},
{
id: 'app-notice-hdmap-builder-format-2025-04-12',
appKey: 'HDMAP Builder',
title: '지도 포맷 업데이트',
body: 'OpenDRIVE 1.7 포맷 지원이 추가되었습니다.',
createdAt: new Date('2025-04-12T00:00:00.000Z'),
priority: 0,
},
];
const appVersions = [
{
appKey: 'launcher',
displayName: 'Autonomy Studio Launcher',
latestVersion: '1.0.1',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://testfile.autonomystudio.net/media/platform/autonomy-studio-launcher-1.0.1.deb',
releaseNotes: '런처 업데이트 확인 및 앱별 설치 상태 판단 기능이 추가되었습니다.',
},
{
appKey: 'ADS IDE',
displayName: 'ADS IDE',
latestVersion: '1.1.0',
minimumSupportedVersion: '0.1.0',
downloadUrl: 'https://testfile.autonomystudio.net/media/platform/ADS-IDE-1.1.0.AppImage',
releaseNotes: 'ADS IDE 신규 기능 및 성능 개선 사항이 포함되어 있습니다.',
},
{
appKey: 'LMS',
displayName: 'LMS',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/lms',
releaseNotes: '학습 관리 시스템 최초 배포 버전입니다.',
},
{
appKey: 'Data Management',
displayName: 'Data Management',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/data-management',
releaseNotes: '데이터 관리 앱 최초 배포 버전입니다.',
},
{
appKey: 'HMI',
displayName: 'HMI',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/hmi',
releaseNotes: 'HMI 앱 최초 배포 버전입니다.',
},
{
appKey: 'FMS',
displayName: 'FMS',
latestVersion: '2.3.1',
minimumSupportedVersion: '2.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/fms',
releaseNotes: '차량 관제 대시보드 UI 개선 및 실시간 알림 기능이 추가되었습니다.',
},
{
appKey: 'ADS Education',
displayName: 'ADS Education',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/ads-education',
releaseNotes: '자율주행 교육 앱 최초 배포 버전입니다.',
},
{
appKey: 'AI Benchmark',
displayName: 'AI Benchmark',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/ai-benchmark',
releaseNotes: 'AI Benchmark 앱 최초 배포 버전입니다.',
},
{
appKey: 'Calibration',
displayName: 'Calibration',
latestVersion: '1.0.4',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/calibration',
releaseNotes: '다중 LiDAR 동시 캘리브레이션 지원이 추가되었습니다.',
},
{
appKey: 'IP Repository',
displayName: 'IP Repository',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/ip-repository',
releaseNotes: 'IP Repository 앱 최초 배포 버전입니다.',
},
{
appKey: 'HDMAP Builder',
displayName: 'HDMAP Builder',
latestVersion: '1.0.0',
minimumSupportedVersion: '1.0.0',
downloadUrl: 'https://autonomystudio.example.com/downloads/hdmap-builder',
releaseNotes: 'OpenDRIVE 1.7 포맷 지원이 추가되었습니다.',
},
];
const launcherApps = [
{
appKey: 'ADS IDE',
displayName: 'ADS IDE',
description: '클라우드 기반에서 자율주행 소프트웨어를 설계·빌드·실행까지 빠르게 수행할 수 있는 통합 개발 플랫폼으로, 오픈소스 ADS 기반의 유연한 구조를 통해 기능 수정과 배포가 가능하며 다양한 실차 및 시뮬레이션 환경을 지원합니다.',
subtitle: '자율주행 모빌리티 소프트웨어\n통합 개발 환경 (IDE)',
detailUrl: 'https://www.futuredrive.net/solutions/astudio',
videoPath: './video/ads_ide.mp4',
iconKey: 'code',
launchUrl: 'http://localhost:5175',
devAppPath: './apps/ads-ide/ads-ide-fe',
execPath: './ADS-IDE-1.1.0.AppImage',
sortOrder: 10,
},
{
appKey: 'LMS',
displayName: 'LMS',
description: '자율주행 교육 과정, 실습 콘텐츠, 사용자 학습 이력을 통합 관리하는 학습 관리 시스템입니다.',
subtitle: '자율주행 교육 콘텐츠\n학습 관리 시스템',
detailUrl: null,
videoPath: './video/lms.mp4',
iconKey: 'graduation',
launchUrl: 'http://localhost:5176',
devAppPath: './apps/lms/lms-fe',
execPath: './LMS-1.0.0.AppImage',
sortOrder: 20,
},
{
appKey: 'Data Management',
displayName: 'Data Management',
description: '주행 데이터 수집 · 저장 · 분석 플랫폼',
subtitle: null,
detailUrl: null,
videoPath: './video/data_management.mp4',
iconKey: 'bar-chart',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 30,
},
{
appKey: 'HMI',
displayName: 'HMI',
description: '차량 인터페이스 모니터링 및 제어',
subtitle: null,
detailUrl: null,
videoPath: './video/hmi.mp4',
iconKey: 'monitor',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 40,
},
{
appKey: 'FMS',
displayName: 'FMS',
description: '플릿 운영 및 차량 관제 시스템',
subtitle: null,
detailUrl: null,
videoPath: './video/fms.mp4',
iconKey: 'truck',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 50,
},
{
appKey: 'ADS Education',
displayName: 'ADS Education',
description: '자율주행 기술 학습 및 교육 콘텐츠',
subtitle: null,
detailUrl: null,
videoPath: './video/ads_education.mp4',
iconKey: 'graduation',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 60,
},
{
appKey: 'AI Benchmark',
displayName: 'AI Benchmark',
description: 'AI 모델 성능 평가 및 비교 분석',
subtitle: null,
detailUrl: null,
videoPath: './video/ai_benchmark.mp4',
iconKey: 'activity',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 70,
},
{
appKey: 'Calibration',
displayName: 'Calibration',
description: '센서 캘리브레이션 및 설정 도구',
subtitle: null,
detailUrl: null,
videoPath: './video/calibration.mp4',
iconKey: 'sliders',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 80,
},
{
appKey: 'IP Repository',
displayName: 'IP Repository',
description: '지식재산 및 소프트웨어 자산 저장소',
subtitle: null,
detailUrl: null,
videoPath: './video/ip_repository.mp4',
iconKey: 'shopping-cart',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 90,
},
{
appKey: 'HDMAP Builder',
displayName: 'HDMAP Builder',
description: '고정밀 지도 생성 및 편집 도구',
subtitle: null,
detailUrl: null,
videoPath: './video/hdmap_builder.mp4',
iconKey: 'map',
launchUrl: null,
devAppPath: null,
execPath: null,
sortOrder: 100,
},
];
async function main(): Promise<void> {
await prisma.launcherNotice.upsert({
where: { id: 'launcher-notice-v1-1-0' },
create: {
id: 'launcher-notice-v1-1-0',
appKey: 'Launcher',
title: '공지',
body: 'v1.0.1 업데이트가 배포되었습니다. ADS IDE 신규 기능 및 성능 개선 사항이 포함되어 있습니다.',
isActive: true,
priority: 0,
},
update: {
title: '공지',
body: 'v1.0.1 업데이트가 배포되었습니다. ADS IDE 신규 기능 및 성능 개선 사항이 포함되어 있습니다.',
appKey: 'Launcher',
isActive: true,
priority: 0,
},
});
for (const notice of appNotices) {
await prisma.launcherNotice.upsert({
where: { id: notice.id },
create: {
...notice,
isActive: true,
},
update: {
appKey: notice.appKey,
title: notice.title,
body: notice.body,
linkUrl: notice.linkUrl ?? null,
createdAt: notice.createdAt,
isActive: true,
priority: notice.priority,
},
});
}
for (const appVersion of appVersions) {
await prisma.launcherAppVersion.upsert({
where: { appKey: appVersion.appKey },
create: {
...appVersion,
isEnabled: true,
},
update: {
displayName: appVersion.displayName,
latestVersion: appVersion.latestVersion,
minimumSupportedVersion: appVersion.minimumSupportedVersion,
downloadUrl: appVersion.downloadUrl,
releaseNotes: appVersion.releaseNotes,
isEnabled: true,
},
});
}
for (const launcherApp of launcherApps) {
await prisma.launcherApp.upsert({
where: { appKey: launcherApp.appKey },
create: {
...launcherApp,
isEnabled: true,
},
update: {
displayName: launcherApp.displayName,
description: launcherApp.description,
subtitle: launcherApp.subtitle,
detailUrl: launcherApp.detailUrl,
videoPath: launcherApp.videoPath,
iconKey: launcherApp.iconKey,
launchUrl: launcherApp.launchUrl,
devAppPath: launcherApp.devAppPath,
execPath: launcherApp.execPath,
sortOrder: launcherApp.sortOrder,
isEnabled: true,
},
});
}
console.log('Seeded launcher notice: launcher-notice-v1-1-0');
console.log(`Seeded app notices: ${appNotices.length}`);
console.log(`Seeded app versions: ${appVersions.length}`);
console.log(`Seeded launcher apps: ${launcherApps.length}`);
}
main()
.catch((error) => {
console.error(error);
process.exitCode = 1;
})
.finally(async () => {
await prisma.$disconnect();
});