From 28ad2f63f13f1433eb7146e275fc545cba83bf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Tue, 17 Aug 2021 10:44:41 +0500 Subject: [PATCH] api client update --- src/components/AnalysisDepthToDay.jsx | 4 +- src/components/AnalysisDepthToInterval.jsx | 4 +- src/components/AnalysisOperationTime.jsx | 4 +- src/pages/WellAnalysis.jsx | 271 +++++++++--------- src/services/api/index.ts | 9 +- .../{FilePropertiesDto.ts => FileInfoDto.ts} | 4 +- .../models/FileInfoDtoPaginationContainer.ts | 12 + .../FilePropertiesDtoPaginationContainer.ts | 12 - src/services/api/models/WellOperationDto.ts | 12 +- .../WellOperationDtoPaginationContainer.ts | 12 + .../WellSectionDtoPaginationContainer.ts | 12 + src/services/api/services/DataService.ts | 2 +- src/services/api/services/FileService.ts | 12 +- src/services/api/services/FluidService.ts | 4 +- src/services/api/services/MessageService.ts | 2 +- .../api/services/MudDiagramService.ts | 4 +- src/services/api/services/NnbDataService.ts | 4 +- src/services/api/services/ReportService.ts | 10 +- ...ervice.ts => TelemetryAnalyticsService.ts} | 12 +- .../api/services/WellOperationService.ts | 126 ++++++++ .../api/services/WellSectionService.ts | 12 +- 21 files changed, 358 insertions(+), 186 deletions(-) rename src/services/api/models/{FilePropertiesDto.ts => FileInfoDto.ts} (71%) create mode 100644 src/services/api/models/FileInfoDtoPaginationContainer.ts delete mode 100644 src/services/api/models/FilePropertiesDtoPaginationContainer.ts create mode 100644 src/services/api/models/WellOperationDtoPaginationContainer.ts create mode 100644 src/services/api/models/WellSectionDtoPaginationContainer.ts rename src/services/api/services/{AnalyticsService.ts => TelemetryAnalyticsService.ts} (91%) create mode 100644 src/services/api/services/WellOperationService.ts diff --git a/src/components/AnalysisDepthToDay.jsx b/src/components/AnalysisDepthToDay.jsx index 6bae9c5..c8b3053 100644 --- a/src/components/AnalysisDepthToDay.jsx +++ b/src/components/AnalysisDepthToDay.jsx @@ -1,7 +1,7 @@ import { ChartDepthToDay } from './charts/ChartDepthToDay' import notify from "../components/notify" import { useState, useEffect } from 'react' -import { AnalyticsService } from "../services/api" +import { TelemetryAnalyticsService } from "../services/api" import LoaderPortal from '../components/LoaderPortal' const lines = [ @@ -19,7 +19,7 @@ export function AnalysisDepthToDay({idWell}) { useEffect(() => { setLoader(true) - AnalyticsService.getWellDepthToDay(idWell) + TelemetryAnalyticsService.getWellDepthToDay(idWell) .then(handleReceiveDepthToDayData) .catch(error => { notify(`Не удалось получить данные для Анализа Глубина-День по скважине "${idWell}"`, diff --git a/src/components/AnalysisDepthToInterval.jsx b/src/components/AnalysisDepthToInterval.jsx index 36d1531..71cfc96 100644 --- a/src/components/AnalysisDepthToInterval.jsx +++ b/src/components/AnalysisDepthToInterval.jsx @@ -1,7 +1,7 @@ import { useParams } from "react-router-dom" import notify from "../components/notify" import { useState, useEffect } from 'react' -import { AnalyticsService } from '../services/api' +import { TelemetryAnalyticsService } from '../services/api' import { ChartDepthToInterval } from './charts/ChartDepthToInterval' import { Select } from 'antd' import LoaderPortal from '../components/LoaderPortal' @@ -35,7 +35,7 @@ export function AnalysisDepthToInterval() { useEffect(() => { setLoader(true) - AnalyticsService.getWellDepthToInterval(id, chartInterval) + TelemetryAnalyticsService.getWellDepthToInterval(id, chartInterval) .then(handleReceiveDepthToIntervalData) .catch(error => { notify(`Не удалось получить данные для Анализа скорость проходки-интервал "${id}"`, diff --git a/src/components/AnalysisOperationTime.jsx b/src/components/AnalysisOperationTime.jsx index 690cab6..c4d5790 100644 --- a/src/components/AnalysisOperationTime.jsx +++ b/src/components/AnalysisOperationTime.jsx @@ -2,7 +2,7 @@ import { useParams } from "react-router-dom" import { DatePicker, ConfigProvider } from 'antd'; import notify from "../components/notify" import { useState, useEffect } from 'react' -import { AnalyticsService } from '../services/api' +import { TelemetryAnalyticsService } from '../services/api' import { ChartOperationTime } from './charts/ChartOperationTime' import locale from "antd/lib/locale/ru_RU"; import LoaderPortal from '../components/LoaderPortal' @@ -34,7 +34,7 @@ export function AnalysisOperationTime() { begin = range[0].toISOString() end = range[1].toISOString() } - AnalyticsService.getOperationsSummary(id, begin, end) + TelemetryAnalyticsService.getOperationsSummary(id, begin, end) .then(handleReceiveOperationTimeData) .catch(error => { notify(`Не удалось получить данные для Анализа Операция-Время по скважине "${id}" за период с ${begin} по ${end}`, diff --git a/src/pages/WellAnalysis.jsx b/src/pages/WellAnalysis.jsx index 6a4600c..a2b2b51 100644 --- a/src/pages/WellAnalysis.jsx +++ b/src/pages/WellAnalysis.jsx @@ -1,159 +1,166 @@ -import {Table, Select, DatePicker, ConfigProvider} from 'antd'; -import {AnalyticsService} from '../services/api' -import {useState, useEffect} from 'react' -import {useParams} from 'react-router-dom' -import notify from '../components/notify' -import LoaderPortal from '../components/LoaderPortal' +import { Table, Select, DatePicker, ConfigProvider } from "antd"; +import { TelemetryAnalyticsService } from "../services/api"; +import { useState, useEffect } from "react"; +import { useParams } from "react-router-dom"; +import notify from "../components/notify"; +import LoaderPortal from "../components/LoaderPortal"; import locale from "antd/lib/locale/ru_RU"; -import moment from 'moment' -import '../styles/message.css' +import moment from "moment"; +import "../styles/message.css"; -const {Option} = Select -const pageSize = 26 -const {RangePicker} = DatePicker; +const { Option } = Select; +const pageSize = 26; +const { RangePicker } = DatePicker; const columns = [ - { - title: 'Название операции', - key: 'name', - dataIndex: 'name', - }, - { - title: 'Дата начала операции', - key: 'beginDate', - dataIndex: 'beginDate', - render: (item) => moment.utc(item).local().format('DD MMM YYYY, HH:mm:ss') - }, - { - title: 'Дата окончания операции', - key: 'endDate', - dataIndex: 'endDate', - render: (item) => moment.utc(item).local().format('DD MMM YYYY, HH:mm:ss') - }, - { - title: 'Глубина скважины в начале операции', - key: 'beginWellDepth', - dataIndex: 'startWellDepth', - }, - { - title: 'Глубина скважины в конце операции', - key: 'endWellDepth', - dataIndex: 'endWellDepth', - } + { + title: "Название операции", + key: "name", + dataIndex: "name", + }, + { + title: "Дата начала операции", + key: "beginDate", + dataIndex: "beginDate", + render: (item) => moment.utc(item).local().format("DD MMM YYYY, HH:mm:ss"), + }, + { + title: "Дата окончания операции", + key: "endDate", + dataIndex: "endDate", + render: (item) => moment.utc(item).local().format("DD MMM YYYY, HH:mm:ss"), + }, + { + title: "Глубина скважины в начале операции", + key: "beginWellDepth", + dataIndex: "startWellDepth", + }, + { + title: "Глубина скважины в конце операции", + key: "endWellDepth", + dataIndex: "endWellDepth", + }, ]; const filterOptions = [ - {label: 'Невозможно определить операцию', value: 1}, - {label: 'Роторное бурение', value: 2}, - {label: 'Слайдирование', value: 3}, - {label: 'Подъем с проработкой', value: 4}, - {label: 'Спуск с проработкой', value: 5}, - {label: 'Подъем с промывкой', value: 6}, - {label: 'Спуск с промывкой', value: 7}, - {label: 'Спуск в скважину', value: 8}, - {label: 'Спуск с вращением', value: 9}, - {label: 'Подъем из скважины', value: 10}, - {label: 'Подъем с вращением', value: 11}, - {label: 'Промывка в покое', value: 12}, - {label: 'Промывка с вращением', value: 13}, - {label: 'Удержание в клиньях', value: 14}, - {label: 'Неподвижное состояние', value: 15}, - {label: 'Вращение без циркуляции', value: 16}, - {label: 'На поверхности', value: 17} -] + { label: "Невозможно определить операцию", value: 1 }, + { label: "Роторное бурение", value: 2 }, + { label: "Слайдирование", value: 3 }, + { label: "Подъем с проработкой", value: 4 }, + { label: "Спуск с проработкой", value: 5 }, + { label: "Подъем с промывкой", value: 6 }, + { label: "Спуск с промывкой", value: 7 }, + { label: "Спуск в скважину", value: 8 }, + { label: "Спуск с вращением", value: 9 }, + { label: "Подъем из скважины", value: 10 }, + { label: "Подъем с вращением", value: 11 }, + { label: "Промывка в покое", value: 12 }, + { label: "Промывка с вращением", value: 13 }, + { label: "Удержание в клиньях", value: 14 }, + { label: "Неподвижное состояние", value: 15 }, + { label: "Вращение без циркуляции", value: 16 }, + { label: "На поверхности", value: 17 }, +]; export default function WellAnalysis() { - let {id} = useParams() + let { id } = useParams(); - const [page, setPage] = useState(1) - const [range, setRange] = useState([]) - const [categories, setCategories] = useState([]) - const [pagination, setPagination] = useState(null) - const [operations, setOperations] = useState([]) + const [page, setPage] = useState(1); + const [range, setRange] = useState([]); + const [categories, setCategories] = useState([]); + const [pagination, setPagination] = useState(null); + const [operations, setOperations] = useState([]); - const [loader, setLoader] = useState(false) + const [loader, setLoader] = useState(false); - const children = filterOptions.map((line) => ) + const children = filterOptions.map((line) => ( + + )); - const onChangeRange = (range) => { - setRange(range) - } + const onChangeRange = (range) => { + setRange(range); + }; - useEffect(() => { - const GetOperations = async () => { - setLoader(true) - try { - let begin = null - let end = null - if (range?.length > 1) { - begin = range[0].toISOString() - end = range[1].toISOString() - } - - await AnalyticsService.getOperationsByWell( - `${id}`, - (page-1) * pageSize, - pageSize, - categories, - begin, - end).then((paginatedOperations) => { - setOperations(paginatedOperations?.items.map(o => { - return { - key: o.id, - begin: o.date, - ...o - } - })) - - setPagination({ - total: paginatedOperations?.count, - current: Math.floor(paginatedOperations?.skip / pageSize), - }) - } - ) - } catch (ex) { - notify(`Не удалось загрузить операции по скважине "${id}"`, 'error') - console.log(ex) - } - setLoader(false) + useEffect(() => { + const GetOperations = async () => { + setLoader(true); + try { + let begin = null; + let end = null; + if (range?.length > 1) { + begin = range[0].toISOString(); + end = range[1].toISOString(); } - GetOperations() - }, [id, categories, range, page]) - return(<> -
-

Фильтр операций

- - - - -
- + await TelemetryAnalyticsService.getOperationsByWell( + `${id}`, + (page - 1) * pageSize, + pageSize, + categories, + begin, + end + ).then((paginatedOperations) => { + setOperations( + paginatedOperations?.items.map((o) => { + return { + key: o.id, + begin: o.date, + ...o, + }; + }) + ); + + setPagination({ + total: paginatedOperations?.count, + current: Math.floor(paginatedOperations?.skip / pageSize), + }); + }); + } catch (ex) { + notify(`Не удалось загрузить операции по скважине "${id}"`, "error"); + console.log(ex); + } + setLoader(false); + }; + GetOperations(); + }, [id, categories, range, page]); + + return ( + <> +
+

Фильтр операций

+ + + + +
+ setPage(page) + onChange: (page) => setPage(page), }} rowKey={(record) => record.id} /> - - ) - } \ No newline at end of file + + + ); +} diff --git a/src/services/api/index.ts b/src/services/api/index.ts index b95d881..2990b2a 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -12,8 +12,8 @@ export type { DataSaubBaseDto } from './models/DataSaubBaseDto'; export type { DatesRangeDto } from './models/DatesRangeDto'; export type { DepositDto } from './models/DepositDto'; export type { EventDto } from './models/EventDto'; -export type { FilePropertiesDto } from './models/FilePropertiesDto'; -export type { FilePropertiesDtoPaginationContainer } from './models/FilePropertiesDtoPaginationContainer'; +export type { FileInfoDto } from './models/FileInfoDto'; +export type { FileInfoDtoPaginationContainer } from './models/FileInfoDtoPaginationContainer'; export type { FluidDataDto } from './models/FluidDataDto'; export type { MessageDto } from './models/MessageDto'; export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; @@ -30,10 +30,11 @@ export type { WellDepthToDayDto } from './models/WellDepthToDayDto'; export type { WellDepthToIntervalDto } from './models/WellDepthToIntervalDto'; export type { WellDto } from './models/WellDto'; export type { WellOperationDto } from './models/WellOperationDto'; +export type { WellOperationDtoPaginationContainer } from './models/WellOperationDtoPaginationContainer'; export type { WellSectionDto } from './models/WellSectionDto'; +export type { WellSectionDtoPaginationContainer } from './models/WellSectionDtoPaginationContainer'; export type { WellStatDto } from './models/WellStatDto'; -export { AnalyticsService } from './services/AnalyticsService'; export { AuthService } from './services/AuthService'; export { ClusterService } from './services/ClusterService'; export { DataService } from './services/DataService'; @@ -44,6 +45,8 @@ export { MessageService } from './services/MessageService'; export { MudDiagramService } from './services/MudDiagramService'; export { NnbDataService } from './services/NnbDataService'; export { ReportService } from './services/ReportService'; +export { TelemetryAnalyticsService } from './services/TelemetryAnalyticsService'; export { TelemetryService } from './services/TelemetryService'; +export { WellOperationService } from './services/WellOperationService'; export { WellSectionService } from './services/WellSectionService'; export { WellService } from './services/WellService'; diff --git a/src/services/api/models/FilePropertiesDto.ts b/src/services/api/models/FileInfoDto.ts similarity index 71% rename from src/services/api/models/FilePropertiesDto.ts rename to src/services/api/models/FileInfoDto.ts index 59ed185..42d0df3 100644 --- a/src/services/api/models/FilePropertiesDto.ts +++ b/src/services/api/models/FileInfoDto.ts @@ -2,10 +2,10 @@ /* tslint:disable */ /* eslint-disable */ -export type FilePropertiesDto = { +export type FileInfoDto = { id?: number; name?: string | null; idCategory?: number; uploadDate?: string; - userName?: string | null; + authorName?: string | null; } \ No newline at end of file diff --git a/src/services/api/models/FileInfoDtoPaginationContainer.ts b/src/services/api/models/FileInfoDtoPaginationContainer.ts new file mode 100644 index 0000000..6a8d883 --- /dev/null +++ b/src/services/api/models/FileInfoDtoPaginationContainer.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { FileInfoDto } from './FileInfoDto'; + +export type FileInfoDtoPaginationContainer = { + skip?: number; + take?: number; + count?: number; + items?: Array | null; +} \ No newline at end of file diff --git a/src/services/api/models/FilePropertiesDtoPaginationContainer.ts b/src/services/api/models/FilePropertiesDtoPaginationContainer.ts deleted file mode 100644 index b2226ef..0000000 --- a/src/services/api/models/FilePropertiesDtoPaginationContainer.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { FilePropertiesDto } from './FilePropertiesDto'; - -export type FilePropertiesDtoPaginationContainer = { - skip?: number; - take?: number; - count?: number; - items?: Array | null; -} \ No newline at end of file diff --git a/src/services/api/models/WellOperationDto.ts b/src/services/api/models/WellOperationDto.ts index 3e90db8..4c38efc 100644 --- a/src/services/api/models/WellOperationDto.ts +++ b/src/services/api/models/WellOperationDto.ts @@ -5,8 +5,14 @@ export type WellOperationDto = { id?: number; idWell?: number; - caption?: string | null; - description?: string | null; - casingSection?: number; + idWellSectionType?: number; + wellSectionTypeName?: string | null; + idOperationCategory?: number; + categoryName?: string | null; + type?: number; wellDepth?: number; + startDate?: string; + durationHours?: number; + info?: string | null; + comment?: string | null; } \ No newline at end of file diff --git a/src/services/api/models/WellOperationDtoPaginationContainer.ts b/src/services/api/models/WellOperationDtoPaginationContainer.ts new file mode 100644 index 0000000..4dbd6b7 --- /dev/null +++ b/src/services/api/models/WellOperationDtoPaginationContainer.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { WellOperationDto } from './WellOperationDto'; + +export type WellOperationDtoPaginationContainer = { + skip?: number; + take?: number; + count?: number; + items?: Array | null; +} \ No newline at end of file diff --git a/src/services/api/models/WellSectionDtoPaginationContainer.ts b/src/services/api/models/WellSectionDtoPaginationContainer.ts new file mode 100644 index 0000000..f1a922a --- /dev/null +++ b/src/services/api/models/WellSectionDtoPaginationContainer.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { WellSectionDto } from './WellSectionDto'; + +export type WellSectionDtoPaginationContainer = { + skip?: number; + take?: number; + count?: number; + items?: Array | null; +} \ No newline at end of file diff --git a/src/services/api/services/DataService.ts b/src/services/api/services/DataService.ts index aaa7f80..48f7881 100644 --- a/src/services/api/services/DataService.ts +++ b/src/services/api/services/DataService.ts @@ -46,7 +46,7 @@ idWell: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/well/${idWell}/dataDatesRange`, + path: `/api/well/${idWell}/data/datesRange`, }); return result.body; } diff --git a/src/services/api/services/FileService.ts b/src/services/api/services/FileService.ts index 949f09e..2594a02 100644 --- a/src/services/api/services/FileService.ts +++ b/src/services/api/services/FileService.ts @@ -1,7 +1,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { FilePropertiesDtoPaginationContainer } from '../models/FilePropertiesDtoPaginationContainer'; +import type { FileInfoDtoPaginationContainer } from '../models/FileInfoDtoPaginationContainer'; import { request as __request } from '../core/request'; export class FileService { @@ -23,7 +23,7 @@ requestBody?: any, ): Promise { const result = await __request({ method: 'POST', - path: `/api/files/${idWell}/files`, + path: `/api/well/${idWell}/files`, query: { 'idCategory': idCategory, 'idUser': idUser, @@ -41,7 +41,7 @@ requestBody?: any, * @param idCategory id категории файла * @param begin дата начала * @param end дата окончания - * @returns FilePropertiesDtoPaginationContainer Success + * @returns FileInfoDtoPaginationContainer Success * @throws ApiError */ public static async getFilesInfo( @@ -51,10 +51,10 @@ take: number = 32, idCategory: number, begin?: string, end?: string, -): Promise { +): Promise { const result = await __request({ method: 'GET', - path: `/api/files/${idWell}`, + path: `/api/well/${idWell}/files`, query: { 'skip': skip, 'take': take, @@ -79,7 +79,7 @@ fileId: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/files/${idWell}/${fileId}`, + path: `/api/well/${idWell}/files/${fileId}`, }); return result.body; } diff --git a/src/services/api/services/FluidService.ts b/src/services/api/services/FluidService.ts index 1703362..fe1e065 100644 --- a/src/services/api/services/FluidService.ts +++ b/src/services/api/services/FluidService.ts @@ -18,7 +18,7 @@ idCategory?: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/fluidLastData/${idWell}`, + path: `/api/well/${idWell}/fluidLastData`, query: { 'idCategory': idCategory, }, @@ -40,7 +40,7 @@ requestBody?: FluidDataDto, ): Promise { const result = await __request({ method: 'POST', - path: `/api/fluidLastData/${idWell}`, + path: `/api/well/${idWell}/fluidLastData`, query: { 'idCategory': idCategory, }, diff --git a/src/services/api/services/MessageService.ts b/src/services/api/services/MessageService.ts index 77b111b..8adaa2f 100644 --- a/src/services/api/services/MessageService.ts +++ b/src/services/api/services/MessageService.ts @@ -54,7 +54,7 @@ idWell: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/well/${idWell}/messagesDatesRange`, + path: `/api/well/${idWell}/message/datesRange`, }); return result.body; } diff --git a/src/services/api/services/MudDiagramService.ts b/src/services/api/services/MudDiagramService.ts index 3e9b9ac..f450da2 100644 --- a/src/services/api/services/MudDiagramService.ts +++ b/src/services/api/services/MudDiagramService.ts @@ -18,7 +18,7 @@ idCategory?: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/mudLastData/${idWell}`, + path: `/api/well/${idWell}/mudLastData`, query: { 'idCategory': idCategory, }, @@ -40,7 +40,7 @@ requestBody?: MudDiagramDataDto, ): Promise { const result = await __request({ method: 'POST', - path: `/api/mudLastData/${idWell}`, + path: `/api/well/${idWell}/mudLastData`, query: { 'idCategory': idCategory, }, diff --git a/src/services/api/services/NnbDataService.ts b/src/services/api/services/NnbDataService.ts index ab4d694..13a514f 100644 --- a/src/services/api/services/NnbDataService.ts +++ b/src/services/api/services/NnbDataService.ts @@ -18,7 +18,7 @@ idCategory?: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/nnbLastData/${idWell}`, + path: `/api/well/${idWell}/nnbLastData`, query: { 'idCategory': idCategory, }, @@ -40,7 +40,7 @@ requestBody?: NnbDataDto, ): Promise { const result = await __request({ method: 'POST', - path: `/api/nnbLastData/${idWell}`, + path: `/api/well/${idWell}/nnbLastData`, query: { 'idCategory': idCategory, }, diff --git a/src/services/api/services/ReportService.ts b/src/services/api/services/ReportService.ts index 8a6cb5b..e524e33 100644 --- a/src/services/api/services/ReportService.ts +++ b/src/services/api/services/ReportService.ts @@ -27,7 +27,7 @@ end?: string, ): Promise { const result = await __request({ method: 'POST', - path: `/api/report/${idWell}/report`, + path: `/api/well/${idWell}/report`, query: { 'idUser': idUser, 'stepSeconds': stepSeconds, @@ -52,7 +52,7 @@ reportName: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/report/${idWell}/${reportName}`, + path: `/api/well/${idWell}/report/${reportName}`, }); return result.body; } @@ -77,7 +77,7 @@ end?: string, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/report/${idWell}/suitableReports`, + path: `/api/well/${idWell}/report/suitableReports`, query: { 'stepSeconds': stepSeconds, 'format': format, @@ -107,7 +107,7 @@ end?: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/report/${idWell}/reportSize`, + path: `/api/well/${idWell}/report/reportSize`, query: { 'stepSeconds': stepSeconds, 'format': format, @@ -129,7 +129,7 @@ idWell: number, ): Promise { const result = await __request({ method: 'GET', - path: `/api/report/${idWell}/reportsDatesRange`, + path: `/api/well/${idWell}/report/datesRange`, }); return result.body; } diff --git a/src/services/api/services/AnalyticsService.ts b/src/services/api/services/TelemetryAnalyticsService.ts similarity index 91% rename from src/services/api/services/AnalyticsService.ts rename to src/services/api/services/TelemetryAnalyticsService.ts index 21cf3d3..e11f5ab 100644 --- a/src/services/api/services/AnalyticsService.ts +++ b/src/services/api/services/TelemetryAnalyticsService.ts @@ -7,7 +7,7 @@ import type { WellDepthToDayDto } from '../models/WellDepthToDayDto'; import type { WellDepthToIntervalDto } from '../models/WellDepthToIntervalDto'; import { request as __request } from '../core/request'; -export class AnalyticsService { +export class TelemetryAnalyticsService { /** * Возвращает список операций на скважине за все время @@ -30,7 +30,7 @@ end?: string, ): Promise { const result = await __request({ method: 'GET', - path: `/api/analytics/${idWell}/operationsByWell`, + path: `/api/well/${idWell}/telemetryAnalytics/operationsByWell`, query: { 'skip': skip, 'take': take, @@ -53,7 +53,7 @@ idWell: number, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${idWell}/wellDepthToDay`, + path: `/api/well/${idWell}/telemetryAnalytics/wellDepthToDay`, }); return result.body; } @@ -73,7 +73,7 @@ workBeginSeconds?: number, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${idWell}/wellDepthToInterval`, + path: `/api/well/${idWell}/telemetryAnalytics/wellDepthToInterval`, query: { 'intervalSeconds': intervalSeconds, 'workBeginSeconds': workBeginSeconds, @@ -97,7 +97,7 @@ end?: string, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${idWell}/operationsSummary`, + path: `/api/well/${idWell}/telemetryAnalytics/operationsSummary`, query: { 'begin': begin, 'end': end, @@ -121,7 +121,7 @@ workBeginSeconds?: number, ): Promise> { const result = await __request({ method: 'GET', - path: `/api/analytics/${idWell}/operationsToInterval`, + path: `/api/well/${idWell}/telemetryAnalytics/operationsToInterval`, query: { 'intervalSeconds': intervalSeconds, 'workBeginSeconds': workBeginSeconds, diff --git a/src/services/api/services/WellOperationService.ts b/src/services/api/services/WellOperationService.ts new file mode 100644 index 0000000..1d97db6 --- /dev/null +++ b/src/services/api/services/WellOperationService.ts @@ -0,0 +1,126 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { WellOperationDto } from '../models/WellOperationDto'; +import type { WellOperationDtoPaginationContainer } from '../models/WellOperationDtoPaginationContainer'; +import { request as __request } from '../core/request'; + +export class WellOperationService { + + /** + * Возвращает список имен типов операций на скважине + * @param idWell + * @returns string Success + * @throws ApiError + */ + public static async getCategories( +idWell: string, +): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/wellOperations/categories`, + }); + return result.body; + } + + /** + * Возвращает весь список операций на скважине + * @param idWell id скважины + * @param skip Для пагинации кол-во записей пропустить + * @param take Для пагинации кол-во записей + * @returns WellOperationDtoPaginationContainer Success + * @throws ApiError + */ + public static async getAll( +idWell: number, +skip: number, +take: number = 32, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/wellOperations`, + query: { + 'skip': skip, + 'take': take, + }, + }); + return result.body; + } + + /** + * Добавляет новые операции на скважине + * @param idWell id скважины + * @param requestBody Данные о добавляемых операциях + * @returns WellOperationDto Success + * @throws ApiError + */ + public static async insertRange( +idWell: number, +requestBody?: Array, +): Promise> { + const result = await __request({ + method: 'POST', + path: `/api/well/${idWell}/wellOperations`, + body: requestBody, + }); + return result.body; + } + + /** + * Возвращает нужную операцию на скважине + * @param idWell id скважины + * @param idOperation id нужной операции + * @returns WellOperationDto Success + * @throws ApiError + */ + public static async get( +idWell: number, +idOperation: number, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/wellOperations/${idOperation}`, + }); + return result.body; + } + + /** + * Обновляет выбранную операцию на скважине + * @param idWell id скважины + * @param idOperation id выбраной операции + * @param requestBody Новые данные для выбраной операции + * @returns WellOperationDto Success + * @throws ApiError + */ + public static async update( +idWell: number, +idOperation: number, +requestBody?: WellOperationDto, +): Promise { + const result = await __request({ + method: 'PUT', + path: `/api/well/${idWell}/wellOperations/${idOperation}`, + body: requestBody, + }); + return result.body; + } + + /** + * Удаляет выбраную операцию на скважине + * @param idWell id скважины + * @param idOperation id выбраной операции + * @returns number Success + * @throws ApiError + */ + public static async delete( +idWell: number, +idOperation: number, +): Promise { + const result = await __request({ + method: 'DELETE', + path: `/api/well/${idWell}/wellOperations/${idOperation}`, + }); + return result.body; + } + +} \ No newline at end of file diff --git a/src/services/api/services/WellSectionService.ts b/src/services/api/services/WellSectionService.ts index fb28c38..007cf4f 100644 --- a/src/services/api/services/WellSectionService.ts +++ b/src/services/api/services/WellSectionService.ts @@ -2,6 +2,7 @@ /* tslint:disable */ /* eslint-disable */ import type { WellSectionDto } from '../models/WellSectionDto'; +import type { WellSectionDtoPaginationContainer } from '../models/WellSectionDtoPaginationContainer'; import { request as __request } from '../core/request'; export class WellSectionService { @@ -25,14 +26,14 @@ idWell: string, * @param idWell * @param skip * @param take - * @returns WellSectionDto Success + * @returns WellSectionDtoPaginationContainer Success * @throws ApiError */ public static async getAll( idWell: number, skip: number, take: number = 32, -): Promise> { +): Promise { const result = await __request({ method: 'GET', path: `/api/well/${idWell}/sections`, @@ -102,16 +103,21 @@ requestBody?: WellSectionDto, /** * @param idWell * @param idSection + * @param idItem * @returns number Success * @throws ApiError */ public static async delete( idWell: number, -idSection: number, +idSection: string, +idItem?: number, ): Promise { const result = await __request({ method: 'DELETE', path: `/api/well/${idWell}/sections/${idSection}`, + query: { + 'idItem': idItem, + }, }); return result.body; }