From a4b62c76a8857f9126ab2073e17395bb2bade3f1 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Mon, 27 Dec 2021 15:18:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D1=8B=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/api/index.ts | 8 +- src/services/api/models/ClusterDto.ts | 3 + .../{WellParamsDto.ts => DepositBaseDto.ts} | 5 +- src/services/api/models/PermissionBaseDto.ts | 9 -- src/services/api/models/PermissionDto.ts | 7 +- src/services/api/models/PermissionInfoDto.ts | 10 -- src/services/api/models/RequestLogUserDto.ts | 16 +++ src/services/api/models/StatOperationsDto.ts | 4 +- src/services/api/models/TelemetryBaseDto.ts | 11 ++ src/services/api/models/TelemetryDto.ts | 3 + src/services/api/models/UserDto.ts | 1 + src/services/api/models/UserExtendedDto.ts | 1 + .../api/models/UserRegistrationDto.ts | 1 + src/services/api/models/UserRoleDto.ts | 4 +- src/services/api/models/UserTokenDto.ts | 5 +- src/services/api/models/WellDto.ts | 7 +- src/services/api/models/WellInfoDto.ts | 9 ++ .../services/AdminPermissionInfoService.ts | 90 --------------- .../api/services/AdminPermissionService.ts | 106 ++++++++++-------- .../api/services/AdminTelemetryService.ts | 23 +--- src/services/api/services/MeasureService.ts | 8 +- .../api/services/RequerstTrackerService.ts | 5 +- .../api/services/WellOperationService.ts | 16 +++ src/services/api/services/WellService.ts | 16 +-- src/utils/index.ts | 2 +- 25 files changed, 157 insertions(+), 213 deletions(-) rename src/services/api/models/{WellParamsDto.ts => DepositBaseDto.ts} (67%) delete mode 100644 src/services/api/models/PermissionBaseDto.ts delete mode 100644 src/services/api/models/PermissionInfoDto.ts create mode 100644 src/services/api/models/RequestLogUserDto.ts create mode 100644 src/services/api/models/TelemetryBaseDto.ts create mode 100644 src/services/api/models/WellInfoDto.ts delete mode 100644 src/services/api/services/AdminPermissionInfoService.ts diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 21fd12a..2df1212 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -9,6 +9,7 @@ export type { ClusterDto } from './models/ClusterDto'; export type { ClusterRopStatDto } from './models/ClusterRopStatDto'; export type { CompanyDto } from './models/CompanyDto'; export type { DatesRangeDto } from './models/DatesRangeDto'; +export type { DepositBaseDto } from './models/DepositBaseDto'; export type { DepositDto } from './models/DepositDto'; export type { DrillFlowChartDto } from './models/DrillFlowChartDto'; export type { DrillParamsDto } from './models/DrillParamsDto'; @@ -20,9 +21,8 @@ export type { FilePublishInfoDto } from './models/FilePublishInfoDto'; export type { MeasureDto } from './models/MeasureDto'; export type { MessageDto } from './models/MessageDto'; export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; -export type { PermissionBaseDto } from './models/PermissionBaseDto'; export type { PermissionDto } from './models/PermissionDto'; -export type { PermissionInfoDto } from './models/PermissionInfoDto'; +export type { RequestLogUserDto } from './models/RequestLogUserDto'; export type { SetpointInfoDto } from './models/SetpointInfoDto'; export type { SetpointsRequestDto } from './models/SetpointsRequestDto'; export type { StatClusterDto } from './models/StatClusterDto'; @@ -30,6 +30,7 @@ export type { StatOperationsDto } from './models/StatOperationsDto'; export type { StatOperationsDtoPlanFactBase } from './models/StatOperationsDtoPlanFactBase'; export type { StatSectionDto } from './models/StatSectionDto'; export type { StatWellDto } from './models/StatWellDto'; +export type { TelemetryBaseDto } from './models/TelemetryBaseDto'; export type { TelemetryDataSaubDto } from './models/TelemetryDataSaubDto'; export type { TelemetryDataSpinDto } from './models/TelemetryDataSpinDto'; export type { TelemetryDto } from './models/TelemetryDto'; @@ -49,16 +50,15 @@ export type { WellCompositeDto } from './models/WellCompositeDto'; export type { WellDepthToDayDto } from './models/WellDepthToDayDto'; export type { WellDepthToIntervalDto } from './models/WellDepthToIntervalDto'; export type { WellDto } from './models/WellDto'; +export type { WellInfoDto } from './models/WellInfoDto'; export type { WellOperationCategoryDto } from './models/WellOperationCategoryDto'; export type { WellOperationDto } from './models/WellOperationDto'; export type { WellOperationDtoPaginationContainer } from './models/WellOperationDtoPaginationContainer'; export type { WellOperationDtoPlanFactPredictBase } from './models/WellOperationDtoPlanFactPredictBase'; -export type { WellParamsDto } from './models/WellParamsDto'; export { AdminClusterService } from './services/AdminClusterService'; export { AdminCompanyService } from './services/AdminCompanyService'; export { AdminDepositService } from './services/AdminDepositService'; -export { AdminPermissionInfoService } from './services/AdminPermissionInfoService'; export { AdminPermissionService } from './services/AdminPermissionService'; export { AdminTelemetryService } from './services/AdminTelemetryService'; export { AdminUserRoleService } from './services/AdminUserRoleService'; diff --git a/src/services/api/models/ClusterDto.ts b/src/services/api/models/ClusterDto.ts index b802a01..2aced28 100644 --- a/src/services/api/models/ClusterDto.ts +++ b/src/services/api/models/ClusterDto.ts @@ -2,6 +2,7 @@ /* tslint:disable */ /* eslint-disable */ +import type { DepositBaseDto } from './DepositBaseDto'; import type { WellDto } from './WellDto'; export type ClusterDto = { @@ -9,5 +10,7 @@ export type ClusterDto = { caption?: string | null; latitude?: number | null; longitude?: number | null; + idDeposit?: number | null; + deposit?: DepositBaseDto; wells?: Array | null; } diff --git a/src/services/api/models/WellParamsDto.ts b/src/services/api/models/DepositBaseDto.ts similarity index 67% rename from src/services/api/models/WellParamsDto.ts rename to src/services/api/models/DepositBaseDto.ts index 4f01852..e7844ea 100644 --- a/src/services/api/models/WellParamsDto.ts +++ b/src/services/api/models/DepositBaseDto.ts @@ -2,10 +2,9 @@ /* tslint:disable */ /* eslint-disable */ -export type WellParamsDto = { +export type DepositBaseDto = { + id?: number; caption?: string | null; latitude?: number | null; longitude?: number | null; - idWellType?: number; - idState?: number; } diff --git a/src/services/api/models/PermissionBaseDto.ts b/src/services/api/models/PermissionBaseDto.ts deleted file mode 100644 index f6b16de..0000000 --- a/src/services/api/models/PermissionBaseDto.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export type PermissionBaseDto = { - idPermissionInfo?: number; - permissionName?: string | null; - value?: number; -} diff --git a/src/services/api/models/PermissionDto.ts b/src/services/api/models/PermissionDto.ts index 955fb61..2b6ee5b 100644 --- a/src/services/api/models/PermissionDto.ts +++ b/src/services/api/models/PermissionDto.ts @@ -3,8 +3,7 @@ /* eslint-disable */ export type PermissionDto = { - idPermissionInfo?: number; - permissionName?: string | null; - value?: number; - idUserRole?: number; + id?: number; + name?: string | null; + description?: string | null; } diff --git a/src/services/api/models/PermissionInfoDto.ts b/src/services/api/models/PermissionInfoDto.ts deleted file mode 100644 index 191d91c..0000000 --- a/src/services/api/models/PermissionInfoDto.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export type PermissionInfoDto = { - id?: number; - name?: string | null; - description?: string | null; - bitDescription?: Record | null; -} diff --git a/src/services/api/models/RequestLogUserDto.ts b/src/services/api/models/RequestLogUserDto.ts new file mode 100644 index 0000000..e8254da --- /dev/null +++ b/src/services/api/models/RequestLogUserDto.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { UserDto } from './UserDto'; + +export type RequestLogUserDto = { + userId?: number; + login?: string | null; + ip?: string | null; + elapsedMs?: number; + lastDate?: string; + requests?: number; + errors?: number; + user?: UserDto; +} diff --git a/src/services/api/models/StatOperationsDto.ts b/src/services/api/models/StatOperationsDto.ts index 40c7510..51af309 100644 --- a/src/services/api/models/StatOperationsDto.ts +++ b/src/services/api/models/StatOperationsDto.ts @@ -3,8 +3,8 @@ /* eslint-disable */ export type StatOperationsDto = { - start?: string; - end?: string; + start?: string | null; + end?: string | null; wellDepthStart?: number; wellDepthEnd?: number; routeSpeed?: number; diff --git a/src/services/api/models/TelemetryBaseDto.ts b/src/services/api/models/TelemetryBaseDto.ts new file mode 100644 index 0000000..c454dab --- /dev/null +++ b/src/services/api/models/TelemetryBaseDto.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { TelemetryInfoDto } from './TelemetryInfoDto'; + +export type TelemetryBaseDto = { + id?: number; + remoteUid?: string | null; + info?: TelemetryInfoDto; +} diff --git a/src/services/api/models/TelemetryDto.ts b/src/services/api/models/TelemetryDto.ts index b152295..c85ab5f 100644 --- a/src/services/api/models/TelemetryDto.ts +++ b/src/services/api/models/TelemetryDto.ts @@ -3,9 +3,12 @@ /* eslint-disable */ import type { TelemetryInfoDto } from './TelemetryInfoDto'; +import type { WellInfoDto } from './WellInfoDto'; export type TelemetryDto = { id?: number; remoteUid?: string | null; info?: TelemetryInfoDto; + idWell?: number | null; + well?: WellInfoDto; } diff --git a/src/services/api/models/UserDto.ts b/src/services/api/models/UserDto.ts index 4d9e6af..65ddb9e 100644 --- a/src/services/api/models/UserDto.ts +++ b/src/services/api/models/UserDto.ts @@ -14,5 +14,6 @@ export type UserDto = { phone?: string | null; position?: string | null; idCompany?: number | null; + idState?: number | null; company?: CompanyDto; } diff --git a/src/services/api/models/UserExtendedDto.ts b/src/services/api/models/UserExtendedDto.ts index cfd4158..b3db1d5 100644 --- a/src/services/api/models/UserExtendedDto.ts +++ b/src/services/api/models/UserExtendedDto.ts @@ -14,6 +14,7 @@ export type UserExtendedDto = { phone?: string | null; position?: string | null; idCompany?: number | null; + idState?: number | null; company?: CompanyDto; roleNames?: Array | null; } diff --git a/src/services/api/models/UserRegistrationDto.ts b/src/services/api/models/UserRegistrationDto.ts index cc952e4..1899354 100644 --- a/src/services/api/models/UserRegistrationDto.ts +++ b/src/services/api/models/UserRegistrationDto.ts @@ -14,6 +14,7 @@ export type UserRegistrationDto = { phone?: string | null; position?: string | null; idCompany?: number | null; + idState?: number | null; company?: CompanyDto; password?: string | null; } diff --git a/src/services/api/models/UserRoleDto.ts b/src/services/api/models/UserRoleDto.ts index 6efd298..7fb6dbb 100644 --- a/src/services/api/models/UserRoleDto.ts +++ b/src/services/api/models/UserRoleDto.ts @@ -2,12 +2,12 @@ /* tslint:disable */ /* eslint-disable */ -import type { PermissionBaseDto } from './PermissionBaseDto'; +import type { PermissionDto } from './PermissionDto'; export type UserRoleDto = { id?: number; caption?: string | null; idParent?: number | null; idType?: number; - permissions?: Array | null; + permissions?: Array | null; } diff --git a/src/services/api/models/UserTokenDto.ts b/src/services/api/models/UserTokenDto.ts index ef33f2c..e1eea11 100644 --- a/src/services/api/models/UserTokenDto.ts +++ b/src/services/api/models/UserTokenDto.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { CompanyDto } from './CompanyDto'; -import type { PermissionBaseDto } from './PermissionBaseDto'; +import type { PermissionDto } from './PermissionDto'; export type UserTokenDto = { id?: number; @@ -15,8 +15,9 @@ export type UserTokenDto = { phone?: string | null; position?: string | null; idCompany?: number | null; + idState?: number | null; company?: CompanyDto; roleNames?: Array | null; - permissions?: Array | null; + permissions?: Array | null; token?: string | null; } diff --git a/src/services/api/models/WellDto.ts b/src/services/api/models/WellDto.ts index a55bf12..b24376f 100644 --- a/src/services/api/models/WellDto.ts +++ b/src/services/api/models/WellDto.ts @@ -2,7 +2,8 @@ /* tslint:disable */ /* eslint-disable */ -import type { TelemetryDto } from './TelemetryDto'; +import type { CompanyDto } from './CompanyDto'; +import type { TelemetryBaseDto } from './TelemetryBaseDto'; export type WellDto = { caption?: string | null; @@ -16,5 +17,7 @@ export type WellDto = { idCluster?: number | null; idState?: number; lastTelemetryDate?: string; - telemetry?: TelemetryDto; + idTelemetry?: number | null; + telemetry?: TelemetryBaseDto; + companies?: Array | null; } diff --git a/src/services/api/models/WellInfoDto.ts b/src/services/api/models/WellInfoDto.ts new file mode 100644 index 0000000..105200b --- /dev/null +++ b/src/services/api/models/WellInfoDto.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type WellInfoDto = { + caption?: string | null; + cluster?: string | null; + deposit?: string | null; +} diff --git a/src/services/api/services/AdminPermissionInfoService.ts b/src/services/api/services/AdminPermissionInfoService.ts deleted file mode 100644 index bb4519f..0000000 --- a/src/services/api/services/AdminPermissionInfoService.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { PermissionInfoDto } from '../models/PermissionInfoDto'; -import { request as __request } from '../core/request'; - -export class AdminPermissionInfoService { - - /** - * Получить все записи - * @returns PermissionInfoDto Success - * @throws ApiError - */ - public static async getAll(): Promise> { - const result = await __request({ - method: 'GET', - path: `/api/admin/permissionInfo/all`, - }); - return result.body; - } - - /** - * Получить одну запись по Id - * @param id id записи - * @returns PermissionInfoDto Success - * @throws ApiError - */ - public static async get( - id: number, - ): Promise { - const result = await __request({ - method: 'GET', - path: `/api/admin/permissionInfo/${id}`, - }); - return result.body; - } - - /** - * Редактировать запись по id - * @param id id записи - * @param requestBody запись - * @returns number Success - * @throws ApiError - */ - public static async put( - id: number, - requestBody?: PermissionInfoDto, - ): Promise { - const result = await __request({ - method: 'PUT', - path: `/api/admin/permissionInfo/${id}`, - body: requestBody, - }); - return result.body; - } - - /** - * Удалить запись по id - * @param id id записи - * @returns number Success - * @throws ApiError - */ - public static async delete( - id: number, - ): Promise { - const result = await __request({ - method: 'DELETE', - path: `/api/admin/permissionInfo/${id}`, - }); - return result.body; - } - - /** - * Добавить запись - * @param requestBody запись - * @returns number Success - * @throws ApiError - */ - public static async insert( - requestBody?: PermissionInfoDto, - ): Promise { - const result = await __request({ - method: 'POST', - path: `/api/admin/permissionInfo`, - body: requestBody, - }); - return result.body; - } - -} \ No newline at end of file diff --git a/src/services/api/services/AdminPermissionService.ts b/src/services/api/services/AdminPermissionService.ts index 580599f..5bd7e38 100644 --- a/src/services/api/services/AdminPermissionService.ts +++ b/src/services/api/services/AdminPermissionService.ts @@ -7,32 +7,77 @@ import { request as __request } from '../core/request'; export class AdminPermissionService { /** - * Получает список всех разрешений для роли - * @param idRole id роли + * Получить все записи * @returns PermissionDto Success * @throws ApiError */ - public static async getByIdRole( - idRole?: number, - ): Promise> { + public static async getAll(): Promise> { const result = await __request({ method: 'GET', - path: `/api/admin/permission`, - query: { - 'idRole': idRole, - }, + path: `/api/admin/permission/all`, }); return result.body; } /** - * Добавляет разрешения для роли - * @param requestBody Объекты новых разрешений для справочника + * Получить одну запись по Id + * @param id id записи + * @returns PermissionDto Success + * @throws ApiError + */ + public static async get( + id: number, + ): Promise { + const result = await __request({ + method: 'GET', + path: `/api/admin/permission/${id}`, + }); + return result.body; + } + + /** + * Редактировать запись по id + * @param id id записи + * @param requestBody запись * @returns number Success * @throws ApiError */ - public static async insertRange( - requestBody?: Array, + public static async put( + id: number, + requestBody?: PermissionDto, + ): Promise { + const result = await __request({ + method: 'PUT', + path: `/api/admin/permission/${id}`, + body: requestBody, + }); + return result.body; + } + + /** + * Удалить запись по id + * @param id id записи + * @returns number Success + * @throws ApiError + */ + public static async delete( + id: number, + ): Promise { + const result = await __request({ + method: 'DELETE', + path: `/api/admin/permission/${id}`, + }); + return result.body; + } + + /** + * Добавить запись + * @param requestBody запись + * @returns number Success + * @throws ApiError + */ + public static async insert( + requestBody?: PermissionDto, ): Promise { const result = await __request({ method: 'POST', @@ -42,39 +87,4 @@ export class AdminPermissionService { return result.body; } - /** - * Обновляет разрешение для роли - * @param requestBody Объект разрешения для справочника - * @returns number Success - * @throws ApiError - */ - public static async update( - requestBody?: PermissionDto, - ): Promise { - const result = await __request({ - method: 'PUT', - path: `/api/admin/permission`, - body: requestBody, - }); - return result.body; - } - - /** - * Удаляет разрешение для роли - * @param idUserRole id роли для удаления разрешения - * @param idPermission id разрешения - * @returns number Success - * @throws ApiError - */ - public static async delete( - idUserRole: number, - idPermission: number, - ): Promise { - const result = await __request({ - method: 'DELETE', - path: `/api/admin/permission/${idPermission}/${idUserRole}`, - }); - return result.body; - } - } \ No newline at end of file diff --git a/src/services/api/services/AdminTelemetryService.ts b/src/services/api/services/AdminTelemetryService.ts index 5744944..bedb762 100644 --- a/src/services/api/services/AdminTelemetryService.ts +++ b/src/services/api/services/AdminTelemetryService.ts @@ -7,30 +7,19 @@ import { request as __request } from '../core/request'; export class AdminTelemetryService { /** - * @returns any Success - * @throws ApiError - */ - public static async getRedundentRemoteUids(): Promise { - const result = await __request({ - method: 'GET', - path: `/reduntentUids`, - }); - return result.body; - } - - /** - * merge telemetries - * @param requestBody array of ids + * Merge telemetries. No body required. + * @param idFrom + * @param idTo * @returns any Success * @throws ApiError */ public static async mergeTelemetries( - requestBody?: Array, + idFrom: number, + idTo: number, ): Promise { const result = await __request({ method: 'POST', - path: `/merge`, - body: requestBody, + path: `/merge/${idFrom}/${idTo}`, }); return result.body; } diff --git a/src/services/api/services/MeasureService.ts b/src/services/api/services/MeasureService.ts index 6f59d4a..37a30b1 100644 --- a/src/services/api/services/MeasureService.ts +++ b/src/services/api/services/MeasureService.ts @@ -39,18 +39,22 @@ export class MeasureService { } /** + * История замеров по скважине * @param idWell - * @param idCategory + * @param idCategory Категория скважины. Не обязательный параметр. * @returns any Success * @throws ApiError */ public static async getHisory( idWell: number, - idCategory: number, + idCategory?: number, ): Promise { const result = await __request({ method: 'GET', path: `/api/well/${idWell}/measure/history`, + query: { + 'idCategory': idCategory, + }, }); return result.body; } diff --git a/src/services/api/services/RequerstTrackerService.ts b/src/services/api/services/RequerstTrackerService.ts index 2cb94f8..6a02622 100644 --- a/src/services/api/services/RequerstTrackerService.ts +++ b/src/services/api/services/RequerstTrackerService.ts @@ -1,6 +1,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ +import type { RequestLogUserDto } from '../models/RequestLogUserDto'; import { request as __request } from '../core/request'; export class RequerstTrackerService { @@ -84,12 +85,12 @@ export class RequerstTrackerService { /** * Получить последних пользователей обращавшихся к серверу. Уникальность пользователя проверяется по логину и Ip. * @param take от 1 до 1000 - * @returns any Success + * @returns RequestLogUserDto Success * @throws ApiError */ public static async getUsersStat( take: number = 512, - ): Promise { + ): Promise> { const result = await __request({ method: 'GET', path: `/api/RequerstTracker/users`, diff --git a/src/services/api/services/WellOperationService.ts b/src/services/api/services/WellOperationService.ts index d30efa7..7ded07b 100644 --- a/src/services/api/services/WellOperationService.ts +++ b/src/services/api/services/WellOperationService.ts @@ -8,6 +8,22 @@ import { request as __request } from '../core/request'; export class WellOperationService { + /** + * Возвращает словарь типов секций + * @param idWell + * @returns string Success + * @throws ApiError + */ + public static async getSectionTypes( + idWell: string, + ): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/wellOperations/sectionTypes`, + }); + return result.body; + } + /** * Возвращает список имен типов операций на скважине * @param idWell diff --git a/src/services/api/services/WellService.ts b/src/services/api/services/WellService.ts index d71b14c..bb9e56b 100644 --- a/src/services/api/services/WellService.ts +++ b/src/services/api/services/WellService.ts @@ -2,7 +2,6 @@ /* tslint:disable */ /* eslint-disable */ import type { WellDto } from '../models/WellDto'; -import type { WellParamsDto } from '../models/WellParamsDto'; import { request as __request } from '../core/request'; export class WellService { @@ -31,7 +30,7 @@ export class WellService { */ public static async updateWell( idWell?: number, - requestBody?: WellParamsDto, + requestBody?: WellDto, ): Promise { const result = await __request({ method: 'PUT', @@ -63,17 +62,4 @@ export class WellService { return result.body; } - /** - * Возвращает список скважин, передающих телеметрию в данный момент - * @returns WellDto Success - * @throws ApiError - */ - public static async getTransmittingWells(): Promise> { - const result = await __request({ - method: 'GET', - path: `/api/well/transmittingWells`, - }); - return result.body; - } - } \ No newline at end of file diff --git a/src/utils/index.ts b/src/utils/index.ts index 9bff94d..ae17c8b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -export type { RawDate } from './datetime' +export type { RawDate, timeInS } from './datetime' export { isRawDate, formatDate, defaultFormat, periodToString } from './datetime' export const headerHeight = 64