feat: enhance router views functionality and permissions

- Added new router views schema and types for better structure and type safety.
- Implemented CRUD operations for router views including listing, updating, retrieving, and deleting views.
- Introduced permission checks to ensure users can only access and modify their own views.
- Updated prompts route to include additional permission checks for updating and retrieving prompts.
- Refactored common query tests to align with new configurations.
- Organized route imports for better maintainability.
This commit is contained in:
2025-12-31 17:55:13 +08:00
parent 8731801b52
commit c6715c2e35
9 changed files with 620 additions and 313 deletions

View File

@@ -1,6 +1,6 @@
import { useConfig, useContextKey } from '@kevisual/context';
import { useConfig } from '@kevisual/use-config';
import { Query } from '@kevisual/query';
import util from 'node:util';
const config = useConfig();
@@ -11,13 +11,13 @@ const token = 'st_r3u38c0jbhoc412ovzeeuaucygt6w5qg';
export const query = new Query({
url: 'http://localhost:4005/api/router',
});
// const loginRes = await query.post({
// path: 'user',
// key: 'login',
// username: 'root',
// password: config.KEVISUAL_PASSWORD ||'',
// });
// console.log('login:', showMore(loginRes));
const loginRes = await query.post({
path: 'user',
key: 'login',
username: 'root',
password: config.KEVISUAL_PASSWORD || '',
});
console.log('login:', showMore(loginRes));
query.beforeRequest = async (options) => {
options.headers = {
...options.headers,