25 lines
585 B
TypeScript
25 lines
585 B
TypeScript
import type { RequestHandler } from 'express'
|
|
|
|
import {
|
|
moveLotTypeFieldDown,
|
|
moveLotTypeFieldDownToBottom
|
|
} from '../../helpers/lotOccupancyDB/moveLotTypeField.js'
|
|
|
|
import { getLotTypes } from '../../helpers/functions.cache.js'
|
|
|
|
export const handler: RequestHandler = (request, response) => {
|
|
const success =
|
|
request.body.moveToEnd === '1'
|
|
? moveLotTypeFieldDownToBottom(request.body.lotTypeFieldId)
|
|
: moveLotTypeFieldDown(request.body.lotTypeFieldId)
|
|
|
|
const lotTypes = getLotTypes()
|
|
|
|
response.json({
|
|
success,
|
|
lotTypes
|
|
})
|
|
}
|
|
|
|
export default handler
|