remove sync

This commit is contained in:
2025-12-28 16:16:23 +08:00
parent 9f51d27398
commit df6db9d88b
10 changed files with 42 additions and 53 deletions

View File

@@ -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);
// });

View File

@@ -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');

View File

@@ -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);
// });

View File

@@ -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);
// });

View File

@@ -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);
// });

View File

@@ -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);

View File

@@ -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);
// });

View File

@@ -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);
// });

View File

@@ -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);
// });

View File

@@ -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);