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

49 lines
1.1 KiB
JavaScript
Executable File

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'}
},
map: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: {}
}
,
taxPercent: {
type: DataTypes.DECIMAL,
allowNull: false,
defaultValue: 7,
field: 'tax_percent'
}
}, {
sequelize,
modelName: 'RegionData',
tableName: 'region',
schema: 'falukant_data',
timestamps: false,
underscored: true});
export default RegionData;