charles_c il y a 5 mois
Parent
commit
1bbc51b99c
2 fichiers modifiés avec 8 ajouts et 5 suppressions
  1. 5 5
      src/app/api/upload/route.js
  2. 3 0
      src/app/models/Activity.js

+ 5 - 5
src/app/api/upload/route.js

@@ -1,5 +1,5 @@
 import { writeFile } from "fs/promises";
-import { chmod, chown } from "fs/promises";
+// import { chmod, chown } from "fs/promises";
 import { NextResponse } from "next/server";
 import path from "path";
 import { setCORSHeaders } from "../../lib/apiUtils";
@@ -27,11 +27,11 @@ export async function POST(request) {
     await writeFile(filepath, buffer);
 
     // 设置文件权限为 0755 (rwxr-xr-x)
-    await chmod(filepath, 0o755);
+    // await chmod(filepath, 0o755);
 
-    const nextjsUID = 1001;
-    const nodejsGID = 1001;
-    await chown(filepath, nextjsUID, nodejsGID);
+    // const nextjsUID = 1001;
+    // const nodejsGID = 1001;
+    // await chown(filepath, nextjsUID, nodejsGID);
 
     const response = NextResponse.json({
       success: true,

+ 3 - 0
src/app/models/Activity.js

@@ -12,6 +12,9 @@ const ActivitySchema = new mongoose.Schema(
       type: Boolean,
       default: false,
     },
+    backgroundImage: {
+      type: String, // 存储图片的URL或路径
+    },
   },
   { timestamps: true }
 );