imageFilenames and imageFilename, backend integration tests, frontend tests, removed username references
This commit is contained in:
@@ -211,8 +211,8 @@ router.post('/profile/image', authenticateToken, (req, res) => {
|
||||
try {
|
||||
// Delete old profile image if exists
|
||||
const user = await User.findByPk(req.user.id);
|
||||
if (user.profileImage) {
|
||||
const oldImagePath = path.join(__dirname, '../uploads/profiles', user.profileImage);
|
||||
if (user.imageFilename) {
|
||||
const oldImagePath = path.join(__dirname, '../uploads/profiles', user.imageFilename);
|
||||
try {
|
||||
await fs.unlink(oldImagePath);
|
||||
} catch (unlinkErr) {
|
||||
@@ -227,7 +227,7 @@ router.post('/profile/image', authenticateToken, (req, res) => {
|
||||
|
||||
// Update user with new image filename
|
||||
await user.update({
|
||||
profileImage: req.file.filename
|
||||
imageFilename: req.file.filename
|
||||
});
|
||||
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
|
||||
Reference in New Issue
Block a user