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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -31,8 +31,6 @@ const Friendship = sequelize.define('friendship', {
|
||||
tableName: 'friendship',
|
||||
schema: 'community',
|
||||
underscored: true,
|
||||
timestamps: true,
|
||||
,
|
||||
freezeTableName: true});
|
||||
timestamps: true});
|
||||
|
||||
export default Friendship;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,6 @@ const interest = sequelize.define('interest_type', {
|
||||
tableName: 'interest',
|
||||
schema: 'community',
|
||||
underscored: true
|
||||
,
|
||||
freezeTableName: true});
|
||||
});
|
||||
|
||||
export default interest;
|
||||
@@ -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}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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'],
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user