feat(docker): add Dockerfile and .dockerignore for app containerization
This commit is contained in:
@ -7,38 +7,47 @@ import { getNumericParam } from "@/lib/route-params";
|
||||
|
||||
type AssignmentRouteParams = { assignmentId: string | string[] | undefined };
|
||||
|
||||
type SubmissionRecord = Awaited<ReturnType<typeof prisma.submission.findMany>>[number];
|
||||
|
||||
type ExportableColumn = {
|
||||
header: string;
|
||||
getter: (submission: SubmissionRecord) => unknown;
|
||||
};
|
||||
|
||||
const EXPORTABLE_COLUMNS = {
|
||||
studentId: { header: "学号", getter: (submission: any) => submission.studentId },
|
||||
studentName: { header: "姓名", getter: (submission: any) => submission.studentName },
|
||||
studentId: { header: "学号", getter: (submission) => submission.studentId },
|
||||
studentName: { header: "姓名", getter: (submission) => submission.studentName },
|
||||
originalFilename: {
|
||||
header: "文件名",
|
||||
getter: (submission: any) => submission.originalFilename,
|
||||
getter: (submission) => submission.originalFilename,
|
||||
},
|
||||
fileUrl: { header: "文件地址", getter: (submission: any) => submission.fileUrl },
|
||||
fileUrl: { header: "文件地址", getter: (submission) => submission.fileUrl },
|
||||
submittedAt: {
|
||||
header: "提交时间",
|
||||
getter: (submission: any) =>
|
||||
getter: (submission) =>
|
||||
submission.submittedAt ? new Date(submission.submittedAt).toISOString() : "",
|
||||
},
|
||||
evaluationScore: {
|
||||
header: "得分",
|
||||
getter: (submission: any) =>
|
||||
getter: (submission) =>
|
||||
typeof submission.evaluationScore === "number"
|
||||
? submission.evaluationScore
|
||||
: "",
|
||||
},
|
||||
evaluationComment: {
|
||||
header: "评价评语",
|
||||
getter: (submission: any) => submission.evaluationComment ?? "",
|
||||
getter: (submission) => submission.evaluationComment ?? "",
|
||||
},
|
||||
evaluatedAt: {
|
||||
header: "评价时间",
|
||||
getter: (submission: any) =>
|
||||
getter: (submission) =>
|
||||
submission.evaluatedAt ? new Date(submission.evaluatedAt).toISOString() : "",
|
||||
},
|
||||
} as const;
|
||||
} satisfies Record<string, ExportableColumn>;
|
||||
|
||||
const DEFAULT_COLUMNS = ["studentId", "evaluationScore"] as Array<keyof typeof EXPORTABLE_COLUMNS>;
|
||||
type ExportableColumnKey = keyof typeof EXPORTABLE_COLUMNS;
|
||||
|
||||
const DEFAULT_COLUMNS: ExportableColumnKey[] = ["studentId", "evaluationScore"];
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
@ -84,7 +93,7 @@ export async function GET(
|
||||
return NextResponse.json({ error: "请选择有效的导出列" }, { status: 400 });
|
||||
}
|
||||
|
||||
const submissions = await prisma.submission.findMany({
|
||||
const submissions: SubmissionRecord[] = await prisma.submission.findMany({
|
||||
where: { assignmentId },
|
||||
orderBy: { submittedAt: "asc" },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user