UNPKG

@xrengine/server-core

Version:

Shared components for XREngine server

29 lines (23 loc) 862 B
import { Model, Sequelize } from 'sequelize' import { SeatInterface } from '@xrengine/common/src/dbmodels/Seat' import { Application } from '../../../declarations' export default (app: Application) => { const sequelizeClient: Sequelize = app.get('sequelizeClient') const seat = sequelizeClient.define<Model<SeatInterface>>( 'seat', {}, { hooks: { beforeCount(options: any): void { options.raw = true } } } ) ;(seat as any).associate = (models: any): void => { ;(seat as any).belongsTo(models.subscription, { foreignKey: { name: 'subscriptionId', allowNull: false } }) ;(seat as any).belongsTo(models.user, { foreignKey: { name: 'userId', allowNull: false } }) ;(seat as any).belongsTo(models.seat_status, { foreignKey: { name: 'seatStatus', allowNull: false } }) } return seat }