websockets implemented

This commit is contained in:
Torsten Schulz
2024-12-04 19:08:26 +01:00
parent d46a51db38
commit 069c97fa90
64 changed files with 2488 additions and 562 deletions

View File

@@ -0,0 +1,39 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import RegionType from '../type/region.js';
class RegionData extends Model { }
RegionData.init({
name: {
type: DataTypes.STRING,
allowNull: false,
},
regionTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: RegionType,
key: 'id',
schema: 'falukant_type'
}
},
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'region',
key: 'id',
schema: 'falukant_data',
}
}
}, {
sequelize,
modelName: 'RegionData',
tableName: 'region',
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
export default RegionData;

View File

@@ -0,0 +1,57 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import RegionData from './region.js';
class FalukantUser extends Model { }
FalukantUser.init({
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: {
tableName: 'user',
schema: 'community'
},
key: 'id'
}
},
money: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
creditAmount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
todayCreditTaken: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
creditInterestRate: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false,
defaultValue: 0.00,
},
mainBranchRegionId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: RegionData,
key: 'id',
schema: 'falukant_data'
}
}
}, {
sequelize,
modelName: 'FalukantUser',
tableName: 'falukant_user',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default FalukantUser;

View File

@@ -0,0 +1,29 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class RegionType extends Model { }
RegionType.init({
labelTr: {
type: DataTypes.STRING,
allowNull: false,
},
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'region',
key: 'id',
schema: 'falukant_type',
}
}
}, {
sequelize,
modelName: 'RegionType',
tableName: 'region',
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
export default RegionType;