Now that we've created the user model, we need to connect Sequelize to our PostgreSQL database and put all our models together. You need to add the following code to the /backend/src/models/index.ts file:
// Dependencies
import { Sequelize } from 'sequelize'
// Configuration
import { $db } from '../../config'
// Interfaces
import { IModels } from '../types'
// Db Connection
const { dialect, port, host, database, username, password } = $db
// Connecting to the database
const uri = `${dialect}://${username}:${password}@${host}:${port}/${database}`
const sequelize = new Sequelize(uri)
// Models
const models: IModels = {
User: require('./User').default(sequelize, Sequelize),
sequelize
}
export default models