Загрузка данных
import { auditApi as api } from "./api";
export const addTagTypes = ["Message", "Calls"] as const;
const injectedRtkApi = api
.enhanceEndpoints({
addTagTypes,
})
.injectEndpoints({
endpoints: (build) => ({
getApiV1Message: build.query<
GetApiV1MessageApiResponse,
GetApiV1MessageApiArg
>({
query: (queryArg) => ({
url: `/api/v1/message`,
params: {
source: queryArg.source,
type: queryArg["type"],
userId: queryArg.userId,
userIp: queryArg.userIp,
userLogin: queryArg.userLogin,
smartroomId: queryArg.smartroomId,
sortType: queryArg.sortType,
tmMin: queryArg.tmMin,
tmMax: queryArg.tmMax,
limit: queryArg.limit,
offset: queryArg.offset,
},
}),
providesTags: ["Message"],
}),
getApiV1MessageTypes: build.query<
GetApiV1MessageTypesApiResponse,
GetApiV1MessageTypesApiArg
>({
query: () => ({ url: `/api/v1/message/types` }),
providesTags: ["Message"],
}),
getApiV1MessageCursor: build.query<
GetApiV1MessageCursorApiResponse,
GetApiV1MessageCursorApiArg
>({
query: (queryArg) => ({
url: `/api/v1/message/cursor`,
params: {
source: queryArg.source,
type: queryArg["type"],
userId: queryArg.userId,
userIp: queryArg.userIp,
userLogin: queryArg.userLogin,
smartroomId: queryArg.smartroomId,
sortType: queryArg.sortType,
tmMin: queryArg.tmMin,
tmMax: queryArg.tmMax,
limit: queryArg.limit,
cursorId: queryArg.cursorId,
cursorDate: queryArg.cursorDate,
direction: queryArg.direction,
},
}),
providesTags: ["Message"],
}),
getApiV1MessageCursorCount: build.query<
GetApiV1MessageCursorCountApiResponse,
GetApiV1MessageCursorCountApiArg
>({
query: (queryArg) => ({
url: `/api/v1/message/cursorCount`,
params: {
source: queryArg.source,
type: queryArg["type"],
userId: queryArg.userId,
userIp: queryArg.userIp,
userLogin: queryArg.userLogin,
smartroomId: queryArg.smartroomId,
sortType: queryArg.sortType,
tmMin: queryArg.tmMin,
tmMax: queryArg.tmMax,
limit: queryArg.limit,
cursorId: queryArg.cursorId,
cursorDate: queryArg.cursorDate,
direction: queryArg.direction,
},
}),
providesTags: ["Message"],
}),
getApiV1Call: build.query<GetApiV1CallApiResponse, GetApiV1CallApiArg>({
query: (queryArg) => ({
url: `/api/v1/call`,
params: {
type: queryArg["type"],
locationId: queryArg.locationId,
tmMin: queryArg.tmMin,
tmMax: queryArg.tmMax,
limit: queryArg.limit,
offset: queryArg.offset,
},
}),
providesTags: ["Calls"],
}),
getApiV1CallTypes: build.query<
GetApiV1CallTypesApiResponse,
GetApiV1CallTypesApiArg
>({
query: () => ({ url: `/api/v1/call/types` }),
providesTags: ["Calls"],
}),
}),
overrideExisting: false,
});
export { injectedRtkApi as client };
export type GetApiV1MessageApiResponse =
/** status 200 OK */ MessagesGetResponse;
export type GetApiV1MessageApiArg = {
/** Сервис (monitoring/auth) */
source?: Source;
/** Тип событий */
type?: string;
/** UUID пользователя */
userId?: string;
/** IP-адрес пользователя */
userIp?: string;
/** Логин пользователя */
userLogin?: string;
/** UUID внутри smartroom */
smartroomId?: string;
/** тип сортировки по дате */
sortType?: SortType;
/** минимальный timestamp (время в секундах) */
tmMin?: number;
/** максимальный timestamp (время в секундах) */
tmMax?: number;
/** Минимальное количество событий на странице */
limit?: number;
/** Смещение событий */
offset?: number;
};
export type GetApiV1MessageTypesApiResponse =
/** status 200 OK */ MessageTypesResponse;
export type GetApiV1MessageTypesApiArg = void;
export type GetApiV1MessageCursorApiResponse =
/** status 200 OK */ MessageCursorGetResponse;
export type GetApiV1MessageCursorApiArg = {
/** Сервис (monitoring/auth) */
source?: Source;
/** Тип событий */
type?: string;
/** UUID пользователя */
userId?: string;
/** IP-адрес пользователя */
userIp?: string;
/** Логин пользователя */
userLogin?: string;
/** UUID внутри smartroom */
smartroomId?: string;
/** тип сортировки по дате */
sortType?: SortType;
/** минимальный timestamp */
tmMin?: string;
/** максимальный timestamp */
tmMax?: string;
/** аксимальное количество событий на странице */
limit?: number;
/** Cursor ID (UUID) for pagination. Must be provided together with cursorDate */
cursorId?: string;
/** Cursor date timestamp (RFC3339Nano format) for pagination. Must be provided together with cursorId */
cursorDate?: string;
/** Pagination direction. Use "next" to get next page (default) or "prev" to get previous page */
direction?: "next" | "prev";
};
export type GetApiV1MessageCursorCountApiResponse =
/** status 200 Count of records */ number;
export type GetApiV1MessageCursorCountApiArg = {
/** Сервис (monitoring/auth) */
source?: Source;
/** Тип событий */
type?: string;
/** UUID пользователя */
userId?: string;
/** IP-адрес пользователя */
userIp?: string;
/** Логин пользователя */
userLogin?: string;
/** UUID внутри smartroom */
smartroomId?: string;
/** тип сортировки по дате */
sortType?: SortType;
/** минимальный timestamp */
tmMin?: string;
/** максимальный timestamp */
tmMax?: string;
/** Минимальное количество событий на странице */
limit?: number;
/** Cursor ID (UUID) for pagination. Must be provided together with cursorDate */
cursorId?: string;
/** Cursor date timestamp (RFC3339Nano format) for pagination. Must be provided together with cursorId */
cursorDate?: string;
/** Pagination direction. Use "next" to get next page (default) or "prev" to get previous page */
direction?: "next" | "prev";
};
export type GetApiV1CallApiResponse = /** status 200 OK */ CallsGetResponse;
export type GetApiV1CallApiArg = {
/** Call type */
type?: string;
/** Location ID */
locationId?: string;
/** min timestamp (time in seconds) */
tmMin?: number;
/** max timestamp (time in seconds) */
tmMax?: number;
/** Rows number on the page (pagination parameter) */
limit?: number;
/** The number of records you wish to skip before selecting records (pagination parameter) */
offset?: number;
};
export type GetApiV1CallTypesApiResponse =
/** status 200 OK */ CallTypesResponse;
export type GetApiV1CallTypesApiArg = void;
export type UserRole = "user" | "admin";
export type User = {
id?: string;
ip?: string;
agent?: string;
fullName?: string;
logins?: {
sigma?: string;
omega?: string;
};
emails?: {
external?: string;
internal?: string;
};
role?: UserRole;
};
export type Message = {
id?: string;
user?: User;
date?: string;
source?: string;
type?: string;
attrs?: object;
};
export type MessagesGetResponse = {
messages?: Message[];
total?: number;
};
export type Source =
| "smartroom-monitoring"
| "smartroom-auth"
| "smartroom-notifications";
export type SortType = "desc" | "asc";
export type MessageTypesResponse = {
types?: (
| "log_out"
| "sign_in"
| "user_register"
| "user_update"
| "user_delete"
| "contractor_create"
| "contractor_update"
| "contractor_delete"
| "controller_create"
| "controller_update"
| "controller_delete"
| "controller_model_create"
| "controller_model_update"
| "controller_model_delete"
| "controller_type_create"
| "controller_type_update"
| "controller_type_delete"
| "device_create"
| "device_update"
| "device_delete"
| "device_type_create"
| "device_type_update"
| "device_type_delete"
| "device_model_create"
| "device_model_update"
| "device_model_delete"
| "interface_name_create"
| "interface_name_update"
| "interface_name_delete"
| "interface_value_create"
| "interface_value_update"
| "interface_value_delete"
| "location_create"
| "location_update"
| "location_delete"
| "location_note_create"
| "location_note_update"
| "location_note_delete"
| "location_ticket_create"
| "location_ticket_update"
| "location_ticket_delete"
| "manufacturer_create"
| "manufacturer_update"
| "manufacturer_delete"
| "notification_archive"
| "notification_archive_all"
| "notification_read"
| "notification_read_all"
| "equipment_disable"
| "equipment_enable"
| "location_disable"
| "location_enable"
)[];
};
export type Cursor = {
date?: string;
id: string;
};
export type MessageCursorGetResponse = {
messages: Message[];
hasNext: boolean;
hasPrev: boolean;
nextCursor?: Cursor | null;
prevCursor?: Cursor | null;
total?: number;
};
export type Call = {
id?: string;
employee_number?: string;
destination?: string;
type?: string;
location_id?: string;
attrs?: object;
date?: string;
};
export type CallsGetResponse = {
calls?: Call[];
total?: number;
};
export type CallTypesResponse = {
types?: (
| "call_start"
| "call_end"
| "call_start_vip"
| "call_end_vip"
| "call_start_common"
| "call_end_common"
)[];
};
export const {
useGetApiV1MessageQuery,
useGetApiV1MessageTypesQuery,
useGetApiV1MessageCursorQuery,
useGetApiV1MessageCursorCountQuery,
useGetApiV1CallQuery,
useGetApiV1CallTypesQuery,
} = injectedRtkApi;
{
"sign_in": "Вход",
"log_out": "Выход",
"user_register": "Регистрация пользователя",
"user_update": "Обновление пользователя",
"user_delete": "Удаление пользователя",
"manufacturer_create": "Создание производителя",
"manufacturer_update": "Обновление производителя",
"manufacturer_delete": "Удаление производителя",
"controller_create": "Создание контроллера",
"controller_update": "Обновление контроллера",
"controller_delete": "Удаления контроллера",
"controller_model_create": "Создание модели контроллера",
"controller_model_update": "Обновление модели контроллера",
"controller_model_delete": "Удаление модели контроллера",
"controller_type_create": "Создание типа контроллера",
"controller_type_update": "Обновление типа контроллера",
"controller_type_delete": "Удаление типа контроллера",
"device_create": "Создание устройства",
"device_update": "Обновление устройства",
"device_delete": "Удаление устройства",
"device_type_create": "Создание типа устройства",
"device_type_update": "Обновление типа устройства",
"device_type_delete": "Удаление типа устройства",
"device_model_create": "Создание модели устройства",
"device_model_update": "Обновление модели устройства",
"device_model_delete": "Удаление модели устройства",
"location_create": "Создание локации",
"location_update": "Обновление локации",
"location_delete": "Удаление локации",
"location_note_create": "Создание заметки локации",
"location_note_update": "Обновление заметки локации",
"location_note_delete": "Удаление заметки локации",
"location_ticket_create": "Создание заявки для локации",
"location_ticket_update": "Обновление заявки для локации",
"location_ticket_delete": "Удаление заявки для локации",
"location_ticket_archive": "Архивирование заявки для локации",
"service_status_create": "Обновление сервисного статуса локации",
"interface_name_create": "Создание имени интерфейса",
"interface_name_update": "Обновление имени интерфейса",
"interface_name_delete": "Удаление имени интерфейса",
"interface_value_create": "Создание значения интерфейса",
"interface_value_update": "Обновление значения интерфейса",
"interface_value_delete": "Удаление значения интерфейса",
"contractor_create": "Создание подрядчика",
"contractor_update": "Обновление подрядчика",
"contractor_delete": "Удаление подрядчика",
"network_device_create": "Создание самостоятельного сетевого устройства",
"network_device_update": "Обновление самостоятельного сетевого устройства",
"network_device_delete": "Удаление самостоятельного сетевого устройства",
"offline_device_create": "Создание самостоятельного несетевого устройства",
"offline_device_update": "Обновление самостоятельного несетевого устройства",
"offline_device_delete": "Удаление самостоятельного несетевого устройства",
"notification_archive": "Архивирование уведомления",
"notification_archive_all": "Архивирование всех уведомлений",
"notification_read": "Прочтение уведомления",
"notification_read_all": "Прочтение всех уведомлений",
"actionType": "Тип действия",
"actionDetails": "Детали события",
"sortBy": {
"status": "по статусу",
"created_at": "по дате создания",
"updated_at": "по дате обновления"
}
}
{
"sign_in": "Sign in",
"log_out": "Log out",
"user_register": "User registration",
"user_update": "User update",
"user_delete": "User delete",
"manufacturer_create": "Manufacturer create",
"manufacturer_update": "Manufacturer update",
"manufacturer_delete": "Manufacturer delete",
"controller_create": "Controller create",
"controller_update": "Controller update",
"controller_delete": "Controller delete",
"controller_model_create": "Controller model create",
"controller_model_update": "Controller model update",
"controller_model_delete": "Controller model delete",
"controller_type_create": "Controller type create",
"controller_type_update": "Controller type update",
"controller_type_delete": "Controller type delete",
"device_create": "Device create",
"device_update": "Device update",
"device_delete": "Device delete",
"device_type_create": "Device type create",
"device_type_update": "Device type update",
"device_type_delete": "Device type delete",
"device_model_create": "Device model create",
"device_model_update": "Device model update",
"device_model_delete": "Device model delete",
"location_create": "Location create",
"location_update": "Location update",
"location_delete": "Location delete",
"location_note_create": "Location note create",
"location_note_update": "Location note update",
"location_note_delete": "Location note delete",
"location_ticket_create": "Location ticket create",
"location_ticket_update": "Location ticket update",
"location_ticket_delete": "Location ticket delete",
"location_ticket_archive": "Location ticket archive",
"service_status_create": "Location Service Status Update",
"interface_name_create": "Interface name create",
"interface_name_update": "Interface name update",
"interface_name_delete": "Interface name delete",
"interface_value_create": "Interface value create",
"interface_value_update": "Interface value update",
"interface_value_delete": "Interface value delete",
"contractor_create": "Contractor create",
"contractor_update": "Contractor update",
"contractor_delete": "Contractor delete",
"network_device_create": "Independent Network equipment create",
"network_device_update": "Independent Network equipment update",
"network_device_delete": "Independent Network equipment delete",
"offline_device_create": "Independent Offline equipment create",
"offline_device_update": "Independent Offline equipment update",
"offline_device_delete": "Independent Offline equipment delete",
"notification_archive": "Notification archived",
"notification_archive_all": "All notifications archived",
"notification_read": "Notification read",
"notification_read_all": "All notifications read",
"actionType": "Action type",
"actionDetails": "Action details",
"sortBy": {
"status": "by status",
"created_at": "by date created",
"updated_at": "by date updated"
}
}