()
| 124 | }; |
| 125 | |
| 126 | export const getPayoutMethods = async () => { |
| 127 | const session = await getServerSession(authOptions); |
| 128 | |
| 129 | if (!session || !session.user.id) { |
| 130 | throw new Error('Unauthorized'); |
| 131 | } |
| 132 | try { |
| 133 | const upiIds = await db.upiId.findMany({ |
| 134 | where: { |
| 135 | userId: session.user.id, |
| 136 | }, |
| 137 | }); |
| 138 | const solanaAddresses = await db.solanaAddress.findMany({ |
| 139 | where: { |
| 140 | userId: session.user.id, |
| 141 | }, |
| 142 | }); |
| 143 | |
| 144 | if (!upiIds || !solanaAddresses) { |
| 145 | return { error: 'Failed to fetch payout methods' }; |
| 146 | } |
| 147 | |
| 148 | return { upiIds, solanaAddresses }; |
| 149 | } catch (error) { |
| 150 | console.error(error); |
| 151 | return { error: 'Failed to fetch payout methods' }; |
| 152 | } |
| 153 | }; |
| 154 | const deleteUpiHandler = async ( |
| 155 | data: DeleteTypePayoutMethod, |
| 156 | ): Promise<ReturnTypePayoutMethodDelete> => { |
no outgoing calls
no test coverage detected