actaeon/src/routes.ts

71 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-03-12 10:52:13 +00:00
import { UserPayload } from '@/types/user';
2024-03-28 00:34:41 +00:00
import { UserPermissions } from '@/types/permissions';
2024-03-12 10:52:13 +00:00
export type UserOnly = boolean | keyof UserPayload;
2024-03-28 00:34:41 +00:00
export type Subroute = {
2024-03-12 10:52:13 +00:00
url: string,
name: string,
2024-03-28 00:34:41 +00:00
userOnly?: UserOnly,
permissions?: (UserPermissions | UserPermissions[])[],
routes?: Omit<Subroute, 'routes'>[]
2024-03-12 10:52:13 +00:00
};
2024-03-28 00:34:41 +00:00
export type Route = {
2024-03-12 10:52:13 +00:00
url: string,
name: string,
title: string,
userOnly?: UserOnly,
2024-03-28 00:34:41 +00:00
permissions?: (UserPermissions | UserPermissions[])[],
2024-03-12 10:52:13 +00:00
routes: Subroute[]
};
export const MAIN_ROUTES: Route = {
url: '/',
name: "Actaeon",
title: 'Actaeon',
routes: [{
url: '/dashboard',
name: 'Overview'
2024-03-25 01:47:52 +00:00
}, {
url: '/arcade',
name: 'Arcades'
2024-03-28 00:34:41 +00:00
}, {
url: '/admin',
name: 'Admin',
permissions: [[UserPermissions.USERMOD, UserPermissions.SYSADMIN]],
routes: [{
url: '/admin/users',
name: 'Users',
permissions: [UserPermissions.USERMOD]
}, {
url: '/admin/system-config',
name: 'System Config',
permissions: [UserPermissions.SYSADMIN]
}]
2024-03-12 10:52:13 +00:00
}]
};
export const ROUTES: Route[] = [{
url: '/chuni',
name: 'Chunithm',
title: 'Chunithm',
userOnly: 'chuni',
routes: [{
url: '/chuni/dashboard',
name: 'Dashboard',
userOnly: 'chuni'
}, {
url: '/chuni/music',
name: 'Music List'
}, {
url: '/chuni/playlog',
name: 'Playlog',
userOnly: 'chuni'
}, {
url: '/chuni/userbox',
name: 'Userbox',
userOnly: 'chuni'
}]
}, MAIN_ROUTES];