cityssm/attendance-tracking

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

Summary

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

import {
  type GetUserPermissionsReturn,
  getUserPermissions
} from '../../database/getUserPermissions.js'

export interface DoGetUserPermissionsResponse {
  userPermissions: GetUserPermissionsReturn
}

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

  const responseJson: DoGetUserPermissionsResponse = {
    userPermissions
  }

  response.json(responseJson)
}

export default handler