diff --git a/routes/accounts.js b/routes/accounts.js index dedc4ac..505546a 100644 --- a/routes/accounts.js +++ b/routes/accounts.js @@ -584,6 +584,7 @@ router.get("/devices", jwtAuth, async (req, res, next) => { id: true, uuid: true, name: true, + namespace: true, createdAt: true, updatedAt: true, }, diff --git a/routes/apps.js b/routes/apps.js index 62f892b..f6a6465 100644 --- a/routes/apps.js +++ b/routes/apps.js @@ -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({