25 lines
547 B
TypeScript
25 lines
547 B
TypeScript
import type { RequestHandler } from 'express'
|
|
|
|
import * as configFunctions from '../../helpers/functions.config.js'
|
|
|
|
import { getLot } from '../../helpers/lotOccupancyDB/getLot.js'
|
|
|
|
export const handler: RequestHandler = (request, response) => {
|
|
const lot = getLot(request.params.lotId)
|
|
|
|
if (!lot) {
|
|
response.redirect(
|
|
configFunctions.getProperty('reverseProxy.urlPrefix') +
|
|
'/lots/?error=lotIdNotFound'
|
|
)
|
|
return
|
|
}
|
|
|
|
response.render('lot-view', {
|
|
headTitle: lot.lotName,
|
|
lot
|
|
})
|
|
}
|
|
|
|
export default handler
|