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
+13 -7
View File
@@ -13,7 +13,7 @@ router.get('/', async (req, res) => {
if (keyword) {
where[Op.or] = [
{ name: { [Op.like]: `%${keyword}%` } },
{ description: { [Op.like]: `%${keyword}%` } }
{ description: { [Op.like]: `%${keyword}%` } },
];
}
@@ -23,9 +23,12 @@ router.get('/', async (req, res) => {
const { count, rows } = await ConsumableCategory.findAndCountAll({
where,
order: [['sortOrder', 'ASC'], ['id', 'DESC']],
order: [
['sortOrder', 'ASC'],
['id', 'DESC'],
],
offset,
limit: parseInt(pageSize)
limit: parseInt(pageSize),
});
res.json({
@@ -33,7 +36,7 @@ router.get('/', async (req, res) => {
total: count,
currentPage: parseInt(page),
pageSize: parseInt(pageSize),
totalPages: Math.ceil(count / pageSize)
totalPages: Math.ceil(count / pageSize),
});
} catch (error) {
res.status(500).json({ error: error.message });
@@ -44,7 +47,10 @@ router.get('/list', async (req, res) => {
try {
const categories = await ConsumableCategory.findAll({
where: { status: 'active' },
order: [['sortOrder', 'ASC'], ['name', 'ASC']]
order: [
['sortOrder', 'ASC'],
['name', 'ASC'],
],
});
res.json(categories);
} catch (error) {
@@ -77,7 +83,7 @@ router.post('/', async (req, res) => {
name,
description,
sortOrder: sortOrder || 0,
status: status || 'active'
status: status || 'active',
});
res.status(201).json(category);
@@ -106,7 +112,7 @@ router.put('/:id', async (req, res) => {
name: name || category.name,
description: description !== undefined ? description : category.description,
sortOrder: sortOrder !== undefined ? sortOrder : category.sortOrder,
status: status || category.status
status: status || category.status,
});
res.json(category);