(request, response)
| 3 | import { getBanksData } from '@/services/banco-central'; |
| 4 | |
| 5 | const action = async (request, response) => { |
| 6 | const bankCode = Number(request.query.code); |
| 7 | |
| 8 | const allBanksData = await getBanksData(); |
| 9 | |
| 10 | const bankData = allBanksData.find(({ code }) => code === bankCode); |
| 11 | |
| 12 | if (!bankData) { |
| 13 | throw new NotFoundError({ |
| 14 | message: 'Código bancário não encontrado', |
| 15 | type: 'BANK_CODE_NOT_FOUND', |
| 16 | }); |
| 17 | } |
| 18 | |
| 19 | return response.status(200).json(bankData); |
| 20 | }; |
| 21 | |
| 22 | export default app().get(action); |
nothing calls this directly
no test coverage detected