fix: /summary 和 /by-type 接口补上权限过滤(之前遗漏)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-02 16:54:29 +08:00
parent 143c1a57bb
commit 441f574238

View File

@@ -509,7 +509,7 @@ async function getWeeklyStats(): Promise<WeeklyStats> {
// GET /api/vehicles/summary // GET /api/vehicles/summary
app.get('/summary', async (c) => { app.get('/summary', async (c) => {
const [vehicles, weekly] = await Promise.all([getVehicles(), getWeeklyStats()]); const [vehicles, weekly] = await Promise.all([getVehiclesForUser(c), getWeeklyStats()]);
const summary: SummaryData = { const summary: SummaryData = {
totalAssets: vehicles.length, totalAssets: vehicles.length,
operating: { operating: {
@@ -536,7 +536,7 @@ app.get('/summary', async (c) => {
// GET /api/vehicles/by-type // GET /api/vehicles/by-type
app.get('/by-type', async (c) => { app.get('/by-type', async (c) => {
const [vehicles, weeklyIds] = await Promise.all([getVehicles(), getWeeklyTruckIds()]); const [vehicles, weeklyIds] = await Promise.all([getVehiclesForUser(c), getWeeklyTruckIds()]);
const typeFilters = [ const typeFilters = [
{ name: '4.5T普货', filter: (v: Vehicle) => v.type === '4.5T' && !v.model.includes('冷链') }, { name: '4.5T普货', filter: (v: Vehicle) => v.type === '4.5T' && !v.model.includes('冷链') },