I'm creating an app with Node.js, Sequelize, Mysql, Express. I'm very new to this, sorry if this question is stupid.

I have two models with a one to many relation : User and Token (a user has multiple tokens, a token has one user).

Here are the files :

models/user.js

```
const { Sequelize, DataTypes } = require('sequelize');
const Token = require('./token')
const db = require('../db/sequelize'),
      sequelize = db.sequelize,
      jwt = require('jsonwebtoken')

// Model for a user (player)

const User = sequelize.define('User', {
    // All the columns
})

User.gAuth = async function(user) {
    const token = jwt.sign({id: user.id.toString() },
        'password',
        {
            expiresIn: '7 days'
        })

    console.log(token)
    console.log(Token)

    const newToken = Token.create({
        token,
        user: this.id
    })

    console.log(newToken)

    await newToken.save()

    return token

}

module.exports = User

```

It's on "const newToken = Token.create({...})" that I have my error. It says : "Token.create is not a function". I tried with build, I had : "TypeError: Token.build is not a function".

models/token.js

```
const { Sequelize, DataTypes } = require('sequelize');
const db = require('../db/sequelize'),
    sequelize = db.sequelize
const User = require('./user')

const Token = sequelize.define('Token', {
    // All the columns
})

User.hasMany(Token, {
    as: 'tokens'
})

Token.belongsTo(User, {
    foreignKey: 'UserId',
    as: 'user'
})

module.exports = Token

```

Can you please help me understands what I'm doing wrong ? All the answers I've found were about bad export of the Model, but I don't see my error.

Thank you !

EDIT :

When I console.log(sequelize.models) in models/token.js it returns : { User: User, Token: Token }

However ! When I console.log(sequelize.models) in models/user.js it retuns : { User: User }