경로 이동

This commit is contained in:
2023-08-18 14:50:09 +00:00
parent 17977b4d96
commit ae22fc7c28
4 changed files with 0 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import { Schema, model, } from 'mongoose';
import { type UserIDType } from './User.js';
export type LogType = 'register'
| 'login_pw' | 'login_token' | 'login_oauth' | 'logout'
| 'change_pw' | 'reset_pw';
const LogTypeList: LogType[] = [
'register',
'login_pw', 'login_token', 'login_oauth', 'logout',
'change_pw', 'reset_pw',
];
interface IUserLog {
userID: UserIDType;
logDate: Date;
logType: LogType;
action: object;
}
export const UserLog = new Schema<IUserLog>({
userID: { type: Number, required: true },
logDate: { type: Date, required: true },
logType: { type: String, required: true, enum: LogTypeList },
action: { type: Object, required: true },
})
.index({ userID: 1, logDate: 1 })
.index({ logDate: 1 })
;
export default model<IUserLog>('UserLog', UserLog);