This commit is contained in:
ditiqi 2025-02-26 16:23:43 +08:00
parent baa65e0e3f
commit 317df03ded
5 changed files with 5 additions and 7 deletions

View File

@ -112,8 +112,6 @@ export class PostService extends BaseTreeService<Prisma.PostDelegate> {
return await db.$transaction(async (tx) => { return await db.$transaction(async (tx) => {
const courseParams = { ...params, tx }; const courseParams = { ...params, tx };
// Create the course first // Create the course first
console.log(courseParams?.staff?.id);
console.log('courseDetail', courseDetail);
const createdCourse = await this.create(courseDetail, courseParams); const createdCourse = await this.create(courseDetail, courseParams);
// If sections are provided, create them // If sections are provided, create them
return createdCourse; return createdCourse;

View File

@ -129,6 +129,7 @@ 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(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: {

View File

@ -91,6 +91,7 @@ export function CourseFormProvider({
const formattedValues = { const formattedValues = {
...values, ...values,
type: PostType.COURSE,
meta: { meta: {
...((course?.meta as CourseMeta) || {}), ...((course?.meta as CourseMeta) || {}),
...(values?.meta?.thumbnail !== undefined && { ...(values?.meta?.thumbnail !== undefined && {
@ -111,8 +112,6 @@ export function CourseFormProvider({
delete formattedValues.sections; delete formattedValues.sections;
delete formattedValues.deptIds; delete formattedValues.deptIds;
console.log(course.meta);
console.log(formattedValues?.meta);
try { try {
if (editId) { if (editId) {
const result = await update.mutateAsync({ const result = await update.mutateAsync({
@ -125,7 +124,7 @@ export function CourseFormProvider({
const result = await createCourse.mutateAsync({ const result = await createCourse.mutateAsync({
courseDetail: { courseDetail: {
data: { data: {
title: formattedValues.title || "12345", title: formattedValues.title,
// state: CourseStatus.DRAFT, // state: CourseStatus.DRAFT,
type: PostType.COURSE, type: PostType.COURSE,

View File

@ -5,7 +5,7 @@ export enum PostType {
POST = "post", POST = "post",
POST_COMMENT = "post_comment", POST_COMMENT = "post_comment",
COURSE_REVIEW = "course_review", COURSE_REVIEW = "course_review",
COURSE = "couse", COURSE = "course",
SECTION = "section", SECTION = "section",
LECTURE = "lecture", LECTURE = "lecture",
PATH = "path", PATH = "path",
@ -101,7 +101,6 @@ export enum RolePerms {
} }
export enum AppConfigSlug { export enum AppConfigSlug {
BASE_SETTING = "base_setting", BASE_SETTING = "base_setting",
} }
// 资源类型的枚举,定义了不同类型的资源,以字符串值表示 // 资源类型的枚举,定义了不同类型的资源,以字符串值表示
export enum ResourceType { export enum ResourceType {

View File

@ -69,6 +69,7 @@ export const courseDetailSelect: Prisma.PostSelect = {
id: true, id: true,
title: true, title: true,
subTitle: true, subTitle: true,
type: true,
content: true, content: true,
depts: true, depts: true,
// isFeatured: true, // isFeatured: true,