Frontend: - Replace Next.js with Vite + React + TypeScript - Add new component architecture (app-shell, sidebar, dashboard modules) - Implement product modules: FRAME, safety protocols, walkthrough checkin, campus/staff attendance, personality quiz, sign language, classroom timer - Add shadcn/ui component library with Tailwind CSS - Remove legacy generated components, stores, and pages Backend: - Add product migrations: frame_entries, user_progress, safety_quiz_results, walkthrough_checkins, communication_events, personality_quiz_results, campus_attendance_config/summaries, staff_attendance_records, content_catalog - Add corresponding models, services, and routes - Implement cookie-based auth with refresh token rotation - Add content catalog seeder with product content - Migrate to ESLint flat config - Switch from yarn to npm Infrastructure: - Update .gitignore for new tooling - Add project documentation (CLAUDE.md, docs/) - Remove deprecated config files and yarn.lock Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
78 lines
1.6 KiB
JavaScript
78 lines
1.6 KiB
JavaScript
module.exports = function(sequelize, DataTypes) {
|
|
const auth_refresh_tokens = sequelize.define(
|
|
'auth_refresh_tokens',
|
|
{
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true,
|
|
},
|
|
userId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
},
|
|
organizationId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: true,
|
|
},
|
|
tokenHash: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
unique: true,
|
|
},
|
|
familyId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
},
|
|
previousTokenId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: true,
|
|
},
|
|
userAgent: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
},
|
|
ipAddress: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
},
|
|
expiresAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
},
|
|
revokedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: true,
|
|
},
|
|
replacedByTokenId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: true,
|
|
},
|
|
},
|
|
{
|
|
timestamps: true,
|
|
freezeTableName: true,
|
|
},
|
|
);
|
|
|
|
auth_refresh_tokens.associate = (db) => {
|
|
db.auth_refresh_tokens.belongsTo(db.users, {
|
|
as: 'user',
|
|
foreignKey: {
|
|
name: 'userId',
|
|
},
|
|
constraints: false,
|
|
});
|
|
|
|
db.auth_refresh_tokens.belongsTo(db.organizations, {
|
|
as: 'organization',
|
|
foreignKey: {
|
|
name: 'organizationId',
|
|
},
|
|
constraints: false,
|
|
});
|
|
};
|
|
|
|
return auth_refresh_tokens;
|
|
};
|