Add password reset localization and chat configuration

- Implemented German and English localization for password reset functionality.
- Added WebSocket URL resolution logic in chat services to support various environments and configurations.
- Created centralized chat configuration for event keys and payload mappings.
- Developed RoomsView component for admin chat room management, including create, edit, and delete functionalities.
This commit is contained in:
Torsten Schulz (local)
2025-08-18 07:44:56 +02:00
parent 23f698d8fd
commit 19ee6ba0a1
50 changed files with 3117 additions and 359 deletions

View File

@@ -1,12 +1,18 @@
import friendshipService from '../services/friendshipService.js';
import Joi from 'joi';
const friendshipController = {
async endFriendship(req, res) {
const schema = Joi.object({
friendUserId: Joi.string().required()
});
const { error, value } = schema.validate(req.body);
if (error) {
return res.status(400).json({ error: error.details[0].message });
}
try {
const { userid: hashedUserId } = req.headers;
const { friendUserId } = req.body;
await friendshipService.endFriendship(hashedUserId, friendUserId);
await friendshipService.endFriendship(hashedUserId, value.friendUserId);
res.status(200).json({ message: 'Friendship ended successfully' });
} catch (error) {
console.error('Error in endFriendship:', error);
@@ -15,11 +21,16 @@ const friendshipController = {
},
async acceptFriendship(req, res) {
const schema = Joi.object({
friendUserId: Joi.string().required()
});
const { error, value } = schema.validate(req.body);
if (error) {
return res.status(400).json({ error: error.details[0].message });
}
try {
const { userid: hashedUserId } = req.headers;
const { friendUserId } = req.body;
await friendshipService.acceptFriendship(hashedUserId, friendUserId);
await friendshipService.acceptFriendship(hashedUserId, value.friendUserId);
res.status(200).json({ message: 'Friendship accepted successfully' });
} catch (error) {
console.error('Error in acceptFriendship:', error);
@@ -28,11 +39,16 @@ const friendshipController = {
},
async rejectFriendship(req, res) {
const schema = Joi.object({
friendUserId: Joi.string().required()
});
const { error, value } = schema.validate(req.body);
if (error) {
return res.status(400).json({ error: error.details[0].message });
}
try {
const { userid: hashedUserId } = req.headers;
const { friendUserId } = req.body;
await friendshipService.rejectFriendship(hashedUserId, friendUserId);
await friendshipService.rejectFriendship(hashedUserId, value.friendUserId);
res.status(200).json({ message: 'Friendship rejected successfully' });
} catch (error) {
console.error('Error in rejectFriendship:', error);
@@ -41,10 +57,16 @@ const friendshipController = {
},
async withdrawRequest(req, res) {
const schema = Joi.object({
friendUserId: Joi.string().required()
});
const { error, value } = schema.validate(req.body);
if (error) {
return res.status(400).json({ error: error.details[0].message });
}
try {
const { userid: hashedUserId } = req.headers;
const { friendUserId } = req.body;
await friendshipService.withdrawRequest(hashedUserId, friendUserId);
await friendshipService.withdrawRequest(hashedUserId, value.friendUserId);
res.status(200).json({ message: 'Friendship request withdrawn successfully' });
} catch (error) {
console.error('Error in withdrawRequest:', error);