2024-03-02 23:49:36 +00:00
|
|
|
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
|
2024-02-06 15:18:06 +00:00
|
|
|
|
2024-02-11 01:04:12 +00:00
|
|
|
/**
|
|
|
|
* @typedef {Object} VoiceChannel
|
|
|
|
* @property {string} id A Discord channel ID.
|
|
|
|
* @property {boolean} create Whether or not this channel is registered to create customs when joined.
|
|
|
|
* @property {(string|null)} owner The owner of this channel, if not registered for customs.
|
2024-03-02 22:51:18 +00:00
|
|
|
* @property {string} guild A Discord guild ID as a foreign key reference.
|
2024-02-11 01:40:26 +00:00
|
|
|
* @property {(model: Object) => void} hasMany Defines an One-To-Many relationship.
|
2024-02-11 01:53:28 +00:00
|
|
|
* @property {(conditions: Object) => Promise<VoiceChannel>} findOne Finds one instance in the database matching the provided condition(-s).
|
|
|
|
* @property {(conditions: Object) => Promise<Array<VoiceChannel>>} findAll Finds all instances in the database matching the provided condition(-s).
|
2024-03-03 00:44:27 +00:00
|
|
|
* @property {(conditions: Object) => Promise<VoiceChannel>} findOrCreate Finds or creates an instance in the database matching the provided condition(-s) or default values.
|
2024-02-11 01:04:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The definition of the `VoiceChannel` table in the database.
|
|
|
|
* @param {Sequelize} sequelize
|
|
|
|
* @returns {VoiceChannel}
|
|
|
|
*/
|
2024-02-11 01:55:46 +00:00
|
|
|
export default function (sequelize) {
|
2024-03-02 22:51:18 +00:00
|
|
|
return sequelize.define('VoiceChannels', {
|
2024-02-06 15:18:06 +00:00
|
|
|
id: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
primaryKey: true
|
2024-02-07 19:04:16 +00:00
|
|
|
},
|
|
|
|
create: {
|
2024-02-08 19:37:31 +00:00
|
|
|
type: DataTypes.BOOLEAN,
|
|
|
|
defaultValue: false
|
2024-02-07 19:04:16 +00:00
|
|
|
},
|
|
|
|
owner: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
allowNull: true
|
2024-03-02 22:51:18 +00:00
|
|
|
},
|
|
|
|
guild: {
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
references: {
|
|
|
|
deferrable: Deferrable.INITIALLY_IMMEDIATE,
|
|
|
|
model: 'Guilds',
|
|
|
|
key: 'id'
|
|
|
|
}
|
2024-02-06 15:18:06 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|