feat: add account metadata and interest analytics

This commit is contained in:
2026-08-20 08:40:03 +03:00
parent f8e4f86a6d
commit 6550e2057c
15 changed files with 152 additions and 24 deletions

View File

@@ -21,7 +21,7 @@ router.put(
return;
}
const { alias } = req.body;
const { alias, accountType, status } = req.body;
if (typeof alias !== 'string' || !alias.trim()) {
res.status(400).json({ error: 'BAD_REQUEST', message: 'alias is required and must be non-empty' });
return;
@@ -30,8 +30,21 @@ router.put(
res.status(400).json({ error: 'BAD_REQUEST', message: 'alias must be at most 50 characters' });
return;
}
if (accountType !== undefined && accountType !== null && !['brokerage', 'iis', 'savings', 'current'].includes(accountType)) {
res.status(400).json({ error: 'BAD_REQUEST', message: 'Invalid accountType' });
return;
}
if (status !== undefined && !['active', 'closed'].includes(status)) {
res.status(400).json({ error: 'BAD_REQUEST', message: 'Invalid status' });
return;
}
const result = await accountService.updateAccountAlias(id, alias.trim());
const result = await accountService.updateAccount(
id,
alias.trim(),
accountType,
status,
);
if (!result) {
res.status(404).json({ error: 'NOT_FOUND', message: 'Account not found' });
return;