feat: Einführung von Umgebungsvariablen und Startskripten für die Backend-Anwendung

- Hinzufügen eines zentralen Skripts zum Laden von Umgebungsvariablen aus einer .env-Datei.
- Implementierung von Start- und Entwicklungs-Skripten in der package.json für eine vereinfachte Ausführung der Anwendung.
- Bereinigung und Entfernung nicht mehr benötigter Minigame-Modelle und -Services zur Verbesserung der Codebasis.
- Anpassungen an den Datenbankmodellen zur Unterstützung von neuen Assoziationen und zur Verbesserung der Lesbarkeit.
This commit is contained in:
Torsten Schulz (local)
2025-08-23 22:27:19 +02:00
parent 66818cc728
commit 6da849ca3c
128 changed files with 1054 additions and 1611 deletions

20
backend/config/loadEnv.js Normal file
View File

@@ -0,0 +1,20 @@
// Centralized environment loader
import path from 'path';
import { fileURLToPath } from 'url';
import dotenv from 'dotenv';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Resolve backend/.env regardless of cwd
const envPath = path.resolve(__dirname, '../.env');
const result = dotenv.config({ path: envPath });
if (result.error) {
console.warn('[env] Konnte .env nicht laden:', result.error.message);
} else {
if (!process.env.SECRET_KEY) {
console.warn('[env] SECRET_KEY nicht gesetzt in .env');
}
}
export {};

View File

@@ -1,32 +0,0 @@
import MinigamesService from '../services/minigamesService.js';
function extractHashedUserId(req) {
return req.headers?.userid;
}
class MinigamesController {
constructor() {
this.service = MinigamesService;
this.listCampaigns = this._wrap((userId, req) => this.service.listCampaigns());
this.getCampaign = this._wrap((userId, req) => this.service.getCampaign(req.params.code));
this.getProgress = this._wrap((userId, req) => this.service.getProgress(userId, req.params.code));
this.saveProgress = this._wrap((userId, req) => this.service.saveProgress(userId, req.params.code, req.body));
}
_wrap(fn, { successStatus = 200 } = {}) {
return async (req, res) => {
try {
const userId = extractHashedUserId(req);
if (!userId) return res.status(400).json({ error: 'Missing user identifier' });
const result = await fn(userId, req, res);
res.status(successStatus).json(result);
} catch (error) {
console.error('Minigames controller error:', error);
res.status(500).json({ error: error.message || 'Internal error' });
}
};
}
}
export default new MinigamesController();

View File

@@ -97,30 +97,15 @@ import Underground from './falukant/data/underground.js';
import UndergroundType from './falukant/type/underground.js';
import Blog from './community/blog.js';
import BlogPost from './community/blog_post.js';
import MinigameCampaign from './service/minigame_campaign.js';
import MinigameCampaignLevel from './service/minigame_campaign_level.js';
import MinigameUserProgress from './service/minigame_user_progress.js';
// Match3 Models
import Match3Campaign from './match3/campaign.js';
import Campaign from './match3/campaign.js';
import Match3Level from './match3/level.js';
import Match3Objective from './match3/objective.js';
import Match3UserProgress from './match3/userProgress.js';
import Match3UserLevelProgress from './match3/userLevelProgress.js';
import Match3TileType from './match3/tileType.js';
import Match3LevelTileType from './match3/levelTileType.js';
import Objective from './match3/objective.js';
import UserProgress from './match3/userProgress.js';
import UserLevelProgress from './match3/userLevelProgress.js';
export default function setupAssociations() {
// RoomType 1:n Room
RoomType.hasMany(Room, { foreignKey: 'roomTypeId', as: 'rooms' });
// Minigames associations
MinigameCampaign.hasMany(MinigameCampaignLevel, { foreignKey: 'campaign_id', as: 'levels' });
MinigameCampaignLevel.belongsTo(MinigameCampaign, { foreignKey: 'campaign_id', as: 'campaign' });
User.hasMany(MinigameUserProgress, { foreignKey: 'user_id', as: 'minigameProgress' });
MinigameUserProgress.belongsTo(User, { foreignKey: 'user_id', as: 'user' });
MinigameCampaign.hasMany(MinigameUserProgress, { foreignKey: 'campaign_id', as: 'userProgress' });
MinigameUserProgress.belongsTo(MinigameCampaign, { foreignKey: 'campaign_id', as: 'campaign' });
Room.belongsTo(RoomType, { foreignKey: 'roomTypeId', as: 'roomType' });
// ChatUser <-> ChatRight n:m
ChatUser.belongsToMany(ChatRight, {
@@ -789,77 +774,16 @@ export default function setupAssociations() {
BlogPost.belongsTo(User, { foreignKey: 'user_id', as: 'author' });
User.hasMany(BlogPost, { foreignKey: 'user_id', as: 'blogPosts' });
// Match3 associations
Match3Campaign.hasMany(Match3Level, {
foreignKey: 'campaignId',
as: 'levels'
});
Match3Level.belongsTo(Match3Campaign, {
foreignKey: 'campaignId',
as: 'campaign'
});
Match3Level.hasMany(Match3Objective, {
foreignKey: 'levelId',
as: 'objectives'
});
Match3Objective.belongsTo(Match3Level, {
foreignKey: 'levelId',
as: 'level'
});
Match3Campaign.hasMany(Match3UserProgress, {
foreignKey: 'campaignId',
as: 'userProgress'
});
Match3UserProgress.belongsTo(Match3Campaign, {
foreignKey: 'campaignId',
as: 'campaign'
});
User.hasMany(Match3UserProgress, {
foreignKey: 'userId',
as: 'match3Progress'
});
Match3UserProgress.belongsTo(User, {
foreignKey: 'userId',
as: 'user'
});
Match3UserProgress.hasMany(Match3UserLevelProgress, {
foreignKey: 'userProgressId',
as: 'levelProgress'
});
Match3UserLevelProgress.belongsTo(Match3UserProgress, {
foreignKey: 'userProgressId',
as: 'userProgress'
});
Match3Level.hasMany(Match3UserLevelProgress, {
foreignKey: 'levelId',
as: 'userProgress'
});
Match3UserLevelProgress.belongsTo(Match3Level, {
foreignKey: 'levelId',
as: 'level'
});
// Match3 Tile Type associations
Match3Level.hasMany(Match3LevelTileType, {
foreignKey: 'levelId',
as: 'levelTileTypes'
});
Match3LevelTileType.belongsTo(Match3Level, {
foreignKey: 'levelId',
as: 'level'
});
Match3TileType.hasMany(Match3LevelTileType, {
foreignKey: 'tileTypeId',
as: 'levelTileTypes'
});
Match3LevelTileType.belongsTo(Match3TileType, {
foreignKey: 'tileTypeId',
as: 'tileType'
});
// Match3 Campaign & Levels
Campaign.hasMany(Match3Level, { foreignKey: 'campaignId', as: 'levels' });
Match3Level.belongsTo(Campaign, { foreignKey: 'campaignId', as: 'campaign' });
Match3Level.hasMany(Objective, { foreignKey: 'levelId', as: 'objectives' });
Objective.belongsTo(Match3Level, { foreignKey: 'levelId', as: 'level' });
// User progress tracking
Campaign.hasMany(UserProgress, { foreignKey: 'campaignId', as: 'userProgressEntries' });
UserProgress.belongsTo(Campaign, { foreignKey: 'campaignId', as: 'campaign' });
UserProgress.hasMany(UserLevelProgress, { foreignKey: 'userProgressId', as: 'levelProgress' });
UserLevelProgress.belongsTo(UserProgress, { foreignKey: 'userProgressId', as: 'userProgress' });
Match3Level.hasMany(UserLevelProgress, { foreignKey: 'levelId', as: 'userLevelProgress' });
UserLevelProgress.belongsTo(Match3Level, { foreignKey: 'levelId', as: 'level' });
}

View File

@@ -5,19 +5,14 @@ const ChatRight = sequelize.define('ChatRight', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
autoIncrement: true},
tr: {
type: DataTypes.STRING(32),
allowNull: false,
unique: true,
},
}, {
unique: true}}, {
schema: 'chat',
tableName: 'rights',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default ChatRight;

View File

@@ -5,55 +5,43 @@ const Room = sequelize.define('Room', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
autoIncrement: true},
title: {
type: DataTypes.TEXT,
allowNull: false,
},
owner_id: {
allowNull: false},
ownerId: {
type: DataTypes.INTEGER,
allowNull: true, // kann null sein, wenn system-owned
},
room_type_id: {
roomTypeId: {
type: DataTypes.INTEGER,
allowNull: true,
},
is_public: {
allowNull: true},
isPublic: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
gender_restriction_id: {
defaultValue: true},
genderRestrictionId: {
type: DataTypes.INTEGER,
allowNull: true,
},
allowNull: true},
password: {
type: DataTypes.STRING,
allowNull: true,
},
min_age: {
allowNull: true},
minAge: {
type: DataTypes.INTEGER,
allowNull: true,
},
max_age: {
allowNull: true},
maxAge: {
type: DataTypes.INTEGER,
allowNull: true,
},
password_hash: {
allowNull: true},
passwordHash: {
type: DataTypes.TEXT,
allowNull: true,
},
friends_of_owner_only: {
allowNull: true},
friendsOfOwnerOnly: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
required_user_right_id: {
defaultValue: false},
requiredUserRightId: {
type: DataTypes.INTEGER,
allowNull: true,
},
}, {
allowNull: true}}, {
schema: 'chat',
tableName: 'room',
timestamps: true,
@@ -61,10 +49,7 @@ const Room = sequelize.define('Room', {
indexes: [
{
name: 'idx_chat_room_owner',
fields: ['owner_id'],
,
freezeTableName: true},
],
});
fields: ['ownerId']},
]});
export default Room;

