Some extensions and fixes
This commit is contained in:
44
backend/models/falukant/log/dayproduction.js
Normal file
44
backend/models/falukant/log/dayproduction.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../../utils/sequelize.js';
|
||||
|
||||
class DayProduction extends Model { }
|
||||
|
||||
DayProduction.init({
|
||||
regionId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
productId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
quantity: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
producerId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
productionTimestamp: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
|
||||
}
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'DayProduction',
|
||||
tableName: 'production',
|
||||
schema: 'falukant_log',
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{
|
||||
unique: true,
|
||||
fields: ['producer_id', 'product_id', 'region_id']
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
export default DayProduction;
|
||||
43
backend/models/falukant/log/daysell.js
Normal file
43
backend/models/falukant/log/daysell.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../../utils/sequelize.js';
|
||||
|
||||
class DaySell extends Model { }
|
||||
|
||||
DaySell.init({
|
||||
regionId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
productId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
quantity: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
sellerId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
sellTimestamp: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
|
||||
}
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'DaySell',
|
||||
tableName: 'sell',
|
||||
schema: 'falukant_log',
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
indexes: [
|
||||
{
|
||||
unique: true,
|
||||
fields: ['seller_id', 'product_id', 'region_id']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
export default DaySell;
|
||||
29
backend/models/falukant/log/notification
Normal file
29
backend/models/falukant/log/notification
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../../utils/sequelize.js';
|
||||
|
||||
class Notification extends Model { }
|
||||
|
||||
Notification.init({
|
||||
userId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
tr: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
shown: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
},
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'Notification',
|
||||
tableName: 'notification',
|
||||
schema: 'falukant_log',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
});
|
||||
|
||||
export default Notification;
|
||||
Reference in New Issue
Block a user