1
1
mirror of https://github.com/ZeroCatDev/ClassworksKV.git synced 2025-12-07 21:13:10 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Sunwuyuan
4ff64ad514
1.3.2 2025-11-15 20:40:07 +08:00
Sunwuyuan
a1deb5e6e3
feat: 更新设备列表接口,添加 namespace 字段;修改 token 设置名称的条件,支持家长类型 2025-11-15 20:40:00 +08:00
3 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ClassworksKV",
"version": "1.3.1",
"version": "1.3.2",
"private": true,
"scripts": {
"start": "node ./bin/www",

View File

@ -584,6 +584,7 @@ router.get("/devices", jwtAuth, async (req, res, next) => {
id: true,
uuid: true,
name: true,
namespace: true,
createdAt: true,
updatedAt: true,
},

View File

@ -287,8 +287,8 @@ router.post(
}
// 验证 token 类型是否为 student
if (appInstall.deviceType !== 'student') {
return next(errors.createError(403, "只有学生类型的 token 可以设置名称"));
if (!['student','parent'].includes(appInstall.deviceType)) {
return next(errors.createError(403, "只有学生和家长类型的 token 可以设置名称"));
}
// 读取设备的 classworks-list-main 键值
@ -326,7 +326,7 @@ router.post(
// 更新 AppInstall 的 note 字段
const updatedInstall = await prisma.appInstall.update({
where: { id: appInstall.id },
data: { note: name },
data: { note: appInstall.deviceType === 'parent' ? `${name} 家长` : name },
});
return res.json({