cityssm/attendance-tracking

View on GitHub
handlers/admin-post/doGetEmployeeProperties.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { Request, Response } from 'express'

import { getEmployeeProperties } from '../../database/getEmployeeProperties.js'
import type { EmployeeProperty } from '../../types/recordTypes.js'

export interface DoGetEmployeePropertiesResponse {
  employeeProperties: EmployeeProperty[]
}

export async function handler(
  request: Request,
  response: Response
): Promise<void> {
  const employeeProperties = await getEmployeeProperties(
    request.body.employeeNumber as string
  )

  const responseJson: DoGetEmployeePropertiesResponse = {
    employeeProperties
  }

  response.json(responseJson)
}

export default handler