30 lines
822 B
JavaScript
30 lines
822 B
JavaScript
import { Router } from 'express'
|
|
import { prisma } from '../db.js'
|
|
import { authRequired } from '../middleware.js'
|
|
|
|
const router = Router()
|
|
|
|
router.use(authRequired)
|
|
|
|
router.get('/indicators', async (_req, res, next) => {
|
|
try {
|
|
const rows = await prisma.indicator.findMany({ orderBy: [{ groupName: 'asc' }, { name: 'asc' }] })
|
|
res.json({ indicators: rows })
|
|
} catch (e) { next(e) }
|
|
})
|
|
|
|
router.get('/strategies', async (_req, res, next) => {
|
|
try {
|
|
const rows = await prisma.strategy.findMany({ orderBy: { name: 'asc' } })
|
|
res.json({ strategies: rows })
|
|
} catch (e) { next(e) }
|
|
})
|
|
|
|
router.get('/sow', async (_req, res, next) => {
|
|
try {
|
|
const rows = await prisma.econ_SowInventory.findMany({ orderBy: { month: 'asc' } })
|
|
res.json({ rows })
|
|
} catch (e) { next(e) }
|
|
})
|
|
|
|
export default router |