41 lines
973 B
TypeScript
41 lines
973 B
TypeScript
/* eslint-disable @typescript-eslint/indent */
|
|
|
|
import type { Request, Response } from 'express'
|
|
|
|
import {
|
|
moveOccupancyTypePrintDown,
|
|
moveOccupancyTypePrintDownToBottom
|
|
} from '../../helpers/lotOccupancyDB/moveOccupancyTypePrintDown.js'
|
|
|
|
import {
|
|
getAllOccupancyTypeFields,
|
|
getOccupancyTypes
|
|
} from '../../helpers/functions.cache.js'
|
|
|
|
export async function handler(
|
|
request: Request,
|
|
response: Response
|
|
): Promise<void> {
|
|
const success =
|
|
request.body.moveToEnd === '1'
|
|
? await moveOccupancyTypePrintDownToBottom(
|
|
request.body.occupancyTypeId,
|
|
request.body.printEJS
|
|
)
|
|
: await moveOccupancyTypePrintDown(
|
|
request.body.occupancyTypeId,
|
|
request.body.printEJS
|
|
)
|
|
|
|
const occupancyTypes = await getOccupancyTypes()
|
|
const allOccupancyTypeFields = await getAllOccupancyTypeFields()
|
|
|
|
response.json({
|
|
success,
|
|
occupancyTypes,
|
|
allOccupancyTypeFields
|
|
})
|
|
}
|
|
|
|
export default handler
|