57 lines
1015 B
JavaScript
57 lines
1015 B
JavaScript
const { sequelize } = require('../index');
|
|
const Sequelize = require('sequelize');
|
|
|
|
const Users = sequelize.define('users', {
|
|
id: {
|
|
type: Sequelize.STRING,
|
|
primaryKey: true,
|
|
unique: true,
|
|
},
|
|
teamId: {
|
|
type: Sequelize.STRING,
|
|
},
|
|
moderator: {
|
|
type: Sequelize.BOOLEAN,
|
|
defaultValue: false,
|
|
},
|
|
admin: {
|
|
type: Sequelize.BOOLEAN,
|
|
defaultValue: false,
|
|
},
|
|
});
|
|
|
|
const Teams = sequelize.define('teams', {
|
|
name: {
|
|
type: Sequelize.STRING,
|
|
unique: true,
|
|
validate: {
|
|
len: [3, 16],
|
|
isAlphanumeric: true,
|
|
},
|
|
},
|
|
color: {
|
|
type: Sequelize.STRING,
|
|
validate: {
|
|
is: /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,
|
|
},
|
|
},
|
|
});
|
|
|
|
const Minecraft = sequelize.define('minecraft', {
|
|
uuid: {
|
|
type: Sequelize.UUID,
|
|
unique: true,
|
|
primaryKey: true,
|
|
},
|
|
whitelisted: {
|
|
type: Sequelize.BOOLEAN,
|
|
defaultValue: false,
|
|
},
|
|
code: {
|
|
type: Sequelize.STRING,
|
|
unique: true,
|
|
},
|
|
});
|
|
|
|
module.exports = { Users, Teams, Minecraft };
|