File: /home/ekspardev/tubisad-backend/src/app/demand/model/demand.model.js
const { DataTypes } = require('sequelize');
const sequelize = require('../../../core/config/db/db.conn');
const WasteTypes = require('../../../core/model/waste-type/wasted_type.model');
const DonatedProjects = require('../../../core/model/donated-projects/donated_projects.model');
const Demands = sequelize.define('demands_talepler', {
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
wasteType: {
type: DataTypes.INTEGER,
allowNull: true,
foreignKey: true,
references: {
model: WasteTypes,
foreignKey: 'id',
},
comment: "Atık Tipi, İsmi: Yeniden Kullanım/Geri Dönüşüm"
},
wasteWeight: {
type: DataTypes.STRING,
allowNull: true,
comment: "Atık ağırlığı"
},
wasteDoc: {
type: DataTypes.STRING,
allowNull: true,
comment: "Atık resmi ya da dökümanı"
},
city: {
type: DataTypes.STRING,
allowNull: true,
comment: "İl"
},
district: {
type: DataTypes.STRING,
allowNull: true,
comment: "İlçe"
},
street: {
type: DataTypes.STRING,
allowNull: true,
comment: "Sokak/Cadde"
},
neighborhood: {
type: DataTypes.STRING,
allowNull: true,
comment: "Mahalle"
},
outdoorNo: {
type: DataTypes.STRING,
allowNull: true,
comment: "Dış Kapı No"
},
doorNo: {
type: DataTypes.STRING,
allowNull: true,
comment: "Daire No"
},
locationLat: {
type: DataTypes.STRING,
allowNull: true,
comment: "Konum Latitude"
},
locationLon: {
type: DataTypes.STRING,
allowNull: true,
comment: "Konum Longitude"
},
donorFullName: {
type: DataTypes.STRING,
allowNull: true,
comment: "Bağışçı ismi veya şirket ünvanı"
},
donorPhone: {
type: DataTypes.STRING,
allowNull: true,
comment: "Bağışçı Telefon No"
},
donorEmail: {
type: DataTypes.STRING,
allowNull: true,
comment: "Bağışçı Email"
},
donatedProject: {
type: DataTypes.INTEGER,
allowNull: true,
foreignKey: true,
references: {
model: DonatedProjects,
key: 'id',
},
comment: "Bağışlanacak Proje"
},
textApproval: {
type: DataTypes.BOOLEAN,
allowNull: true,
comment: "Bilgilendirme ve rıza metni onayı"
},
kvkkApproval: {
type: DataTypes.BOOLEAN,
allowNull: true,
comment: "KVKK metni onayı"
},
smsApproval: {
type: DataTypes.BOOLEAN,
allowNull: true,
comment: "SMS metni onayı"
},
},
{
sequelize,
tableName: 'demands_talepler',
timestamps: true,
paranoid: true,
}
);
Demands.sync({ alter: true });
module.exports = Demands;