You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
const express = require("express")
|
|
const router = express.Router()
|
|
|
|
const {logHeaderApi, eventNames} = require("../../rpdata/api/LogHeader")
|
|
const {charactersApi} = require("../../rpdata/api/Character")
|
|
const {channelApi} = require("../../rpdata/api/Channel")
|
|
|
|
const listTemplate = require("../../marko/page/logs/list.marko")
|
|
|
|
router.get("/", async(req, res) => {
|
|
const filter = {limit: 0}
|
|
|
|
if (req.query.characters) {
|
|
filter.characters = req.query.characters.split(",")
|
|
}
|
|
if (req.query.channels) {
|
|
filter.channels = req.query.channels.split(",")
|
|
}
|
|
if (req.query.events) {
|
|
filter.events = req.query.events.split(",")
|
|
}
|
|
if (req.query.search) {
|
|
filter.search = req.query.search
|
|
}
|
|
|
|
try {
|
|
res.markoAsync(listTemplate, {
|
|
filter: filter,
|
|
logs: logHeaderApi.list(filter),
|
|
characters: charactersApi.listHeaders(),
|
|
channels: channelApi.list(),
|
|
eventNames: logHeaderApi.eventNames(),
|
|
selected: {index: true},
|
|
})
|
|
} catch(err) {
|
|
console.error(err)
|
|
}
|
|
})
|
|
|
|
module.exports = router
|