remove sync
This commit is contained in:
@@ -66,6 +66,6 @@ AppDemoModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
AppDemoModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('AppDemoModel sync', e);
|
||||
});
|
||||
// AppDemoModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('AppDemoModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -4,22 +4,13 @@ import { OrgInit } from '../auth/models/index.ts';
|
||||
export { User, UserInit, UserServices, UserSecret };
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
const init = async () => {
|
||||
await OrgInit(null, null, {
|
||||
alter: true,
|
||||
logging: false,
|
||||
}).catch((e) => {
|
||||
await OrgInit(null, null).catch((e) => {
|
||||
console.error('Org sync', e);
|
||||
});
|
||||
await UserInit(null, null, {
|
||||
alter: true,
|
||||
logging: false,
|
||||
}).catch((e) => {
|
||||
await UserInit(null, null).catch((e) => {
|
||||
console.error('User sync', e);
|
||||
});
|
||||
await UserSecretInit(null, null, {
|
||||
alter: true,
|
||||
logging: false,
|
||||
}).catch((e) => {
|
||||
await UserSecretInit(null, null).catch((e) => {
|
||||
console.error('UserSecret sync', e);
|
||||
});
|
||||
console.log('Models synced');
|
||||
|
||||
@@ -82,6 +82,6 @@ AppDomainModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
AppDomainModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('AppDomainModel sync', e);
|
||||
});
|
||||
// AppDomainModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('AppDomainModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -51,6 +51,6 @@ AppListModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
AppListModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('AppListModel sync', e);
|
||||
});
|
||||
// AppListModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('AppListModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -155,6 +155,6 @@ AppModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
AppModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('AppModel sync', e);
|
||||
});
|
||||
// AppModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('AppModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -142,8 +142,8 @@ ConfigModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
ConfigModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('ConfigModel sync', e);
|
||||
});
|
||||
// ConfigModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('ConfigModel sync', e);
|
||||
// });
|
||||
|
||||
useContextKey('ConfigModel', () => ConfigModel);
|
||||
|
||||
@@ -96,6 +96,6 @@ ContainerModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
ContainerModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('ContainerModel sync', e);
|
||||
});
|
||||
// ContainerModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('ContainerModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -40,6 +40,6 @@ GithubModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
GithubModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('GithubModel sync', e);
|
||||
});
|
||||
// GithubModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('GithubModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -83,6 +83,6 @@ PageModel.init(
|
||||
},
|
||||
);
|
||||
|
||||
PageModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
console.error('PageModel sync', e);
|
||||
});
|
||||
// PageModel.sync({ alter: true, logging: false }).catch((e) => {
|
||||
// console.error('PageModel sync', e);
|
||||
// });
|
||||
|
||||
@@ -53,23 +53,19 @@ app
|
||||
await setErrorLoginTokenRedis(loginToken);
|
||||
ctx.throw(400, 'token is expired and redirect error');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (!loginToken) {
|
||||
await setErrorLoginTokenRedis(loginToken);
|
||||
ctx.throw(400, 'loginToken is required');
|
||||
}
|
||||
if (!sign) {
|
||||
await setErrorLoginTokenRedis(loginToken);
|
||||
ctx.throw(400, 'sign is required');
|
||||
}
|
||||
|
||||
if (!randomId) {
|
||||
await setErrorLoginTokenRedis(loginToken);
|
||||
ctx.throw(400, 'randomId is required');
|
||||
}
|
||||
const tokenSecret = 'xiao' + randomId;
|
||||
if (sign) {
|
||||
let payload: any = {};
|
||||
try {
|
||||
payload = jsonwebtoken.verify(loginToken, tokenSecret);
|
||||
@@ -84,6 +80,8 @@ app
|
||||
await setErrorLoginTokenRedis(loginToken);
|
||||
ctx.throw(400, 'sign error');
|
||||
}
|
||||
}
|
||||
|
||||
const user = await User.findByPk(tokenUser.id);
|
||||
if (!user) {
|
||||
await setErrorLoginTokenRedis(loginToken);
|
||||
|
||||
Reference in New Issue
Block a user