Sync LMS backend source

This commit is contained in:
2026-07-07 16:09:12 +09:00
commit 5a2ecd0fea
126 changed files with 22959 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
import { Controller, Get, Param, Query, Req, Res } from '@nestjs/common';
import { Request, Response } from 'express';
import { CurriculumService } from './curriculum.service';
@Controller('curriculum')
export class CurriculumController {
constructor(private readonly curriculumService: CurriculumService) {}
@Get()
getActiveCurriculum(@Req() request: Request, @Query('courseId') courseId?: string) {
return this.curriculumService.getActiveCurriculum(
this.getBearerToken(request),
courseId,
);
}
@Get('courses')
listCourses(@Req() request: Request) {
return this.curriculumService.listCourses(this.getBearerToken(request));
}
@Get('references/:referenceId/download')
async downloadReference(
@Req() request: Request,
@Param('referenceId') referenceId: string,
@Res() response: Response,
) {
const download = await this.curriculumService.getReferenceDownload(
this.getBearerToken(request),
referenceId,
);
response.setHeader('content-type', download.contentType);
return response.download(download.path, download.fileName);
}
private getBearerToken(request: Request): string | undefined {
const [type, token] = request.headers.authorization?.split(' ') ?? [];
return type === 'Bearer' ? token : undefined;
}
}