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.
37 lines
917 B
37 lines
917 B
const express = require("express")
|
|
const router = express.Router()
|
|
|
|
const {logHeaderApi, eventNames} = require("../../rpdata/api/LogHeader")
|
|
const {charactersApi} = require("../../rpdata/api/Character")
|
|
|
|
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(),
|
|
selected: {index: true},
|
|
})
|
|
} catch(err) {
|
|
console.error(err)
|
|
}
|
|
})
|
|
|
|
module.exports = router
|