Files
yourpart3/backend/models/chat/room.js
Torsten Schulz (local) 1ab9407e79
All checks were successful
Deploy to production / deploy (push) Successful in 2m56s
Refactor code structure for improved readability and maintainability; optimize performance across multiple modules.
2026-07-21 09:08:15 +02:00

60 lines
1.5 KiB
JavaScript
Executable File

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},
isAdultOnly: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false},
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;