오류 수정, 통계 보강

This commit is contained in:
2025-06-08 20:21:37 +09:00
parent 1a3706d7a5
commit 141a0de6d0
42 changed files with 2645 additions and 799 deletions
+63
View File
@@ -0,0 +1,63 @@
const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');
const AverageCache = sequelize.define('AverageCache', {
id: {
type: DataTypes.BIGINT.UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '캐시 고유값'
},
memberId: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
comment: '회원 ID'
},
clubId: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
comment: '클럽 ID'
},
startDate: {
type: DataTypes.DATE,
allowNull: false,
comment: '계산 시작일'
},
endDate: {
type: DataTypes.DATE,
allowNull: false,
comment: '계산 종료일'
},
average: {
type: DataTypes.FLOAT,
allowNull: false,
comment: '에버리지'
},
games: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
comment: '경기수'
},
totalScore: {
type: DataTypes.INTEGER,
allowNull: false,
comment: '총점'
},
expiredAt: {
type: DataTypes.DATE,
allowNull: false,
comment: '만료 시각(TTL)'
}
}, {
tableName: 'AverageCache',
comment: '회원별 기간별 에버리지 캐시 테이블',
timestamps: true,
indexes: [
{
unique: true,
fields: ['memberId', 'clubId', 'startDate', 'endDate']
}
]
});
module.exports = AverageCache;