mirror of
https://github.com/ZeroCatDev/ClassworksKV.git
synced 2025-07-02 04:39:23 +00:00
1
This commit is contained in:
parent
2d055f6400
commit
3ad77e6602
2
.github/workflows/docker-image.yml
vendored
2
.github/workflows/docker-image.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
sunwuyuan/homeworkpage
|
sunwuyuan/homeworkpage
|
||||||
ghcr.io/sunwuyuan/homeworkpage
|
ghcr.io/ClassworksDev/ClassworksServer
|
||||||
tags: |
|
tags: |
|
||||||
type=sha
|
type=sha
|
||||||
flavor: |
|
flavor: |
|
||||||
|
@ -6,7 +6,7 @@ const prisma = new PrismaClient();
|
|||||||
// 上传/更新作业数据
|
// 上传/更新作业数据
|
||||||
router.post("/:classId/homework", async (req, res) => {
|
router.post("/:classId/homework", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const date = new Date().toISOString().split("T")[0];
|
const date = req.query.date || new Date().toISOString().split("T")[0];
|
||||||
const data = req.body;
|
const data = req.body;
|
||||||
const className = req.params.classId;
|
const className = req.params.classId;
|
||||||
|
|
||||||
@ -71,17 +71,17 @@ router.get("/:classId/homework", async (req, res) => {
|
|||||||
router.get("/:classId/config", async (req, res) => {
|
router.get("/:classId/config", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const className = req.params.classId;
|
const className = req.params.classId;
|
||||||
|
|
||||||
const config = await prisma.config.findUnique({
|
const config = await prisma.config.findUnique({
|
||||||
where: {
|
where: {
|
||||||
class: className
|
class: className
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!config) {
|
if (!config) {
|
||||||
throw new Error("未找到配置信息");
|
throw new Error("未找到配置信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(config.value);
|
res.json(config.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Config error:", error);
|
console.error("Config error:", error);
|
||||||
@ -97,7 +97,7 @@ router.put("/:classId/config", async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const className = req.params.classId;
|
const className = req.params.classId;
|
||||||
const configValue = req.body;
|
const configValue = req.body;
|
||||||
|
|
||||||
await prisma.config.upsert({
|
await prisma.config.upsert({
|
||||||
where: {
|
where: {
|
||||||
class: className
|
class: className
|
||||||
|
Loading…
x
Reference in New Issue
Block a user