View File

@@ -5,19 +5,14 @@ const RoomType = sequelize.define('RoomType', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
autoIncrement: true},
tr: {
type: DataTypes.STRING(32),
allowNull: false,
unique: true,
},
}, {
unique: true}}, {
schema: 'chat',
tableName: 'room_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default RoomType;

View File

@@ -5,38 +5,29 @@ const ChatUser = sequelize.define('ChatUser', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
falukant_user_id: {
autoIncrement: true},
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
comment: 'Verknüpfung zu community.falukant_user',
},
display_name: {
comment: 'Verknüpfung zu community.falukant_user'},
displayName: {
type: DataTypes.STRING(64),
allowNull: false,
},
allowNull: false},
color: {
type: DataTypes.STRING(16), // z.B. Hex-Code
allowNull: false,
defaultValue: '#000000',
},
show_gender: {
defaultValue: '#000000'},
showGender: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
show_age: {
defaultValue: true},
showAge: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
}, {
defaultValue: true}}, {
schema: 'chat',
tableName: 'user',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default ChatUser;

View File

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

View File

@@ -4,31 +4,28 @@ import { sequelize } from '../../utils/sequelize.js';
class Blog extends Model {}
Blog.init({
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'user_id'
},
title: {
type: DataTypes.STRING(255),
allowNull: false,
},
allowNull: false},
description: {
type: DataTypes.TEXT,
allowNull: true,
},
allowNull: true},
// 'public' or 'logged_in'
visibility: {
type: DataTypes.STRING(20),
allowNull: false,
defaultValue: 'public',
},
age_min: {
defaultValue: 'public'},
ageMin: {
type: DataTypes.INTEGER,
allowNull: true,
field: 'age_min'
},
age_max: {
ageMax: {
type: DataTypes.INTEGER,
allowNull: true,
field: 'age_max'
@@ -36,14 +33,13 @@ Blog.init({
// 'm' | 'f' | null; comma-separated for future-proofing (e.g., 'm,f')
genders: {
type: DataTypes.STRING(10),
allowNull: true,
},
created_at: {
allowNull: true},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'created_at'
},
updated_at: {
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'updated_at'
@@ -54,8 +50,6 @@ Blog.init({
tableName: 'blog',
schema: 'community',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Blog;

View File

@@ -4,30 +4,28 @@ import { sequelize } from '../../utils/sequelize.js';
class BlogPost extends Model {}
BlogPost.init({
blog_id: {
blogId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'blog_id'
},
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'user_id'
},
title: {
type: DataTypes.STRING(255),
allowNull: false,
},
allowNull: false},
content: {
type: DataTypes.TEXT,
allowNull: false,
},
created_at: {
allowNull: false},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'created_at'
},
updated_at: {
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'updated_at'
@@ -38,8 +36,6 @@ BlogPost.init({
tableName: 'blog_post',
schema: 'community',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default BlogPost;

View File

@@ -4,30 +4,24 @@ import { sequelize } from '../../utils/sequelize.js';
class Diary extends Model { }
Diary.init({
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
text: {
type: DataTypes.TEXT,
allowNull: false,
},
created_at: {
allowNull: false},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
},
updated_at: {
defaultValue: DataTypes.NOW},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
}
defaultValue: DataTypes.NOW}
}, {
sequelize,
modelName: 'Diary',
tableName: 'diary',
schema: 'community',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Diary;

View File

@@ -4,34 +4,26 @@ import { sequelize } from '../../utils/sequelize.js';
class DiaryHistory extends Model { }
DiaryHistory.init({
diary_id: {
diaryId: {
type: DataTypes.INTEGER,
allowNull: false,
},
user_id: {
allowNull: false},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
},
old_text: {
allowNull: false},
oldText: {
type: DataTypes.TEXT,
allowNull: false,
},
old_created_at: {
allowNull: false},
oldCreatedAt: {
type: DataTypes.DATE,
allowNull: false,
},
old_updated_at: {
allowNull: false},
oldUpdatedAt: {
type: DataTypes.DATE,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'DiaryHistory',
tableName: 'diary_history',
schema: 'community',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default DiaryHistory;

View File

@@ -5,30 +5,22 @@ import UserParamVisibilityType from '../type/user_param_visibility.js';
const Folder = sequelize.define('folder', {
name: {
type: DataTypes.STRING,
allowNull: false,
},
parent_id: {
allowNull: false},
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'folder',
key: 'id',
},
},
user_id: {
key: 'id'}},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'user',
key: 'id',
},
},
}, {
key: 'id'}}}, {
tableName: 'folder',
schema: 'community',
underscored: true,
timestamps: true,
,
freezeTableName: true});
timestamps: true});
export default Folder;

View File

@@ -8,7 +8,7 @@ const FolderImageVisibility = sequelize.define('folder_image_visibility', {
primaryKey: true,
allowNull: false
},
folder_id: {
folderId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const FolderImageVisibility = sequelize.define('folder_image_visibility', {
key: 'id'
}
},
visibility_type_id: {
visibilityTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -31,8 +31,6 @@ const FolderImageVisibility = sequelize.define('folder_image_visibility', {
tableName: 'folder_image_visibility',
schema: 'community',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FolderImageVisibility;

View File

@@ -8,7 +8,7 @@ const FolderVisibilityUser = sequelize.define('folder_visibility_user', {
primaryKey: true,
allowNull: false
},
folder_id: {
folderId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const FolderVisibilityUser = sequelize.define('folder_visibility_user', {
key: 'id'
}
},
visibility_user_id: {
visibilityUserId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -28,8 +28,6 @@ const FolderVisibilityUser = sequelize.define('folder_visibility_user', {
tableName: 'folder_visibility_user',
schema: 'community',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FolderVisibilityUser;

View File

@@ -31,8 +31,6 @@ const Friendship = sequelize.define('friendship', {
tableName: 'friendship',
schema: 'community',
underscored: true,
timestamps: true,
,
freezeTableName: true});
timestamps: true});
export default Friendship;

View File

@@ -7,9 +7,8 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
allowNull: false,
},
recipient_id: {
allowNull: false},
recipientId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -17,7 +16,7 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
key: 'id'
}
},
sender_id: {
senderId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -25,24 +24,18 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
key: 'id'
}
},
sender_username: {
senderUsername: {
type: DataTypes.STRING,
allowNull: true,
},
content_html: {
allowNull: true},
contentHtml: {
type: DataTypes.TEXT,
allowNull: false,
},
image_url: {
allowNull: false},
imageUrl: {
type: DataTypes.STRING,
allowNull: true,
},
}, {
allowNull: true}}, {
tableName: 'guestbook_entry',
schema: 'community',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default GuestbookEntry;

View File

@@ -5,43 +5,32 @@ import UserParamVisibilityType from '../type/user_param_visibility.js';
const Image = sequelize.define('image', {
title: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
description: {
type: DataTypes.TEXT,
allowNull: true,
},
original_file_name: {
allowNull: true},
originalFileName: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
hash: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
folder_id: {
unique: true},
folderId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'folder',
key: 'id',
},
},
user_id: {
key: 'id'}},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'user',
key: 'id',
},
},
}, {
key: 'id'}}}, {
tableName: 'image',
schema: 'community',
underscored: true,
timestamps: true,
,
freezeTableName: true});
timestamps: true});
export default Image;

