chore error status code and custom provider name

This commit is contained in:
oiov
2025-07-21 10:47:37 +08:00
parent 877e826d23
commit 457e161281
5 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ export default function S3Configs({}: {}) {
{
label: "Custom Provider",
value: "Custom Provider",
platform: "custom",
platform: "custom provider",
channel: "cp",
},
];
+1 -3
View File
@@ -28,14 +28,12 @@ export async function POST(request: NextRequest) {
return NextResponse.json(
{
success: false,
error: `缺少必需字段: ${missingFields.join(", ")}`,
error: `Missing required fields: ${missingFields.join(", ")}`,
},
{ status: 400 },
);
}
console.log(body);
const userFile = await createUserFile({
userId: body.userId,
name: body.name,
+8 -8
View File
@@ -48,17 +48,17 @@ export async function POST(request: NextRequest) {
for (const file of files) {
if (Number(file.size) > Number(plan.stMaxFileSize)) {
return Response.json(`File (${file.name}) size limit exceeded`, {
status: 403,
status: 400,
});
}
}
const limit = await restrictByTimeRange({
model: "userFile",
userId: user.id,
limit: Number(plan.stMaxFileCount),
rangeType: "month",
});
if (limit) return Response.json(limit.statusText, { status: limit.status });
// const limit = await restrictByTimeRange({
// model: "userFile",
// userId: user.id,
// limit: Number(plan.stMaxFileCount),
// rangeType: "month",
// });
// if (limit) return Response.json(limit.statusText, { status: limit.status });
const R2 = createS3Client(
providerChannel.endpoint,
+3 -1
View File
@@ -159,8 +159,10 @@ export async function getUserFiles(options: QueryUserFileOptions = {}) {
prisma.userFile.count({ where }),
prisma.userFile.aggregate({
where: {
...(userId && { userId }),
// bucket,
// providerName,
status: 1,
...(userId && { userId }),
},
_sum: { size: true },
}),
+1 -1
View File
File diff suppressed because one or more lines are too long