WIP token
This commit is contained in:
@ -5,8 +5,8 @@ const { userModel } = require("./userModel");
|
||||
|
||||
sequelize.sync();
|
||||
const apikeyModel = sequelize.define(
|
||||
"apikey",
|
||||
{
|
||||
"apikey",
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
@ -16,39 +16,39 @@ const apikeyModel = sequelize.define(
|
||||
isNumeric: true,
|
||||
},
|
||||
},
|
||||
userid:{
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
validate: {
|
||||
isNumeric: true,
|
||||
},
|
||||
//fk
|
||||
references: {
|
||||
model: userModel,
|
||||
key: "id",
|
||||
},
|
||||
},
|
||||
apikey: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 255,
|
||||
unique: true,
|
||||
validate: {
|
||||
notEmpty: true,
|
||||
len: [1, 255],
|
||||
},
|
||||
},
|
||||
permission: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 255,
|
||||
validate: {
|
||||
notEmpty: true,
|
||||
len: [1, 255],
|
||||
isIn: [['canRead' , 'canWrite']],
|
||||
},
|
||||
},
|
||||
createdAt: {
|
||||
userid: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
validate: {
|
||||
isNumeric: true,
|
||||
},
|
||||
//fk
|
||||
references: {
|
||||
model: userModel,
|
||||
key: "id",
|
||||
},
|
||||
},
|
||||
apikey: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 255,
|
||||
unique: true,
|
||||
validate: {
|
||||
notEmpty: true,
|
||||
len: [1, 255],
|
||||
},
|
||||
},
|
||||
permission: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 255,
|
||||
validate: {
|
||||
notEmpty: true,
|
||||
len: [1, 255],
|
||||
isIn: [["canRead", "canWrite"]],
|
||||
},
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
},
|
||||
@ -56,11 +56,10 @@ const apikeyModel = sequelize.define(
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
|
||||
)
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = { apikeyModel };
|
||||
|
Reference in New Issue
Block a user