mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -66,6 +66,23 @@ exports.updateProfile = async (req, res) => {
|
||||
}
|
||||
};
|
||||
|
||||
// ─── PATCH preferred currency ──────────────────────────────────────────────────
|
||||
|
||||
exports.updateCurrency = async (req, res) => {
|
||||
try {
|
||||
const { currency } = req.body;
|
||||
if (!currency || typeof currency !== 'string' || currency.length !== 3)
|
||||
return R.error(res, 'A valid 3-letter ISO 4217 currency code is required.', 400);
|
||||
|
||||
const user = await mdl_Users.findByPk(req.user.user_id);
|
||||
await user.update({ preferred_currency: currency.toUpperCase() });
|
||||
return R.success(res, 'Currency preference updated.', { preferred_currency: user.preferred_currency });
|
||||
} catch (err) {
|
||||
console.error('[CLIENT] updateCurrency error:', err);
|
||||
return R.error(res, 'Could not update currency preference.', 500);
|
||||
}
|
||||
};
|
||||
|
||||
// ─── GET own sessions ──────────────────────────────────────────────────────────
|
||||
|
||||
exports.getSessions = async (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user