feat: configure overview camera per curriculum week
This commit is contained in:
@@ -23,7 +23,7 @@ import { CreateInstructorPlatformDto } from './dto/create-instructor-platform.dt
|
||||
import { CreateInstructorStudentDto } from './dto/create-instructor-student.dto';
|
||||
import { SaveInstructorGroupDto } from './dto/save-instructor-group.dto';
|
||||
import { groupCourseScope } from './group-course-scope';
|
||||
import { normalizeCameraUrl, readPlatformCamera } from './platform-camera';
|
||||
import { normalizeCameraUrl, readWeekCamera } from '../curriculum/week-camera';
|
||||
import { SaveSubmissionScoreDto } from './dto/save-submission-score.dto';
|
||||
import { UpdateInstructorCurriculumDto } from './dto/update-instructor-curriculum.dto';
|
||||
import { UpdateInstructorPlatformDto } from './dto/update-instructor-platform.dto';
|
||||
@@ -1338,7 +1338,6 @@ export class InstructorService {
|
||||
type: this.toPlatformType(platform.platform.displayName),
|
||||
status: activeControl ? '활성' : '대기',
|
||||
battery: platform.battery,
|
||||
camera: readPlatformCamera(platform.studioSettingsOverride),
|
||||
uptime: typeof agentConnection?.agentUptimeSeconds === 'number'
|
||||
? this.formatUptimeSeconds(agentConnection.agentUptimeSeconds)
|
||||
: this.formatUptime(platform.uptimeMinutes),
|
||||
@@ -1473,6 +1472,7 @@ export class InstructorService {
|
||||
github: week.github,
|
||||
detail: {
|
||||
overview: override?.overview ?? week.overview,
|
||||
camera: readWeekCamera(override),
|
||||
learningSteps,
|
||||
topicDetails,
|
||||
topicVideoUrls,
|
||||
@@ -1528,6 +1528,7 @@ export class InstructorService {
|
||||
github: '-',
|
||||
detail: {
|
||||
overview: override.overview ?? '',
|
||||
camera: readWeekCamera(override),
|
||||
learningSteps,
|
||||
topicDetails: learningSteps.map((step) => step.description),
|
||||
topicVideoUrls: learningSteps.map((step) => step.videoUrl),
|
||||
@@ -1596,6 +1597,17 @@ export class InstructorService {
|
||||
},
|
||||
});
|
||||
|
||||
let cameraViewUrl: string | undefined;
|
||||
try {
|
||||
cameraViewUrl = input.cameraViewUrl === undefined ? undefined : normalizeCameraUrl(input.cameraViewUrl);
|
||||
} catch {
|
||||
throw new BadRequestException('오버뷰 시청 URL에 올바른 room과 view를 지정해주세요.');
|
||||
}
|
||||
const cameraSettings = {
|
||||
cameraViewUrl: cameraViewUrl ?? existingOverride?.cameraViewUrl ?? '',
|
||||
cameraPassword: cameraViewUrl === '' ? '' : input.cameraPassword ?? existingOverride?.cameraPassword ?? '',
|
||||
};
|
||||
|
||||
const existingLearningSteps = this.resolveLearningSteps(
|
||||
existingOverride?.learningSteps,
|
||||
this.stringArray(existingOverride?.topics) ?? targetWeek?.topics.map((topic) => topic.title) ?? ['학습단계 1'],
|
||||
@@ -1764,7 +1776,7 @@ export class InstructorService {
|
||||
selectedTagLabel = tagOption.label;
|
||||
}
|
||||
|
||||
if (!targetWeek || input.tagLabel !== undefined || input.title || input.duration || input.overview || input.deliverable || input.isTeamProject !== undefined || input.learningSteps || input.topics || input.topicDetails || input.topicVideoUrls || input.practiceContents || input.disabledModuleIds) {
|
||||
if (!targetWeek || input.cameraViewUrl !== undefined || input.cameraPassword !== undefined || input.tagLabel !== undefined || input.title || input.duration || input.overview || input.deliverable || input.isTeamProject !== undefined || input.learningSteps || input.topics || input.topicDetails || input.topicVideoUrls || input.practiceContents || input.disabledModuleIds) {
|
||||
await this.prisma.instructorCurriculumWeekOverride.upsert({
|
||||
where: {
|
||||
organizationName_courseId_week: {
|
||||
@@ -1776,6 +1788,7 @@ export class InstructorService {
|
||||
update: {
|
||||
organizationId,
|
||||
tagLabel: selectedTagLabel ?? existingOverride?.tagLabel ?? targetWeek?.tags[0] ?? '커리큘럼',
|
||||
...cameraSettings,
|
||||
title: this.optionalTrim(input.title) ?? existingOverride?.title ?? targetWeek?.title ?? `${input.activeWeek}주차 커리큘럼`,
|
||||
duration: this.optionalTrim(input.duration) ?? existingOverride?.duration ?? targetWeek?.duration ?? '-',
|
||||
overview: this.optionalTrim(input.overview) ?? existingOverride?.overview ?? targetWeek?.overview ?? '',
|
||||
@@ -1797,6 +1810,7 @@ export class InstructorService {
|
||||
courseId: course.id,
|
||||
week: input.activeWeek,
|
||||
tagLabel: selectedTagLabel ?? targetWeek?.tags[0] ?? '커리큘럼',
|
||||
...cameraSettings,
|
||||
title: this.optionalTrim(input.title) ?? targetWeek?.title ?? `${input.activeWeek}주차 커리큘럼`,
|
||||
duration: this.optionalTrim(input.duration) ?? targetWeek?.duration ?? '-',
|
||||
overview: this.optionalTrim(input.overview) ?? targetWeek?.overview ?? '',
|
||||
@@ -2227,12 +2241,6 @@ export class InstructorService {
|
||||
const maxSteeringAngleDegrees = this.toBoundedNumber(input.maxSteeringAngleDegrees, 30, 0, 90);
|
||||
const sensors = this.normalizeNameDescriptionList(input.sensors, { withEnabled: true });
|
||||
const algorithms = this.normalizeAlgorithms(input.algorithms);
|
||||
let cameraViewUrl: string | undefined;
|
||||
try {
|
||||
cameraViewUrl = input.cameraViewUrl === undefined ? undefined : normalizeCameraUrl(input.cameraViewUrl);
|
||||
} catch {
|
||||
throw new BadRequestException('VDO.Ninja 시청 URL에 올바른 room과 view를 지정해주세요.');
|
||||
}
|
||||
|
||||
const platform = await this.prisma.instructorPlatform.findFirst({
|
||||
where: {
|
||||
@@ -2245,7 +2253,6 @@ export class InstructorService {
|
||||
select: {
|
||||
id: true,
|
||||
displayName: true,
|
||||
studioSettingsOverride: true,
|
||||
},
|
||||
});
|
||||
if (!platform) throw new NotFoundException('Platform not found');
|
||||
@@ -2264,14 +2271,6 @@ export class InstructorService {
|
||||
algorithms,
|
||||
controlDurationMinutes,
|
||||
controlWarningMinutes,
|
||||
...((cameraViewUrl !== undefined || input.cameraPassword !== undefined) ? {
|
||||
studioSettingsOverride: {
|
||||
...(platform.studioSettingsOverride && typeof platform.studioSettingsOverride === 'object' && !Array.isArray(platform.studioSettingsOverride)
|
||||
? platform.studioSettingsOverride : {}),
|
||||
...(cameraViewUrl !== undefined ? { cameraViewUrl } : {}),
|
||||
...(cameraViewUrl === '' ? { cameraPassword: '' } : input.cameraPassword !== undefined ? { cameraPassword: input.cameraPassword } : {}),
|
||||
},
|
||||
} : {}),
|
||||
},
|
||||
}),
|
||||
this.prisma.studentGroup.updateMany({
|
||||
|
||||
Reference in New Issue
Block a user