rename model code to fit convention

This commit is contained in:
Baipyrus 2024-01-29 14:59:36 +01:00
parent 7468dca986
commit ae8562c536
3 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import defineRoleEmojiPair from './models/roleEmojiPair.js'; import defineRoleEmojiPair from './models/roleEmojiPairs.js';
import defineVoiceChannel from './models/voiceChannel.js'; import defineVoiceChannel from './models/voiceChannels.js';
import defineMessage from './models/message.js'; import defineMessage from './models/messages.js';
import { Sequelize } from 'sequelize'; import { Sequelize } from 'sequelize';
import { config } from 'dotenv'; import { config } from 'dotenv';
config(); config();

View File

@ -1,15 +1,10 @@
import { DataTypes } from "sequelize"; import { DataTypes } from "sequelize";
export default function(sequelize) { export default function(sequelize) {
return sequelize.define('Message', { return sequelize.define('Messages', {
id: { id: {
type: DataTypes.STRING, type: DataTypes.STRING,
primaryKey: true, primaryKey: true,
}, },
roleEmojiPair: {
deferrable: Deferrable.INITIALLY_IMMEDIATE,
model: 'RoleEmojiPair',
key: 'id',
},
}); });
} }

View File

@ -1,12 +1,20 @@
import { DataTypes } from "sequelize"; import { DataTypes, Deferrable } from "sequelize";
export default function(sequelize) { export default function(sequelize) {
return sequelize.define('RoleEmojiPair', { return sequelize.define('RoleEmojiPairs', {
id: { id: {
defaultValue: DataTypes.UUIDV4, defaultValue: DataTypes.UUIDV4,
type: DataTypes.UUID, type: DataTypes.UUID,
primaryKey: true, primaryKey: true,
}, },
message: {
type: DataTypes.STRING,
references: {
deferrable: Deferrable.INITIALLY_IMMEDIATE,
model: 'Messages',
key: 'id',
},
},
role: { role: {
type: DataTypes.STRING, type: DataTypes.STRING,
}, },