27 lines
569 B
TypeScript
27 lines
569 B
TypeScript
import type { Request, Response } from 'express'
|
|
|
|
import addLotTypeField, {
|
|
type AddLotTypeFieldForm
|
|
} from '../../database/addLotTypeField.js'
|
|
import { getLotTypes } from '../../helpers/functions.cache.js'
|
|
|
|
export async function handler(
|
|
request: Request,
|
|
response: Response
|
|
): Promise<void> {
|
|
const lotTypeFieldId = await addLotTypeField(
|
|
request.body as AddLotTypeFieldForm,
|
|
request.session.user as User
|
|
)
|
|
|
|
const lotTypes = await getLotTypes()
|
|
|
|
response.json({
|
|
success: true,
|
|
lotTypeFieldId,
|
|
lotTypes
|
|
})
|
|
}
|
|
|
|
export default handler
|