Files
yourpart3/backend/models/falukant/data/child_relation.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

61 lines
1.5 KiB
JavaScript
Executable File

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class ChildRelation extends Model {}
ChildRelation.init(
{
fatherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false},
motherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false},
childCharacterId: {
type: DataTypes.INTEGER,
allowNull: false},
fatherName: {
type: DataTypes.STRING,
allowNull: false},
motherName: {
type: DataTypes.STRING,
allowNull: false},
nameSet: {
type: DataTypes.BOOLEAN,
allowNull: false,
default: false},
isHeir: {
type: DataTypes.BOOLEAN,
allowNull: true,
default: false},
legitimacy: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'legitimate',
validate: {
isIn: [['legitimate', 'acknowledged_bastard', 'hidden_bastard']]
}},
birthContext: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'marriage',
validate: {
isIn: [['marriage', 'lover']]
}},
publicKnown: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false}
},
{
sequelize,
modelName: 'ChildRelation',
tableName: 'child_relation', // exakter Tabellenname
schema: 'falukant_data', // exaktes Schema
// keine Pluralisierung
timestamps: true,
underscored: true}
);
export default ChildRelation;