update project
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import { Request, Response } from 'express';
|
||||
import { UserModel } from '../models/user.model';
|
||||
import { WalletModel } from '../models/wallet.model';
|
||||
|
||||
export const WalletController = {
|
||||
async getWallets(req: Request, res: Response) {
|
||||
try {
|
||||
const wallets = await WalletModel.findByUserId(req.auth!.userId);
|
||||
const user = await UserModel.findByBitokUserId(req.user!.bitokUserId);
|
||||
if (!user) {
|
||||
res.status(404).json({ success: false, error: 'User not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
const wallets = await WalletModel.findByUserId(user.id);
|
||||
res.json({
|
||||
success: true,
|
||||
data: wallets.map((w) => ({
|
||||
|
||||
Reference in New Issue
Block a user