added a Tor model
This commit is contained in:
parent
097ef744d7
commit
bcca1e1df2
3 changed files with 18 additions and 2 deletions
|
@ -14,9 +14,9 @@ const torCheck = ({ ip, headers, body }, res, next) => {
|
|||
if (ipIsInTorList(ip)) {
|
||||
return res.status('400').json({
|
||||
success: 'false',
|
||||
message: 'Unfortunately this api route is not currently available for tor users. We are working on a solution that will allow tor users to publish in the future.',
|
||||
message: 'Unfortunately this api route is not currently available for tor users. We are working on a solution that will allow tor users to use this endpoint in the future.',
|
||||
});
|
||||
};
|
||||
}
|
||||
return next();
|
||||
};
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ const File = require('./file.js');
|
|||
const Request = require('./request.js');
|
||||
const User = require('./user.js');
|
||||
const Blocked = require('./blocked.js');
|
||||
const Tor = require('./tor.js');
|
||||
|
||||
const {database, username, password} = require('@config/mysqlConfig');
|
||||
if (!database || !username || !password) {
|
||||
|
@ -50,6 +51,7 @@ db['File'] = sequelize.import('File', File);
|
|||
db['Request'] = sequelize.import('Request', Request);
|
||||
db['User'] = sequelize.import('User', User);
|
||||
db['Blocked'] = sequelize.import('Blocked', Blocked);
|
||||
db['Tor'] = sequelize.import('Tor', Tor);
|
||||
|
||||
// run model.association for each model in the db object that has an association
|
||||
logger.info('associating db models...');
|
||||
|
|
14
server/models/tor.js
Normal file
14
server/models/tor.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
module.exports = (sequelize, { STRING }) => {
|
||||
return sequelize.define(
|
||||
'Tor',
|
||||
{
|
||||
ip: {
|
||||
type : STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
freezeTableName: true,
|
||||
}
|
||||
);
|
||||
};
|
Loading…
Add table
Reference in a new issue