после загрузки основного функционала

This commit is contained in:
Mikan
2025-06-03 01:48:46 +03:00
parent 6ede1ca15f
commit 5e198c8b56
5 changed files with 345 additions and 85 deletions

View File

@@ -50,6 +50,12 @@ export interface PageControl<T>{
nextPage(): void;
previousPage(): void;
}
export interface FieldInfo {
name: string;
type: string;
title: string;
format?: string;
}
```
`types/survey.ts`
```ts
@@ -113,12 +119,10 @@ export interface ContactData{
phone?: string;
email?:string;
}
interface Role extends UniqueItem{
title: string;
}
export interface Account extends UniqueItem, ContactData{
login: string;
role?: Role;
role?: number;
roleTitle?: string;
is_staff: boolean;
is_active: boolean;
}
@@ -235,6 +239,21 @@ export function ProfessionPage() {
}
```
### Автодокументация
`api/hooks.ts`
```ts
/**
* Хук для получения документации swagger JSON и извлечения структур.
* @param applicationName Название модуля/приложения.
* @param endpointName Название эндпоинта.
* @returns Массив структур без ID с полями: название, тип, title, format.
*/
export function useApiDocumentation(
applicationName: string,
endpointName: string
): { schema: FieldInfo[] | null; loading: boolean; error: Error | null }
```
### Авторизация