Some fixes and additions

This commit is contained in:
Torsten Schulz
2025-07-09 14:28:35 +02:00
parent 5029be81e9
commit fceea5b7fb
32 changed files with 4373 additions and 1294 deletions

View File

@@ -30,6 +30,11 @@ ChildRelation.init(
allowNull: false,
default: false,
},
isHeir: {
type: DataTypes.BOOLEAN,
allowNull: true,
default: false,
}
},
{
sequelize,

View File

@@ -10,15 +10,19 @@ Election.init({
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
allowNull: true,
},
date: {
regionId: {
type: DataTypes.INTEGER,
allowNull: false
},
date: {
type: DataTypes.DATE,
allowNull: false,
},
posts_to_fill: {
postsToFill: {
type: DataTypes.INTEGER,
allowNull: false,
},

View File

@@ -26,6 +26,11 @@ RegionData.init({
key: 'id',
schema: 'falukant_data',
}
},
map: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: {}
}
}, {
sequelize,

View File

@@ -4,36 +4,45 @@ import { sequelize } from '../../../utils/sequelize.js';
class Vote extends Model {}
Vote.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
Vote.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidateId: {
type: DataTypes.INTEGER,
allowNull: false,
},
timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
election_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
voter_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
}, {
sequelize,
modelName: 'Vote',
tableName: 'vote',
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
{
sequelize,
modelName: 'Vote',
tableName: 'vote',
schema: 'falukant_data',
timestamps: true,
underscored: true,
indexes: [
{
unique: true,
fields: ['election_id', 'candidate_id'],
},
],
}
);
export default Vote;