/** * SMTP 접속 로그 모델 * 25포트로 접근한 클라이언트 IP와 국가 정보를 기록 */ const { DataTypes } = require("sequelize"); const sequelize = require("../config/database"); const SmtpLog = sequelize.define( "SmtpLog", { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, }, remoteAddress: { type: DataTypes.STRING, allowNull: false, comment: "접속한 클라이언트 IP 주소", }, country: { type: DataTypes.STRING(10), allowNull: true, comment: "국가 코드 (예: KR, US)", }, countryName: { type: DataTypes.STRING(100), allowNull: true, comment: "국가 이름 (예: South Korea)", }, hostname: { type: DataTypes.STRING, allowNull: true, comment: "클라이언트 호스트명 (있는 경우)", }, mailFrom: { type: DataTypes.STRING, allowNull: true, comment: "발신자 이메일", }, rcptTo: { type: DataTypes.STRING, allowNull: true, comment: "수신자 이메일", }, success: { type: DataTypes.BOOLEAN, defaultValue: true, comment: "메일 수신 성공 여부", }, isSpam: { type: DataTypes.BOOLEAN, defaultValue: false, comment: "스팸 여부", }, spamScore: { type: DataTypes.FLOAT, allowNull: true, comment: "스팸 점수", }, connectedAt: { type: DataTypes.DATE, defaultValue: DataTypes.NOW, comment: "접속 시간", }, }, { tableName: "smtp_logs", timestamps: false, } ); module.exports = SmtpLog;