refactor: 统一代码风格并迁移至 ESLint 新配置

style(backend): 格式化模型文件代码
style(frontend): 调整组件代码格式
chore: 删除旧 ESLint 配置并添加新配置
refactor(backend): 重构模型定义语法
style: 统一箭头函数和对象属性简写
This commit is contained in:
zhang1106
2026-03-27 19:12:16 +08:00
parent 6a8d4144ff
commit 63f0cb570e
166 changed files with 15483 additions and 11170 deletions
+7 -7
View File
@@ -15,12 +15,12 @@ router.get('/', async (req, res) => {
const { count, rows } = await Room.findAndCountAll({
include: [{ model: Rack, attributes: ['rackId', 'name'] }],
offset: offset,
limit: pageSize
limit: pageSize,
});
res.json({
rooms: rows,
total: count
total: count,
});
} catch (error) {
res.status(500).json({ error: error.message });
@@ -31,7 +31,7 @@ router.get('/', async (req, res) => {
router.get('/:roomId', async (req, res) => {
try {
const room = await Room.findByPk(req.params.roomId, {
include: Rack
include: Rack,
});
if (!room) {
return res.status(404).json({ error: '机房不存在' });
@@ -56,7 +56,7 @@ router.post('/', async (req, res) => {
router.put('/:roomId', validateBody(updateRoomSchema), async (req, res) => {
try {
const [updated] = await Room.update(req.body, {
where: { roomId: req.params.roomId }
where: { roomId: req.params.roomId },
});
if (updated) {
const updatedRoom = await Room.findByPk(req.params.roomId);
@@ -77,9 +77,9 @@ router.delete('/:roomId', async (req, res) => {
if (racks.length > 0) {
return res.status(400).json({ error: '该机房下有机柜,无法删除' });
}
const deleted = await Room.destroy({
where: { roomId: req.params.roomId }
where: { roomId: req.params.roomId },
});
if (deleted) {
res.status(204).json();
@@ -91,4 +91,4 @@ router.delete('/:roomId', async (req, res) => {
}
});
module.exports = router;
module.exports = router;