feat(chat): add chat room management functionality

- Created new chat schema in the database.
- Implemented chat room model with necessary fields (title, ownerId, roomTypeId, etc.).
- Added room type model and rights model for chat functionality.
- Developed API endpoints for managing chat rooms, including create, edit, and delete operations.
- Integrated chat room management into the admin interface with a dedicated view and dialog for room creation/editing.
- Added internationalization support for chat room management UI.
- Implemented autocomplete for victim selection in underground activities.
- Enhanced the underground view with new activity types and political target selection.
This commit is contained in:
Torsten Schulz (local)
2025-08-11 23:31:25 +02:00
parent 6062570fe8
commit 23f698d8fd
26 changed files with 1564 additions and 866 deletions

View File

View File

@@ -0,0 +1,22 @@
import { DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
const ChatRight = sequelize.define('ChatRight', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
tr: {
type: DataTypes.STRING(32),
allowNull: false,
unique: true,
},
}, {
schema: 'chat',
tableName: 'rights',
timestamps: false,
underscored: true,
});
export default ChatRight;

View File

@@ -0,0 +1,69 @@
import { DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
const Room = sequelize.define('Room', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
title: {
type: DataTypes.TEXT,
allowNull: false,
},
ownerId: {
type: DataTypes.INTEGER,
allowNull: true, // kann null sein, wenn system-owned
},
roomTypeId: {
type: DataTypes.INTEGER,
allowNull: true,
},
isPublic: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
genderRestrictionId: {
type: DataTypes.INTEGER,
allowNull: true,
},
password: {
type: DataTypes.STRING,
allowNull: true,
},
minAge: {
type: DataTypes.INTEGER,
allowNull: true,
},
maxAge: {
type: DataTypes.INTEGER,
allowNull: true,
},
passwordHash: {
type: DataTypes.TEXT,
allowNull: true,
},
friendsOfOwnerOnly: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
requiredUserRightId: {
type: DataTypes.INTEGER,
allowNull: true,
},
}, {
schema: 'chat',
tableName: 'room',
timestamps: true,
underscored: true,
indexes: [
{
name: 'idx_chat_room_owner',
fields: ['owner_id'],
},
],
});
export default Room;

View File

@@ -0,0 +1,22 @@
import { DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
const RoomType = sequelize.define('RoomType', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
tr: {
type: DataTypes.STRING(32),
allowNull: false,
unique: true,
},
}, {
schema: 'chat',
tableName: 'room_type',
timestamps: false,
underscored: true,
});
export default RoomType;

View File

@@ -0,0 +1,41 @@
import { DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
const ChatUser = sequelize.define('ChatUser', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
comment: 'Verknüpfung zu community.falukant_user',
},
display_name: {
type: DataTypes.STRING(64),
allowNull: false,
},
color: {
type: DataTypes.STRING(16), // z.B. Hex-Code
allowNull: false,
defaultValue: '#000000',
},
show_gender: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
show_age: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
}, {
schema: 'chat',
tableName: 'user',
timestamps: true,
underscored: true,
});
export default ChatUser;

View File

@@ -0,0 +1,26 @@
import { DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
import ChatUser from './user.js';
import ChatRight from './rights.js';
const ChatUserRight = sequelize.define('ChatUserRight', {
chatUserId: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
references: null, // Assoziation wird separat gesetzt
},
chatRightId: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
references: null, // Assoziation wird separat gesetzt
},
}, {
schema: 'chat',
tableName: 'user_rights',
timestamps: false,
underscored: true,
});
export default ChatUserRight;