Fix jwt-token

This commit is contained in:
2025-09-24 04:36:22 +02:00
parent 40c20c8754
commit 02ce9d343b
2 changed files with 13 additions and 13 deletions

View File

@@ -46,9 +46,9 @@ function defineModels() {
// Tenant model // Tenant model
models.Tenant = sequelize.define('Tenant', { models.Tenant = sequelize.define('Tenant', {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.UUID,
primaryKey: true, primaryKey: true,
autoIncrement: true defaultValue: DataTypes.UUIDV4
}, },
slug: { slug: {
type: DataTypes.STRING(50), type: DataTypes.STRING(50),
@@ -77,19 +77,19 @@ function defineModels() {
// DroneDetection model // DroneDetection model
models.DroneDetection = sequelize.define('DroneDetection', { models.DroneDetection = sequelize.define('DroneDetection', {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.UUID,
primaryKey: true, primaryKey: true,
autoIncrement: true defaultValue: DataTypes.UUIDV4
}, },
tenant_id: { tenant_id: {
type: DataTypes.INTEGER, type: DataTypes.UUID,
allowNull: false allowNull: false
}, },
device_id: { device_id: {
type: DataTypes.STRING(50), type: DataTypes.STRING(50),
allowNull: false allowNull: false
}, },
timestamp: { server_timestamp: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false allowNull: false
}, },
@@ -110,10 +110,10 @@ function defineModels() {
timestamps: false, timestamps: false,
indexes: [ indexes: [
{ {
fields: ['tenant_id', 'timestamp'] fields: ['tenant_id', 'server_timestamp']
}, },
{ {
fields: ['timestamp'] fields: ['server_timestamp']
} }
] ]
}); });
@@ -121,12 +121,12 @@ function defineModels() {
// Heartbeat model // Heartbeat model
models.Heartbeat = sequelize.define('Heartbeat', { models.Heartbeat = sequelize.define('Heartbeat', {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.UUID,
primaryKey: true, primaryKey: true,
autoIncrement: true defaultValue: DataTypes.UUIDV4
}, },
tenant_id: { tenant_id: {
type: DataTypes.INTEGER, type: DataTypes.UUID,
allowNull: false allowNull: false
}, },
device_id: { device_id: {
@@ -162,7 +162,7 @@ function defineModels() {
autoIncrement: true autoIncrement: true
}, },
tenant_id: { tenant_id: {
type: DataTypes.INTEGER, type: DataTypes.UUID,
allowNull: true allowNull: true
}, },
timestamp: { timestamp: {

View File

@@ -173,7 +173,7 @@ class DataRetentionService {
const deletedDetections = await DroneDetection.destroy({ const deletedDetections = await DroneDetection.destroy({
where: { where: {
tenant_id: tenant.id, tenant_id: tenant.id,
timestamp: { server_timestamp: {
[Op.lt]: cutoffDate [Op.lt]: cutoffDate
} }
} }