This commit is contained in:
ditiqi 2025-02-26 16:35:59 +08:00
parent 317df03ded
commit 197f617a8c
7 changed files with 7 additions and 10 deletions

View File

@ -32,7 +32,7 @@ export class AuthService {
return { isValid: false, error: FileValidationErrorType.INVALID_URI }; return { isValid: false, error: FileValidationErrorType.INVALID_URI };
} }
const fileId = extractFileIdFromNginxUrl(params.originalUri); const fileId = extractFileIdFromNginxUrl(params.originalUri);
console.log(params.originalUri, fileId); // console.log(params.originalUri, fileId);
const resource = await db.resource.findFirst({ where: { fileId } }); const resource = await db.resource.findFirst({ where: { fileId } });
// 资源验证 // 资源验证

View File

@ -118,7 +118,6 @@ export class PostService extends BaseTreeService<Prisma.PostDelegate> {
}); });
} }
// If transaction is provided, use it directly // If transaction is provided, use it directly
console.log('courseDetail', courseDetail);
const createdCourse = await this.create(courseDetail, params); const createdCourse = await this.create(courseDetail, params);
// If sections are provided, create them // If sections are provided, create them
return createdCourse; return createdCourse;

View File

@ -128,8 +128,6 @@ export async function updateCourseEnrollmentStats(courseId: string) {
export async function setCourseInfo({ data }: { data: Post }) { export async function setCourseInfo({ data }: { data: Post }) {
// await db.term // await db.term
console.log(12314243342);
console.log(data?.type);
if (data?.type === PostType.COURSE) { if (data?.type === PostType.COURSE) {
const ancestries = await db.postAncestry.findMany({ const ancestries = await db.postAncestry.findMany({
where: { where: {
@ -170,7 +168,6 @@ export async function setCourseInfo({ data }: { data: Post }) {
(lecture) => lecture.parentId === section.id, (lecture) => lecture.parentId === section.id,
) as any as Lecture[]; ) as any as Lecture[];
}); });
console.log(sections);
Object.assign(data, { sections, lectureCount }); Object.assign(data, { sections, lectureCount });
} }
} }

View File

@ -3,7 +3,6 @@ import {
BaseSetting, BaseSetting,
db, db,
PostType, PostType,
TaxonomySlug,
VisitType, VisitType,
} from '@nice/common'; } from '@nice/common';
export async function updateTotalCourseViewCount(type: VisitType) { export async function updateTotalCourseViewCount(type: VisitType) {
@ -24,7 +23,7 @@ export async function updateTotalCourseViewCount(type: VisitType) {
views: true, views: true,
}, },
where: { where: {
postId: { in: courseIds }, postId: { in: lectures.map((lecture) => lecture.id) },
type: type, type: type,
}, },
}); });
@ -67,6 +66,7 @@ export async function updatePostViewCount(id: string, type: VisitType) {
where: { id }, where: { id },
select: { id: true, meta: true }, select: { id: true, meta: true },
}); });
const totalViews = await db.visit.aggregate({ const totalViews = await db.visit.aggregate({
_sum: { _sum: {
views: true, views: true,

View File

@ -10,7 +10,7 @@ const pipeline = new ResourceProcessingPipeline()
.addProcessor(new VideoProcessor()); .addProcessor(new VideoProcessor());
export default async function processJob(job: Job<any, any, QueueJobType>) { export default async function processJob(job: Job<any, any, QueueJobType>) {
if (job.name === QueueJobType.FILE_PROCESS) { if (job.name === QueueJobType.FILE_PROCESS) {
console.log('job', job); // console.log('job', job);
const { resource } = job.data; const { resource } = job.data;
if (!resource) { if (!resource) {
throw new Error('No resource provided in job data'); throw new Error('No resource provided in job data');

View File

@ -89,8 +89,8 @@ export class TusService implements OnModuleInit {
upload: Upload, upload: Upload,
) { ) {
try { try {
console.log('upload.id', upload.id); // console.log('upload.id', upload.id);
console.log('fileId', this.getFileId(upload.id)); // console.log('fileId', this.getFileId(upload.id));
const resource = await this.resourceService.update({ const resource = await this.resourceService.update({
where: { fileId: this.getFileId(upload.id) }, where: { fileId: this.getFileId(upload.id) },
data: { status: ResourceStatus.UPLOADED }, data: { status: ResourceStatus.UPLOADED },

View File

@ -45,6 +45,7 @@ export type PostDto = Post & {
export type LectureMeta = { export type LectureMeta = {
type?: string; type?: string;
views?: number;
videoUrl?: string; videoUrl?: string;
videoThumbnail?: string; videoThumbnail?: string;
videoIds?: string[]; videoIds?: string[];