feat: add app-manager for query loading cache
This commit is contained in:
parent
b8fa48e331
commit
e0ac1b7d27
@ -4,4 +4,6 @@ import './user-app.ts';
|
|||||||
import './public/index.ts';
|
import './public/index.ts';
|
||||||
import './domain/index.ts';
|
import './domain/index.ts';
|
||||||
|
|
||||||
|
import './proxy/index.ts';
|
||||||
|
|
||||||
export * from './module/index.ts';
|
export * from './module/index.ts';
|
||||||
|
1
src/routes/app-manager/proxy/index.ts
Normal file
1
src/routes/app-manager/proxy/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
import './page-proxy.ts';
|
29
src/routes/app-manager/proxy/page-proxy.ts
Normal file
29
src/routes/app-manager/proxy/page-proxy.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { app, redis } from '@/app.ts';
|
||||||
|
app
|
||||||
|
.route({
|
||||||
|
path: 'page-proxy-app',
|
||||||
|
key: 'status',
|
||||||
|
})
|
||||||
|
.define(async (ctx) => {
|
||||||
|
//
|
||||||
|
const { user, app } = ctx.query;
|
||||||
|
if (!user || !app) {
|
||||||
|
ctx.body = {
|
||||||
|
code: 400,
|
||||||
|
message: 'user and app are required',
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const key = `user:app:status:${app}:${user}`;
|
||||||
|
const status = await redis.get(key);
|
||||||
|
if (!status) {
|
||||||
|
ctx.throw(404, 'status not found');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const parsedStatus = JSON.parse(status);
|
||||||
|
ctx.body = parsedStatus;
|
||||||
|
} catch (e) {
|
||||||
|
ctx.throw(400, 'status is not a valid json');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.addTo(app);
|
@ -1 +1 @@
|
|||||||
Subproject commit 0c36328ac3e728e7978cca03bb187fb4e841f6d8
|
Subproject commit 60c5a986edd4add11b229b2d3c869dcdf32c0428
|
Loading…
x
Reference in New Issue
Block a user