View File

@@ -8,7 +8,7 @@ const ImageImageVisibility = sequelize.define('image_image_visibility', {
primaryKey: true,
allowNull: false
},
image_id: {
imageId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const ImageImageVisibility = sequelize.define('image_image_visibility', {
key: 'id'
}
},
visibility_type_id: {
visibilityTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -31,8 +31,6 @@ const ImageImageVisibility = sequelize.define('image_image_visibility', {
tableName: 'image_image_visibility',
schema: 'community',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default ImageImageVisibility;

View File

@@ -8,11 +8,11 @@ const ImageVisibilityUser = sequelize.define('image_visibility_user', {
primaryKey: true,
allowNull: false
},
image_id: {
imageId: {
type: DataTypes.INTEGER,
allowNull: false
},
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -21,7 +21,6 @@ const ImageVisibilityUser = sequelize.define('image_visibility_user', {
timestamps: false,
underscored: true,
schema: 'community'
,
freezeTableName: true});
});
export default ImageVisibilityUser;

View File

@@ -6,7 +6,6 @@ const interest = sequelize.define('interest_type', {
tableName: 'interest',
schema: 'community',
underscored: true
,
freezeTableName: true});
});
export default interest;

View File

@@ -36,7 +36,7 @@ const User = sequelize.define('user', {
type: DataTypes.STRING,
allowNull: false,
},
registration_date: {
registrationDate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
@@ -45,11 +45,11 @@ const User = sequelize.define('user', {
type: DataTypes.BOOLEAN,
defaultValue: false
},
reset_token: {
resetToken: {
type: DataTypes.UUID,
allowNull: true
},
hashed_id: {
hashedId: {
type: DataTypes.STRING,
allowNull: true
},
@@ -57,7 +57,7 @@ const User = sequelize.define('user', {
type: DataTypes.BOOLEAN,
defaultValue: true
},
auth_code: {
authCode: {
type: DataTypes.STRING,
allowNull: true
}
@@ -70,8 +70,7 @@ const User = sequelize.define('user', {
const hashedId = crypto.createHash('sha256').update(user.id.toString()).digest('hex');
user.hashedId = hashedId;
await user.save();
,
freezeTableName: true}
},
}
});

View File

@@ -5,7 +5,7 @@ import UserParamType from '../type/user_param.js';
import { encrypt, decrypt } from '../../utils/encryption.js';
const UserParam = sequelize.define('user_param', {
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -13,7 +13,7 @@ const UserParam = sequelize.define('user_param', {
key: 'id',
},
},
param_type_id: {
paramTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -54,9 +54,8 @@ const UserParam = sequelize.define('user_param', {
indexes: [
{
unique: true,
fields: ['user_id', 'param_type_id'],
,
freezeTableName: true},
fields: ['userId', 'paramTypeId'],
}
],
});

View File

@@ -8,7 +8,7 @@ const UserParamVisibility = sequelize.define('user_param_visibility', {
primaryKey: true,
allowNull: false
},
param_id: {
paramId: {
type: DataTypes.INTEGER,
allowNull: false
},
@@ -21,7 +21,6 @@ const UserParamVisibility = sequelize.define('user_param_visibility', {
timestamps: false,
underscored: true,
schema: 'community'
,
freezeTableName: true});
});
export default UserParamVisibility;

View File

@@ -4,7 +4,7 @@ import User from './user.js';
import UserRightType from '../type/user_right.js';
const UserRight = sequelize.define('user_right', {
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -12,19 +12,16 @@ const UserRight = sequelize.define('user_right', {
key: 'id'
}
},
right_type_id: {
rightTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: UserRightType,
key: 'id'
}
},
}, {
}}, {
tableName: 'user_right',
schema: 'community',
underscored: true,
,
freezeTableName: true});
underscored: true});
export default UserRight;

View File

@@ -4,19 +4,15 @@ import { sequelize } from '../../../utils/sequelize.js';
class Branch extends Model { }
Branch.init({
branch_type_id: {
branchTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_id: {
allowNull: false},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
falukant_user_id: {
allowNull: false},
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Branch',
tableName: 'branch',
@@ -26,10 +22,8 @@ Branch.init({
indexes: [
{
unique: true,
fields: ['region_id', 'falukant_user_id']
,
freezeTableName: true}
],
});
fields: ['regionId', 'falukantUserId']
}
]});
export default Branch;

View File

@@ -4,38 +4,35 @@ import { sequelize } from '../../../utils/sequelize.js';
class BuyableHouse extends Model { }
BuyableHouse.init({
roof_condition: {
roofCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
floor_condition: {
floorCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
wall_condition: {
wallCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
window_condition: {
windowCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
house_type_id: {
houseTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'BuyableHouse',
tableName: 'buyable_house',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default BuyableHouse;

View File

@@ -4,26 +4,20 @@ import { sequelize } from '../../../utils/sequelize.js';
class BuyableStock extends Model { }
BuyableStock.init({
region_id: {
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
stock_type_id: {
allowNull: false},
stockTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'BuyableStock',
tableName: 'buyable_stock',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default BuyableStock;

View File

@@ -8,24 +8,18 @@ Candidate.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
autoIncrement: true},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Candidate',
tableName: 'candidate',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Candidate;

View File

@@ -5,44 +5,35 @@ class FalukantCharacter extends Model {}
FalukantCharacter.init(
{
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: true,
},
region_id: {
allowNull: true},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
first_name: {
allowNull: false},
firstName: {
type: DataTypes.INTEGER,
allowNull: false,
},
last_name: {
allowNull: false},
lastName: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
birthdate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
defaultValue: DataTypes.NOW},
gender: {
type: DataTypes.STRING,
},
type: DataTypes.STRING},
health: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100,
},
title_of_nobility: {
defaultValue: 100},
titleOfNobility: {
type: DataTypes.INTEGER,
allowNull: false},
moodId: {
type: DataTypes.INTEGER,
allowNull: false,
},
mood_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
}
defaultValue: 1}
},
{
sequelize,
@@ -50,9 +41,7 @@ FalukantCharacter.init(
tableName: 'character',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default FalukantCharacter;

View File

@@ -5,46 +5,38 @@ class ChildRelation extends Model {}
ChildRelation.init(
{
father_character_id: {
fatherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
mother_character_id: {
allowNull: false},
motherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
child_character_id: {
allowNull: false},
childCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
father_name: {
allowNull: false},
fatherName: {
type: DataTypes.STRING,
allowNull: false,
},
mother_name: {
allowNull: false},
motherName: {
type: DataTypes.STRING,
allowNull: false,
},
name_set: {
allowNull: false},
nameSet: {
type: DataTypes.BOOLEAN,
allowNull: false,
default: false,
},
is_heir: {
default: false},
isHeir: {
type: DataTypes.BOOLEAN,
allowNull: true,
default: false,
}
default: false}
},
{
sequelize,
modelName: 'ChildRelation',
tableName: 'child_relation', // exakter Tabellenname
schema: 'falukant_data', // exaktes Schema
freezeTableName: true, // keine Pluralisierung
// keine Pluralisierung
timestamps: true,
underscored: true,
}
underscored: true}
);
export default ChildRelation;

View File

@@ -8,31 +8,24 @@ Credit.init({
// aufgenommener Kredit-Betrag
amount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
allowNull: false},
// noch offener Kreditbetrag
remaining_amount: {
remainingAmount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
allowNull: false},
// Zinssatz als Prozentsatz (z.B. 3.5 für 3.5%)
interest_rate: {
interestRate: {
type: DataTypes.DECIMAL(5,2),
allowNull: false,
},
allowNull: false},
// Verknüpfung auf FalukantUser
falukant_user_id: {
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Credit',
tableName: 'credit',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Credit;

View File

@@ -5,18 +5,14 @@ class DebtorsPrism extends Model {}
DebtorsPrism.init({
// Verknüpfung auf FalukantCharacter
character_id: {
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'DebtorsPrism',
tableName: 'debtors_prism',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default DebtorsPrism;

View File

@@ -4,39 +4,32 @@ import { sequelize } from '../../../utils/sequelize.js';
class Director extends Model { }
Director.init({
director_character_id: {
directorCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
employer_user_id: {
allowNull: false},
employerUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
income: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
satisfaction: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100,
},
may_produce: {
defaultValue: 100},
mayProduce: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
may_sell: {
defaultValue: true},
maySell: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
may_start_transport: {
defaultValue: true},
mayStartTransport: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
last_salary_payout: {
defaultValue: true},
lastSalaryPayout: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: new Date(0)
@@ -47,8 +40,6 @@ Director.init({
tableName: 'director',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Director;

View File

@@ -4,26 +4,20 @@ import { sequelize } from '../../../utils/sequelize.js';
class DirectorProposal extends Model { }
DirectorProposal.init({
director_character_id: {
directorCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
employer_user_id: {
allowNull: false},
employerUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
proposed_income: {
allowNull: false},
proposedIncome: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'DirectorProposal',
tableName: 'director_proposal',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default DirectorProposal;

View File

@@ -8,32 +8,25 @@ Election.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
office_type_id: {
autoIncrement: true},
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: true,
},
region_id: {
allowNull: true},
regionId: {
type: DataTypes.INTEGER,
allowNull: false
},
date: {
type: DataTypes.DATE,
allowNull: false,
},
posts_to_fill: {
allowNull: false},
postsToFill: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Election',
tableName: 'election',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Election;

View File

@@ -8,28 +8,21 @@ ElectionResult.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
autoIncrement: true},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
allowNull: false},
candidateId: {
type: DataTypes.INTEGER,
allowNull: false,
},
votes_received: {
allowNull: false},
votesReceived: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'ElectionResult',
tableName: 'election_result',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default ElectionResult;

View File

@@ -5,24 +5,19 @@ class FalukantCharacterTrait extends Model {}
FalukantCharacterTrait.init(
{
character_id: {
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
trait_id: {
allowNull: false},
traitId: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'FalukantCharacterTrait',
tableName: 'falukant_character_trait',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default FalukantCharacterTrait;

View File

@@ -4,35 +4,28 @@ import { sequelize } from '../../../utils/sequelize.js';
class Inventory extends Model { }
Inventory.init({
stock_id: {
stockId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quality: {
type: DataTypes.INTEGER,
allowNull: false,
},
produced_at: {
allowNull: false},
producedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
}
defaultValue: DataTypes.NOW}
}, {
sequelize,
modelName: 'Inventory',
tableName: 'inventory',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Inventory;

View File

@@ -5,35 +5,29 @@ class Learning extends Model {}
Learning.init(
{
learning_recipient_id: {
learningRecipientId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learn_all_products: {
defaultValue: null},
learnAllProducts: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
associated_falukant_user_id: {
defaultValue: false},
associatedFalukantUserId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
associated_learning_character_id: {
defaultValue: null},
associatedLearningCharacterId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learning_is_executed: {
defaultValue: null},
learningIsExecuted: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
}
defaultValue: false}
},
{
sequelize,
@@ -41,9 +35,7 @@ Learning.init(
tableName: 'learning',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default Learning;

View File

@@ -5,31 +5,25 @@ class MarriageProposal extends Model {}
MarriageProposal.init(
{
requester_character_id: {
requesterCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
proposed_character_id: {
onDelete: 'CASCADE'},
proposedCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
onDelete: 'CASCADE'},
cost: {
type: DataTypes.FLOAT,
allowNull: false,
defaultValue: 0,
},
},
defaultValue: 0}},
{
sequelize,
modelName: 'MarriageProposal',
tableName: 'marriage_proposals',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default MarriageProposal;

View File

@@ -8,24 +8,18 @@ OccupiedPoliticalOffice.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
autoIncrement: true},
politicalOfficeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'OccupiedPoliticalOffice',
tableName: 'occupied_political_office',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default OccupiedPoliticalOffice;

View File

@@ -4,27 +4,27 @@ import { sequelize } from '../../../utils/sequelize.js';
class Party extends Model {}
Party.init({
party_type_id: {
partyTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_type_id'
},
falukant_user_id: {
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'falukant_user_id'
},
music_type_id: {
musicTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'music_type'
},
banquette_type_id: {
banquetteTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'banquette_type'
},
servant_ratio: {
servantRatio: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'servant_ratio'
@@ -33,15 +33,12 @@ Party.init({
type: DataTypes.FLOAT,
allowNull: false,
defaultValue: 0
},
}, {
}}, {
sequelize,
modelName: 'Party',
tableName: 'party',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Party;

View File

@@ -4,12 +4,12 @@ import { sequelize } from '../../../utils/sequelize.js'
class PartyInvitedNobility extends Model {}
PartyInvitedNobility.init({
party_id: {
partyId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_id'
},
title_of_nobility_id: {
titleOfNobilityId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'title_of_nobility_id'
@@ -21,7 +21,6 @@ PartyInvitedNobility.init({
schema: 'falukant_data',
timestamps: false,
underscored: true
,
freezeTableName: true})
})
export default PartyInvitedNobility

View File

@@ -8,28 +8,21 @@ PoliticalOffice.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
office_type_id: {
autoIncrement: true},
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_id: {
allowNull: false},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'PoliticalOffice',
tableName: 'political_office',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default PoliticalOffice;

View File

@@ -4,19 +4,16 @@ import { sequelize } from '../../../utils/sequelize.js';
class Knowledge extends Model { }
Knowledge.init({
product_id: {
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
knowledge: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
}
defaultValue: 0}
}, {
sequelize,
modelName: 'Knowledge',
@@ -27,8 +24,7 @@ Knowledge.init({
hooks: {
beforeCreate: (knowledge) => {
knowledge.knowledge = Math.floor(Math.random() * 61) + 20;
,
freezeTableName: true}
}
}
});

View File

@@ -4,31 +4,25 @@ import { sequelize } from '../../../utils/sequelize.js';
class Production extends Model { }
Production.init({
branch_id: {
branchId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
start_timestamp: {
allowNull: false},
startTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
}
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')}
}, {
sequelize,
modelName: 'Production',
tableName: 'production',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Production;

View File

@@ -7,9 +7,8 @@ class RegionData extends Model { }
RegionData.init({
name: {
type: DataTypes.STRING,
allowNull: false,
},
region_type_id: {
allowNull: false},
regionTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -18,14 +17,13 @@ RegionData.init({
schema: 'falukant_type'
}
},
parent_id: {
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'region',
key: 'id',
schema: 'falukant_data',
}
schema: 'falukant_data'}
},
map: {
type: DataTypes.JSONB,
@@ -38,8 +36,6 @@ RegionData.init({
tableName: 'region',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default RegionData;

View File

@@ -11,47 +11,36 @@ Relationship.init(
allowNull: false,
references: {
model: FalukantCharacter,
key: 'id',
},
onDelete: 'CASCADE',
},
key: 'id'},
onDelete: 'CASCADE'},
character2Id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: FalukantCharacter,
key: 'id',
},
onDelete: 'CASCADE',
},
relationship_type_id: {
key: 'id'},
onDelete: 'CASCADE'},
relationshipTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
onDelete: 'CASCADE'},
widowFirstName1: {
type: DataTypes.STRING,
allowNull: true,
},
allowNull: true},
widowFirstName2: {
type: DataTypes.STRING,
allowNull: true,
},
next_step_progress: {
allowNull: true},
nextStepProgress: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0,
},
},
defaultValue: 0}},
{
sequelize,
modelName: 'Relationship',
tableName: 'relationship',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default Relationship;

View File

@@ -4,27 +4,22 @@ import { sequelize } from '../../../utils/sequelize.js';
class FalukantStock extends Model { }
FalukantStock.init({
branch_id: {
branchId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
stock_type_id: {
stockTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'StockData',
tableName: 'stock',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FalukantStock;

View File

@@ -4,19 +4,16 @@ import { sequelize } from '../../../utils/sequelize.js';
class TownProductWorth extends Model { }
TownProductWorth.init({
product_id: {
productId: {
type: DataTypes.INTEGER,
allowNull: false},
regionId: {
type: DataTypes.INTEGER,
allowNull: false},
worthPercent: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
worth_percent: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
}
defaultValue: 0}
}, {
sequelize,
modelName: 'TownProductWorth',
@@ -27,8 +24,7 @@ TownProductWorth.init({
hooks: {
beforeCreate: (worthPercent) => {
worthPercent.worthPercent = Math.floor(Math.random() * 20) + 40;
,
freezeTableName: true}
}
}
});

View File

@@ -4,34 +4,27 @@ import { sequelize } from '../../../utils/sequelize.js';
class Underground extends Model { }
Underground.init({
underground_type_id: {
undergroundTypeId: {
type: DataTypes.STRING,
allowNull: false,
},
performer_id: {
allowNull: false},
performerId: {
type: DataTypes.INTEGER,
allowNull: false,
},
victim_id: {
allowNull: false},
victimId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
parameters: {
type: DataTypes.JSON,
allowNull: true,
},
allowNull: true},
result: {
type: DataTypes.JSON,
allowNull: true,
}
allowNull: true}
}, {
sequelize,
modelName: 'Underground',
tableName: 'underground',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Underground;

View File

@@ -5,7 +5,7 @@ import RegionData from './region.js';
class FalukantUser extends Model { }
FalukantUser.init({
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -15,34 +15,28 @@ FalukantUser.init({
},
key: 'id'
},
unique: true,
},
unique: true},
money: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
credit_amount: {
defaultValue: 0.00},
creditAmount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
today_credit_taken: {
defaultValue: 0.00},
todayCreditTaken: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
credit_interest_rate: {
defaultValue: 0.00},
creditInterestRate: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false,
defaultValue: 0.00,
},
defaultValue: 0.00},
certificate: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
},
main_branch_region_id: {
defaultValue: 1},
mainBranchRegionId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -57,8 +51,6 @@ FalukantUser.init({
tableName: 'falukant_user',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FalukantUser;

View File

@@ -4,32 +4,32 @@ import { sequelize } from '../../../utils/sequelize.js';
class UserHouse extends Model { }
UserHouse.init({
roof_condition: {
roofCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
floor_condition: {
floorCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
wall_condition: {
wallCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
window_condition: {
windowCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
house_type_id: {
houseTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
},
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
@@ -40,8 +40,6 @@ UserHouse.init({
tableName: 'user_house',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default UserHouse;

View File

@@ -9,26 +9,20 @@ Vote.init(
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
autoIncrement: true},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
allowNull: false},
candidateId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
falukant_user_id: {
defaultValue: DataTypes.NOW},
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'Vote',
@@ -39,11 +33,8 @@ Vote.init(
indexes: [
{
unique: true,
fields: ['election_id', 'candidate_id'],
,
freezeTableName: true},
],
}
fields: ['electionId', 'candidateId']},
]}
);
export default Vote;

View File

@@ -4,32 +4,26 @@ import { sequelize } from '../../../utils/sequelize.js';
class DayProduction extends Model { }
DayProduction.init({
region_id: {
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
producer_id: {
allowNull: false},
producerId: {
type: DataTypes.INTEGER,
allowNull: false,
},
production_timestamp: {
allowNull: false},
productionTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
},
production_date: {
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')},
productionDate: {
type: DataTypes.DATEONLY,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_DATE'),
}
defaultValue: sequelize.literal('CURRENT_DATE')}
}, {
sequelize,
modelName: 'DayProduction',
@@ -40,9 +34,8 @@ DayProduction.init({
indexes: [
{
unique: true,
fields: ['producer_id', 'product_id', 'region_id', 'production_date']
,
freezeTableName: true}
fields: ['producerId', 'productId', 'regionId', 'productionDate']
}
]
});

View File

@@ -4,27 +4,22 @@ import { sequelize } from '../../../utils/sequelize.js';
class DaySell extends Model { }
DaySell.init({
region_id: {
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
seller_id: {
allowNull: false},
sellerId: {
type: DataTypes.INTEGER,
allowNull: false,
},
sell_timestamp: {
allowNull: false},
sellTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
}
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')}
}, {
sequelize,
modelName: 'DaySell',
@@ -35,9 +30,8 @@ DaySell.init({
indexes: [
{
unique: true,
fields: ['seller_id', 'product_id', 'region_id']
,
freezeTableName: true}
fields: ['sellerId', 'productId', 'regionId']
}
]
});

View File

@@ -4,30 +4,24 @@ import { sequelize } from '../../../utils/sequelize.js';
class ElectionHistory extends Model { }
ElectionHistory.init({
election_id: {
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
political_office_type_id: {
allowNull: false},
politicalOfficeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
election_date: {
allowNull: false},
electionDate: {
type: DataTypes.DATE,
allowNull: false,
},
election_result: {
allowNull: false},
electionResult: {
type: DataTypes.JSON,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'ElectionHistory',
tableName: 'election_history',
schema: 'falukant_log',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default ElectionHistory;

View File

@@ -7,21 +7,17 @@ HealthActivity.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
character_id: {
autoIncrement: true},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
activity_tr: {
allowNull: false},
activityTr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
cost: {
type: DataTypes.FLOAT,
allowNull: false,
},
success_percentage: {
allowNull: false},
successPercentage: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -31,8 +27,6 @@ HealthActivity.init({
tableName: 'health_activity',
schema: 'falukant_log',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default HealthActivity;

View File

@@ -4,43 +4,34 @@ import { sequelize } from '../../../utils/sequelize.js';
class MoneyFlow extends Model { }
MoneyFlow.init({
falukant_user_id: {
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
activity: {
type: DataTypes.STRING,
allowNull: false,
},
money_before: {
allowNull: false},
moneyBefore: {
type: DataTypes.DOUBLE,
allowNull: false,
},
money_after: {
allowNull: false},
moneyAfter: {
type: DataTypes.DOUBLE,
allowNull: true,
},
allowNull: true},
time: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
change_value: {
changeValue: {
type: DataTypes.DOUBLE,
allowNull: false,
},
changed_by: {
allowNull: false},
changedBy: {
type: DataTypes.INTEGER,
allowNull: true,
},
}, {
allowNull: true}}, {
sequelize,
modelName: 'MoneyFlow',
tableName: 'moneyflow',
schema: 'falukant_log',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default MoneyFlow;

View File

@@ -4,27 +4,21 @@ import { sequelize } from '../../../utils/sequelize.js';
class Notification extends Model { }
Notification.init({
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
tr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
shown: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
}, {
defaultValue: false}}, {
sequelize,
modelName: 'Notification',
tableName: 'notification',
schema: 'falukant_log',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Notification;

View File

@@ -5,22 +5,18 @@ class PoliticalOfficeHistory extends Model { }
PoliticalOfficeHistory.init(
{
character_id: {
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
office_type_id: {
allowNull: false},
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
start_date: {
allowNull: false},
startDate: {
type: DataTypes.DATE,
allowNull: false,
},
end_date: {
allowNull: false},
endDate: {
type: DataTypes.DATE,
allowNull: false,
}
allowNull: false}
},
{
sequelize,
@@ -28,9 +24,7 @@ PoliticalOfficeHistory.init(
tableName: 'political_office_history',
schema: 'falukant_log',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default PoliticalOfficeHistory;

View File

@@ -4,30 +4,23 @@ import { sequelize } from '../../../utils/sequelize.js';
class PromotionalGiftLog extends Model { };
PromotionalGiftLog.init({
sender_character_id: {
senderCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
recipient_character_id: {
allowNull: false},
recipientCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
gift_id: {
allowNull: false},
giftId: {
type: DataTypes.INTEGER,
allowNull: false,
},
change_value: {
allowNull: false},
changeValue: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'PromotionalGiftLog',
tableName: 'promotional_gift',
schema: 'falukant_log',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default PromotionalGiftLog;

View File

@@ -19,9 +19,7 @@ const FalukantPredefineFirstname = sequelize.define('firstname', {
{
unique: true,
fields: ['name', 'gender']
,
freezeTableName: true}
],
});
}
]});
export default FalukantPredefineFirstname;

View File

@@ -6,8 +6,7 @@ const FalukantPredefineLastname = sequelize.define('lastname', {
type: DataTypes.STRING,
length: 1,
allowNull: false
},
}, {
}}, {
tableName: 'lastname',
schema: 'falukant_predefine',
underscored: true,
@@ -16,9 +15,7 @@ const FalukantPredefineLastname = sequelize.define('lastname', {
{
unique: true,
fields: ['name']
,
freezeTableName: true}
],
});
}
]});
export default FalukantPredefineLastname;

View File

@@ -9,29 +9,22 @@ PoliticalOfficeBenefit.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
autoIncrement: true},
politicalOfficeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
benefit_type_id: {
allowNull: false},
benefitTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
value: {
type: DataTypes.JSONB,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'PoliticalOfficeBenefit',
tableName: 'political_office_benefit',
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
// Association
PoliticalOfficeBenefit.belongsTo(PoliticalOfficeBenefitType, {

View File

@@ -9,27 +9,22 @@ PoliticalOfficePrerequisite.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
autoIncrement: true},
// Neu: Feld heißt jetzt eindeutig "office_type_id"
office_type_id: {
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
field: 'office_type_id',
allowNull: false},
prerequisite: {
type: DataTypes.JSONB,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'PoliticalOfficePrerequisite',
tableName: 'political_office_prerequisite',
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default PoliticalOfficePrerequisite;

View File

@@ -5,33 +5,26 @@ import CharacterTrait from '../type/character_trait.js';
class PromotionalGiftCharacterTrait extends Model {}
PromotionalGiftCharacterTrait.init(
PromotionalGiftCharacterTrait.init(
{
gift_id: {
giftId: {
type: DataTypes.INTEGER,
references: {
model: PromotionalGift,
key: 'id',
},
allowNull: false,
field: 'gift_id',
references: { model: PromotionalGift, key: 'id' },
allowNull: false
},
trait_id: {
traitId: {
type: DataTypes.INTEGER,
references: {
model: CharacterTrait,
key: 'id',
},
allowNull: false,
field: 'trait_id',
references: { model: CharacterTrait, key: 'id' },
allowNull: false
},
suitability: {
type: DataTypes.INTEGER,
allowNull: false,
validate: {
min: 1,
max: 5,
},
},
},
max: 5}}},
{
sequelize,
modelName: 'PromotionalGiftCharacterTrait',
@@ -39,8 +32,9 @@ PromotionalGiftCharacterTrait.init(
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
,
freezeTableName: true}
indexes: [
{ unique: true, fields: ['gift_id','trait_id'] }
]}
);
export default PromotionalGiftCharacterTrait;

View File

@@ -7,40 +7,44 @@ class PromotionalGiftMood extends Model {}
PromotionalGiftMood.init(
{
gift_id: {
giftId: {
type: DataTypes.INTEGER,
field: 'gift_id',
references: {
model: PromotionalGift,
key: 'id',
key: 'id'
},
allowNull: false,
allowNull: false
},
mood_id: {
moodId: {
type: DataTypes.INTEGER,
field: 'mood_id',
references: {
model: Mood,
key: 'id',
key: 'id'
},
allowNull: false,
allowNull: false
},
suitability: {
type: DataTypes.INTEGER,
allowNull: false,
validate: {
min: 1,
max: 5,
},
},
},
max: 5}}},
{
sequelize,
modelName: 'PromotionalGiftMood',
modelName: 'PromotionalGiftMood',
tableName: 'promotional_gift_mood',
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
,
freezeTableName: true}
indexes: [
{
unique: true,
fields: ['gift_id', 'mood_id']
}
]
}
);
export default PromotionalGiftMood;

View File

@@ -7,26 +7,20 @@ BanquetteType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
reputation_growth: {
allowNull: false},
reputationGrowth: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'BanquetteType',
tableName: 'banquette',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default BanquetteType;

View File

@@ -4,14 +4,12 @@ import { sequelize } from '../../../utils/sequelize.js';
class BranchType extends Model { }
BranchType.init({
label_tr: {
labelTr: {
type: DataTypes.STRING,
allowNull: false,
},
base_cost: {
allowNull: false},
baseCost: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'BranchType',
@@ -22,10 +20,8 @@ BranchType.init({
indexes: [
{
unique: true,
fields: ['label_tr']
,
freezeTableName: true}
],
});
fields: ['labelTr']
}
]});
export default BranchType;

View File

@@ -7,18 +7,14 @@ CharacterTrait.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'CharacterTrait',
tableName: 'character_trait',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default CharacterTrait;

View File

@@ -4,23 +4,18 @@ import { sequelize } from '../../../utils/sequelize.js';
class HouseType extends Model { }
HouseType.init({
label_tr: {
labelTr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
position: {
type: DataTypes.INTEGER,
allowNull: false,
},
minimum_noble_title: {
allowNull: false},
minimumNobleTitle: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'HouseType',
tableName: 'house',
@@ -30,10 +25,8 @@ HouseType.init({
indexes: [
{
unique: true,
fields: ['label_tr']
,
freezeTableName: true}
],
});
fields: ['labelTr']
}
]});
export default HouseType;

View File

@@ -7,18 +7,14 @@ LearnRecipient.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'LearnRecipient',
tableName: 'learn_recipient',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default LearnRecipient;

View File

@@ -5,20 +5,20 @@ class Mood extends Model {}
Mood.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true},
tr: {
type: DataTypes.STRING,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'Mood',
tableName: 'mood',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default Mood;

View File

@@ -7,26 +7,20 @@ MusicType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
reputation_growth: {
allowNull: false},
reputationGrowth: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'MusicType',
tableName: 'music',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default MusicType;

View File

@@ -7,21 +7,17 @@ PartyType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
for_marriage: {
allowNull: false},
forMarriage: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
reputation_growth: {
defaultValue: false},
reputationGrowth: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
},
{
sequelize,
@@ -29,9 +25,7 @@ PartyType.init(
tableName: 'party',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default PartyType;

View File

@@ -8,20 +8,15 @@ PoliticalOfficeBenefitType.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
autoIncrement: true},
tr: {
type: DataTypes.STRING,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'PoliticalOfficeBenefitType',
tableName: 'political_office_benefit_type',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default PoliticalOfficeBenefitType;

View File

@@ -7,33 +7,25 @@ PoliticalOfficeType.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
autoIncrement: true},
name: {
type: DataTypes.STRING,
allowNull: false,
},
seats_per_region: {
allowNull: false},
seatsPerRegion: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_type: {
allowNull: false},
regionType: {
type: DataTypes.STRING,
allowNull: false,
},
term_length: {
allowNull: false},
termLength: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
},
}, {
defaultValue: 0}}, {
sequelize,
modelName: 'PoliticalOfficeType',
tableName: 'political_office_type',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default PoliticalOfficeType;

View File

@@ -4,22 +4,18 @@ import { sequelize } from '../../../utils/sequelize.js';
class ProductType extends Model { }
ProductType.init({
label_tr: {
labelTr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
category: {
type: DataTypes.INTEGER,
allowNull: false,
},
production_time: {
allowNull: false},
productionTime: {
type: DataTypes.INTEGER,
allowNull: false,
},
sell_cost: {
allowNull: false},
sellCost: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'ProductType',
@@ -30,10 +26,8 @@ ProductType.init({
indexes: [
{
unique: true,
fields: ['label_tr']
,
freezeTableName: true}
],
});
fields: ['labelTr']
}
]});
export default ProductType;

View File

@@ -5,29 +5,27 @@ class PromotionalGift extends Model {}
PromotionalGift.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true},
name: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
description: {
type: DataTypes.TEXT,
allowNull: true,
},
allowNull: true},
value: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
},
},
defaultValue: 0}},
{
sequelize,
modelName: 'PromotionalGift',
tableName: 'promotional_gift',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default PromotionalGift;

View File

@@ -4,18 +4,16 @@ import { sequelize } from '../../../utils/sequelize.js';
class RegionType extends Model { }
RegionType.init({
label_tr: {
labelTr: {
type: DataTypes.STRING,
allowNull: false,
},
parent_id: {
allowNull: false},
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'region',
key: 'id',
schema: 'falukant_type',
}
schema: 'falukant_type'}
}
}, {
sequelize,
@@ -23,8 +21,6 @@ RegionType.init({
tableName: 'region',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default RegionType;

View File

@@ -7,8 +7,7 @@ RelationshipType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
}
allowNull: false}
},
{
sequelize,
@@ -16,9 +15,7 @@ RelationshipType.init(
tableName: 'relationship',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default RelationshipType;

View File

@@ -4,23 +4,19 @@ import { sequelize } from '../../../utils/sequelize.js';
class FalukantStockType extends Model { }
FalukantStockType.init({
label_tr: {
labelTr: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
unique: true},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'StockType',
tableName: 'stock',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FalukantStockType;

View File

@@ -4,23 +4,18 @@ import { sequelize } from '../../../utils/sequelize.js';
class TitleOfNobility extends Model { }
TitleOfNobility.init({
label_tr: {
labelTr: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
level: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
},
}, {
defaultValue: 0}}, {
sequelize,
modelName: 'Title',
tableName: 'title',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default TitleOfNobility;

View File

@@ -8,21 +8,16 @@ TitleRequirement.init({
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
title_id: {
autoIncrement: true},
titleId: {
type: DataTypes.INTEGER,
allowNull: false,
},
requirement_type: {
allowNull: false},
requirementType: {
type: DataTypes.STRING,
allowNull: false,
},
requirement_value: {
allowNull: false},
requirementValue: {
type: DataTypes.DECIMAL(14, 2),
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'TitleRequirement',
tableName: 'title_requirement',
@@ -32,10 +27,9 @@ TitleRequirement.init({
indexes: [
{
unique: true,
fields: ['title_id', 'requirement_type'],
fields: ['titleId', 'requirementType'],
name: 'title_requirement_titleid_reqtype_unique'
,
freezeTableName: true}
}
]
});

View File

@@ -7,20 +7,16 @@ UndergroundType.init({
tr: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
unique: true},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'UndergroundType',
tableName: 'underground',
schema: 'falukant_type',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default UndergroundType;

View File

@@ -10,7 +10,6 @@ const Forum = sequelize.define('forum', {
tableName: 'forum',
schema: 'forum',
underscored: true
,
freezeTableName: true});
});
export default Forum;

View File

@@ -2,7 +2,7 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const ForumForumPermission = sequelize.define('forum_forum_permission', {
forum_id: {
forumId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -10,7 +10,7 @@ const ForumForumPermission = sequelize.define('forum_forum_permission', {
key: 'id'
}
},
permission_id: {
permissionId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -22,7 +22,6 @@ const ForumForumPermission = sequelize.define('forum_forum_permission', {
tableName: 'forum_forum_permission',
schema: 'forum',
underscored: true
,
freezeTableName: true});
});
export default ForumForumPermission;

View File

@@ -4,20 +4,16 @@ import { DataTypes } from 'sequelize';
const ForumPermission = sequelize.define('forum_permission', {
name: {
type: DataTypes.STRING,
allowNull: false,
},
allowNull: false},
value: {
type: DataTypes.STRING,
allowNull: true,
},
}, {
allowNull: true}}, {
sequelize,
modelName: 'ForumPermission',
tableName: 'forum_permission',
schema: 'forum',
timestamps: false,
underscored: true
,
freezeTableName: true});
});
export default ForumPermission;

View File

@@ -2,23 +2,21 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const ForumUserPermission = sequelize.define('forum_user_permission', {
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: true
},
permission_id: {
permissionId: {
type: DataTypes.INTEGER,
allowNull: false
},
forum_id: {
forumId: {
type: DataTypes.INTEGER,
allowNull: false
},
}, {
}}, {
tableName: 'forum_user_permission',
schema: 'forum',
underscored: true
,
freezeTableName: true});
});
export default ForumUserPermission;

View File

@@ -6,11 +6,11 @@ const Message = sequelize.define('message', {
type: DataTypes.TEXT,
allowNull: false
},
created_by: {
createdBy: {
type: DataTypes.INTEGER,
allowNull: false
},
title_id: {
titleId: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -19,7 +19,6 @@ const Message = sequelize.define('message', {
schema: 'forum',
underscored: true,
timestamps: true
,
freezeTableName: true});
});
export default Message;

View File

@@ -2,19 +2,19 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MessageHistory = sequelize.define('message_history', {
message_id: {
messageId: {
type: DataTypes.INTEGER,
allowNull: false
},
old_text: {
oldText: {
type: DataTypes.TEXT,
allowNull: false
},
changed_by: {
changedBy: {
type: DataTypes.INTEGER,
allowNull: false
},
old_updated_at: {
oldUpdatedAt: {
type: DataTypes.DATE,
allowNull: false
}
@@ -23,7 +23,6 @@ const MessageHistory = sequelize.define('message_history', {
schema: 'forum',
underscored: true,
timestamps: false
,
freezeTableName: true});
});
export default MessageHistory;

View File

@@ -2,11 +2,11 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MessageImage = sequelize.define('message_image', {
message_id: {
messageId: {
type: DataTypes.INTEGER,
allowNull: false
},
file_name: {
fileName: {
type: DataTypes.STRING,
allowNull: false
}
@@ -15,7 +15,6 @@ const MessageImage = sequelize.define('message_image', {
schema: 'forum',
underscored: true,
timestamps: false
,
freezeTableName: true});
});
export default MessageImage;

View File

@@ -11,11 +11,11 @@ const Title = sequelize.define('title', {
type: DataTypes.STRING,
allowNull: false
},
created_by: {
createdBy: {
type: DataTypes.INTEGER,
allowNull: false
},
forum_id: {
forumId: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -23,8 +23,6 @@ const Title = sequelize.define('title', {
tableName: 'title',
schema: 'forum',
underscored: true,
timestamps: true,
,
freezeTableName: true});
timestamps: true});
export default Title;

View File

@@ -2,19 +2,19 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const TitleHistory = sequelize.define('title_history', {
title_id: {
titleId: {
type: DataTypes.INTEGER,
allowNull: false
},
old_title: {
oldTitle: {
type: DataTypes.STRING,
allowNull: false
},
changed_by: {
changedBy: {
type: DataTypes.INTEGER,
allowNull: false
},
old_updated_at: {
oldUpdatedAt: {
type: DataTypes.DATE,
allowNull: false
}
@@ -23,7 +23,6 @@ const TitleHistory = sequelize.define('title_history', {
schema: 'forum',
underscored: true,
timestamps: false
,
freezeTableName: true});
});
export default TitleHistory;

View File

@@ -86,20 +86,6 @@ import Credit from './falukant/data/credit.js';
import DebtorsPrism from './falukant/data/debtors_prism.js';
import HealthActivity from './falukant/log/health_activity.js';
// Minigames (service)
import MinigameCampaign from './service/minigame_campaign.js';
import MinigameCampaignLevel from './service/minigame_campaign_level.js';
import MinigameUserProgress from './service/minigame_user_progress.js';
// Match3 Models
import Match3Campaign from './match3/campaign.js';
import Match3Level from './match3/level.js';
import Match3Objective from './match3/objective.js';
import Match3UserProgress from './match3/userProgress.js';
import Match3UserLevelProgress from './match3/userLevelProgress.js';
import Match3TileType from './match3/tileType.js';
import Match3LevelTileType from './match3/levelTileType.js';
// — Politische Ämter (Politics) —
import PoliticalOfficeType from './falukant/type/political_office_type.js';
import PoliticalOfficeRequirement from './falukant/predefine/political_office_prerequisite.js';
@@ -208,16 +194,6 @@ const models = {
Credit,
DebtorsPrism,
HealthActivity,
MinigameCampaign,
MinigameCampaignLevel,
MinigameUserProgress,
Match3Campaign,
Match3Level,
Match3Objective,
Match3UserProgress,
Match3UserLevelProgress,
Match3TileType,
Match3LevelTileType,
PoliticalOfficeType,
PoliticalOfficeRequirement,
PoliticalOfficeBenefitType,

View File

@@ -15,7 +15,7 @@ const Campaign = sequelize.define('Campaign', {
type: DataTypes.TEXT,
allowNull: true
},
is_active: {
isActive: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
@@ -23,11 +23,11 @@ const Campaign = sequelize.define('Campaign', {
type: DataTypes.INTEGER,
defaultValue: 1
},
created_at: {
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updated_at: {
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
@@ -36,7 +36,6 @@ const Campaign = sequelize.define('Campaign', {
schema: 'match3',
timestamps: true,
underscored: true // WICHTIG: Alle Datenbankfelder im snake_case Format
,
freezeTableName: true});
});
export default Campaign;

View File

@@ -7,7 +7,7 @@ const Match3Level = sequelize.define('Match3Level', {
primaryKey: true,
autoIncrement: true
},
campaign_id: {
campaignId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -27,40 +27,40 @@ const Match3Level = sequelize.define('Match3Level', {
type: DataTypes.INTEGER,
allowNull: false
},
board_layout: {
boardLayout: {
type: DataTypes.TEXT,
allowNull: true, // Ändern zu true, da bereits existierende Datensätze vorhanden sind
defaultValue: 'xxxxxx\nxxxxxx\nxxxxxx\nxxxxxx\nxxxxxx\nxxxxxx', // Standard-Layout für neue Level
comment: 'Level-Form als String (o = kein Feld, x = Feld, Zeilen durch \n getrennt)'
},
board_width: {
boardWidth: {
type: DataTypes.INTEGER,
allowNull: true, // Ändern zu true, da bereits existierende Datensätze vorhanden sind
defaultValue: 6, // Standardwert für neue Level
comment: 'Breite des Level-Boards'
},
board_height: {
boardHeight: {
type: DataTypes.INTEGER,
allowNull: true, // Ändern zu true, da bereits existierende Datensätze vorhanden sind
defaultValue: 6, // Standardwert für neue Level
comment: 'Höhe des Level-Boards'
},
tile_types: {
tileTypes: {
type: DataTypes.JSON,
allowNull: true, // Ändern zu true, da wir jetzt eine Verknüpfungstabelle haben
comment: 'Legacy: Array der verfügbaren Tile-Typen (wird durch levelTileTypes ersetzt)'
},
move_limit: {
moveLimit: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 20
},
time_limit: {
timeLimit: {
type: DataTypes.INTEGER,
allowNull: true,
comment: 'Zeitlimit in Sekunden (null = kein Limit)'
},
is_active: {
isActive: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
@@ -70,7 +70,6 @@ const Match3Level = sequelize.define('Match3Level', {
schema: 'match3',
timestamps: true,
underscored: true // WICHTIG: Alle Datenbankfelder im snake_case Format
,
freezeTableName: true});
});
export default Match3Level;

View File

@@ -7,7 +7,7 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
primaryKey: true,
autoIncrement: true
},
level_id: {
levelId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
},
comment: 'Referenz auf den Level'
},
tile_type_id: {
tileTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -31,7 +31,7 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
defaultValue: 1,
comment: 'Gewichtung für die Wahrscheinlichkeit, dass dieser Tile-Typ erscheint'
},
is_active: {
isActive: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
@@ -45,9 +45,8 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
indexes: [
{
unique: true,
fields: ['level_id', 'tile_type_id'] // WICHTIG: Bei underscored: true müssen snake_case Namen verwendet werden
,
freezeTableName: true}
fields: ['levelId', 'tileTypeId'] // WICHTIG: Bei underscored: true müssen snake_case Namen verwendet werden
}
]
});

Some files were not shown because too many files have changed in this diff Show More