chore: models & requests
This commit is contained in:
@@ -15,4 +15,4 @@ export type DefParameterSaveVO = Partial<Omit<DefParameterVO, ReduceForSaveVO>>;
|
||||
|
||||
export type DefParameterUpdateVO = Partial<Omit<DefParameterVO, ReduceForUpdateVO>>;
|
||||
|
||||
export type DefParameterPageVO = Partial<Omit<DefParameterVO, ReduceForPageQuery>>;
|
||||
export type DefParameterPageQuery = Partial<Omit<DefParameterVO, ReduceForPageQuery>>;
|
||||
|
||||
@@ -4,10 +4,21 @@ import type { NdmCameraPageQuery, NdmCameraResultVO, NdmCameraUpdateVO } from '@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmCameraPage = async (stationCode: string, pageQuery: PageParams<NdmCameraPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmCameraResultVO>>(`${stationCode}/api/ndm/ndmCamera/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmCameraResultVO>>(`${prefix}/api/ndm/ndmCamera/page`, pageQuery);
|
||||
const [err, ndmCameraData] = resp;
|
||||
if (err || !ndmCameraData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmCameraData;
|
||||
};
|
||||
|
||||
export const putNdmCamera = async (stationCode: string, updateVO: NdmCameraUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmCameraResultVO>(`${stationCode}/api/ndm/ndmCamera`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmCameraResultVO>(`${prefix}/api/ndm/ndmCamera`, updateVO);
|
||||
const [err, ndmCamera] = resp;
|
||||
if (err || !ndmCamera) {
|
||||
throw err;
|
||||
}
|
||||
return ndmCamera;
|
||||
};
|
||||
|
||||
@@ -4,10 +4,21 @@ import type { NdmDecoderPageQuery, NdmDecoderResultVO, NdmDecoderUpdateVO } from
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmDecoderPage = async (stationCode: string, pageQuery: PageParams<NdmDecoderPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmDecoderResultVO>>(`${stationCode}/api/ndm/ndmDecoder/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmDecoderResultVO>>(`${prefix}/api/ndm/ndmDecoder/page`, pageQuery);
|
||||
const [err, ndmDecoderData] = resp;
|
||||
if (err || !ndmDecoderData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmDecoderData;
|
||||
};
|
||||
|
||||
export const putNdmDecoder = async (stationCode: string, updateVO: NdmDecoderUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmDecoderResultVO>(`${stationCode}/api/ndm/ndmDecoder`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmDecoderResultVO>(`${prefix}/api/ndm/ndmDecoder`, updateVO);
|
||||
const [err, ndmDecoder] = resp;
|
||||
if (err || !ndmDecoder) {
|
||||
throw err;
|
||||
}
|
||||
return ndmDecoder;
|
||||
};
|
||||
|
||||
@@ -4,10 +4,21 @@ import type { NdmKeyboardPageQuery, NdmKeyboardResultVO, NdmKeyboardUpdateVO } f
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmKeyboardPage = async (stationCode: string, pageQuery: PageParams<NdmKeyboardPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmKeyboardResultVO>>(`${stationCode}/api/ndm/ndmKeyboard/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmKeyboardResultVO>>(`${prefix}/api/ndm/ndmKeyboard/page`, pageQuery);
|
||||
const [err, ndmKeyboardData] = resp;
|
||||
if (err || !ndmKeyboardData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmKeyboardData;
|
||||
};
|
||||
|
||||
export const putNdmKeyboard = async (stationCode: string, updateVO: NdmKeyboardUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmKeyboardResultVO>(`${stationCode}/api/ndm/ndmKeyboard`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmKeyboardResultVO>(`${prefix}/api/ndm/ndmKeyboard`, updateVO);
|
||||
const [err, ndmKeyboard] = resp;
|
||||
if (err || !ndmKeyboard) {
|
||||
throw err;
|
||||
}
|
||||
return ndmKeyboard;
|
||||
};
|
||||
|
||||
@@ -4,10 +4,21 @@ import type { NdmMediaServerPageQuery, NdmMediaServerResultVO, NdmMediaServerUpd
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmMediaServerPage = async (stationCode: string, pageQuery: PageParams<NdmMediaServerPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmMediaServerResultVO>>(`${stationCode}/api/ndm/ndmMediaServer/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmMediaServerResultVO>>(`${prefix}/api/ndm/ndmMediaServer/page`, pageQuery);
|
||||
const [err, ndmMediaServerData] = resp;
|
||||
if (err || !ndmMediaServerData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmMediaServerData;
|
||||
};
|
||||
|
||||
export const putNdmMediaServer = async (stationCode: string, updateVO: NdmMediaServerUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmMediaServerResultVO>(`${stationCode}/api/ndm/ndmMediaServer`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmMediaServerResultVO>(`${prefix}/api/ndm/ndmMediaServer`, updateVO);
|
||||
const [err, ndmMediaServer] = resp;
|
||||
if (err || !ndmMediaServer) {
|
||||
throw err;
|
||||
}
|
||||
return ndmMediaServer;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const resetMonitorSchedule = async (stationCode: string) => {
|
||||
const resp = await ndmClient.get<void>(`${stationCode}/api/ndm/ndmConstant/anyTenant/resetMonitorSchedule`);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.get<void>(`${prefix}/api/ndm/ndmConstant/anyTenant/resetMonitorSchedule`);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,35 +6,64 @@ import type { ClientChannel, NdmNvrPageQuery, NdmNvrResultVO, NdmNvrUpdateVO, Nd
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmNvrPage = async (stationCode: string, pageQuery: PageParams<NdmNvrPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmNvrResultVO>>(`${stationCode}/api/ndm/ndmNvr/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmNvrResultVO>>(`${prefix}/api/ndm/ndmNvr/page`, pageQuery);
|
||||
const [err, ndmNvrData] = resp;
|
||||
if (err || !ndmNvrData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmNvrData;
|
||||
};
|
||||
|
||||
export const putNdmNvr = async (stationCode: string, updateVO: NdmNvrUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmNvrResultVO>(`${stationCode}/api/ndm/ndmNvr`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmNvrResultVO>(`${prefix}/api/ndm/ndmNvr`, updateVO);
|
||||
const [err, ndmNvr] = resp;
|
||||
if (err || !ndmNvr) {
|
||||
throw err;
|
||||
}
|
||||
return ndmNvr;
|
||||
};
|
||||
|
||||
export const getChannelList = async (stationCode: string, ndmNvr: NdmNvrVO) => {
|
||||
const resp = await ndmClient.post<ClientChannel[]>(`${stationCode}/api/ndm/ndmRecordCheck/getChannelList`, {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<ClientChannel[]>(`${prefix}/api/ndm/ndmRecordCheck/getChannelList`, {
|
||||
code: ndmNvr.gbCode,
|
||||
time: '',
|
||||
});
|
||||
return resp;
|
||||
const [err, channelList] = resp;
|
||||
if (err || !channelList) {
|
||||
throw err;
|
||||
}
|
||||
return channelList;
|
||||
};
|
||||
|
||||
export const getRecordCheckByParentId = async (stationCode: string, ndmNvr: NdmNvrVO, lastDays: number, gbCodeList: string[] = []) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endDateTime = dayjs();
|
||||
const startDateTime = endDateTime.subtract(lastDays, 'day');
|
||||
const resp = await ndmClient.post<NdmRecordCheck[]>(`${stationCode}/api/ndm/ndmRecordCheck/getRecordCheckByParentId`, {
|
||||
const resp = await ndmClient.post<NdmRecordCheck[]>(`${prefix}/api/ndm/ndmRecordCheck/getRecordCheckByParentId`, {
|
||||
start: startDateTime.format('YYYY-MM-DD'),
|
||||
end: endDateTime.format('YYYY-MM-DD'),
|
||||
parentId: ndmNvr.gbCode,
|
||||
gbCodeList,
|
||||
});
|
||||
return resp;
|
||||
const [err, recordCheckList] = resp;
|
||||
if (err || !recordCheckList) {
|
||||
throw err;
|
||||
}
|
||||
return recordCheckList;
|
||||
};
|
||||
|
||||
export const reloadRecordCheckByGbId = async (stationCode: string, channel: ClientChannel, dayOffset: number) => {
|
||||
const resp = await ndmClient.post<boolean>(`${stationCode}/api/ndm/ndmRecordCheck/reloadRecordCheckByGbId`, {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<boolean>(`${prefix}/api/ndm/ndmRecordCheck/reloadRecordCheckByGbId`, {
|
||||
...channel,
|
||||
dayOffset,
|
||||
});
|
||||
return resp;
|
||||
const [err, result] = resp;
|
||||
if (err || !result) {
|
||||
throw err;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
@@ -4,19 +4,36 @@ import type { NdmSecurityBoxPageQuery, NdmSecurityBoxResultVO, NdmSecurityBoxUpd
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmSecurityBoxPage = async (stationCode: string, pageQuery: PageParams<NdmSecurityBoxPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmSecurityBoxResultVO>>(`${stationCode}/api/ndm/ndmSecurityBox/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmSecurityBoxResultVO>>(`${prefix}/api/ndm/ndmSecurityBox/page`, pageQuery);
|
||||
const [err, ndmSecurityBoxData] = resp;
|
||||
if (err || !ndmSecurityBoxData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSecurityBoxData;
|
||||
};
|
||||
|
||||
export const putNdmSecurityBox = async (stationCode: string, updateVO: NdmSecurityBoxUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmSecurityBoxResultVO>(`${stationCode}/api/ndm/ndmSecurityBox`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmSecurityBoxResultVO>(`${prefix}/api/ndm/ndmSecurityBox`, updateVO);
|
||||
const [err, ndmSecurityBox] = resp;
|
||||
if (err || !ndmSecurityBox) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSecurityBox;
|
||||
};
|
||||
|
||||
export const turnStatus = async (stationCode: string, ipAddress: string, circuitIndex: number, status: number) => {
|
||||
const resp = await ndmClient.post<boolean>(`${stationCode}/api/ndm/ndmSecurityBox/turnStatus`, {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<boolean>(`${prefix}/api/ndm/ndmSecurityBox/turnStatus`, {
|
||||
community: 'public',
|
||||
ipAddress,
|
||||
circuit: `${circuitIndex}`,
|
||||
status,
|
||||
});
|
||||
return resp;
|
||||
const [err, result] = resp;
|
||||
if (err || !result) {
|
||||
throw err;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
@@ -4,10 +4,21 @@ import type { NdmSwitchPageQuery, NdmSwitchResultVO, NdmSwitchUpdateVO } from '@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmSwitchPage = async (stationCode: string, pageQuery: PageParams<NdmSwitchPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmSwitchResultVO>>(`${stationCode}/api/ndm/ndmSwitch/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmSwitchResultVO>>(`${prefix}/api/ndm/ndmSwitch/page`, pageQuery);
|
||||
const [err, ndmSwitchData] = resp;
|
||||
if (err || !ndmSwitchData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSwitchData;
|
||||
};
|
||||
|
||||
export const putNdmSwitch = async (stationCode: string, updateVO: NdmSwitchUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmSwitchResultVO>(`${stationCode}/api/ndm/ndmSwitch`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmSwitchResultVO>(`${prefix}/api/ndm/ndmSwitch`, updateVO);
|
||||
const [err, ndmSwitch] = resp;
|
||||
if (err || !ndmSwitch) {
|
||||
throw err;
|
||||
}
|
||||
return ndmSwitch;
|
||||
};
|
||||
|
||||
@@ -4,10 +4,21 @@ import type { NdmVideoServerPageQuery, NdmVideoServerResultVO, NdmVideoServerUpd
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmVideoServerPage = async (stationCode: string, pageQuery: PageParams<NdmVideoServerPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmVideoServerResultVO>>(`${stationCode}/api/ndm/ndmVideoServer/page`, pageQuery);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmVideoServerResultVO>>(`${prefix}/api/ndm/ndmVideoServer/page`, pageQuery);
|
||||
const [err, ndmVideoServerData] = resp;
|
||||
if (err || !ndmVideoServerData) {
|
||||
throw err;
|
||||
}
|
||||
return ndmVideoServerData;
|
||||
};
|
||||
|
||||
export const putNdmVideoServer = async (stationCode: string, updateVO: NdmVideoServerUpdateVO) => {
|
||||
const resp = await ndmClient.put<NdmVideoServerResultVO>(`${stationCode}/api/ndm/ndmVideoServer`, updateVO);
|
||||
return resp;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<NdmVideoServerResultVO>(`${prefix}/api/ndm/ndmVideoServer`, updateVO);
|
||||
const [err, ndmVideoServer] = resp;
|
||||
if (err || !ndmVideoServer) {
|
||||
throw err;
|
||||
}
|
||||
return ndmVideoServer;
|
||||
};
|
||||
|
||||
@@ -8,8 +8,10 @@ export * from './device/ndm-security-box';
|
||||
export * from './device/ndm-switch';
|
||||
export * from './device/ndm-video-server';
|
||||
|
||||
export * from './log/device-alarm-log';
|
||||
export * from './log/icmp-log';
|
||||
export * from './log/snmp-log';
|
||||
export * from './log/ndm-device-alarm-log';
|
||||
export * from './log/ndm-icmp-log';
|
||||
export * from './log/ndm-snmp-log';
|
||||
|
||||
export * from './station/ndm-verify';
|
||||
|
||||
export * from './system/def-parameter';
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { NdmDeviceAlarmLogPageQuery, NdmDeviceAlarmLogResultVO } from '@/ap
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postNdmDeviceAlarmLogPage = async (stationCode: string, pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmDeviceAlarmLogResultVO>>(`${stationCode}/api/ndm/ndmDeviceAlarmLog/page`, pageQuery);
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmDeviceAlarmLogResultVO>>(`${prefix}/api/ndm/ndmDeviceAlarmLog/page`, pageQuery);
|
||||
return resp;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { NdmIcmpLogPageQuery, NdmIcmpLogResultVO } from '@/apis/models/devi
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postIcmpLogPage = async (stationCode: string, pageQuery: PageParams<NdmIcmpLogPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmIcmpLogResultVO>>(`${stationCode}/api/ndm/ndmIcmpLog/page`, pageQuery);
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmIcmpLogResultVO>>(`${prefix}/api/ndm/ndmIcmpLog/page`, pageQuery);
|
||||
return resp;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { NdmSnmpLogPageQuery, NdmSnmpLogResultVO } from '@/apis/models/devi
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const postSnmpLogPage = async (stationCode: string, pageQuery: PageParams<NdmSnmpLogPageQuery>) => {
|
||||
const resp = await ndmClient.post<PageResult<NdmSnmpLogResultVO>>(`${stationCode}/api/ndm/ndmSnmpLog/page`, pageQuery);
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<NdmSnmpLogResultVO>>(`${prefix}/api/ndm/ndmSnmpLog/page`, pageQuery);
|
||||
return resp;
|
||||
};
|
||||
|
||||
10
src/apis/requests/station/ndm-verify.ts
Normal file
10
src/apis/requests/station/ndm-verify.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
|
||||
export const ndmVerify = async (stationCode: string) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmKeepAlive/verify`, {}, { timeout: 5000 });
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
@@ -1,10 +1,22 @@
|
||||
import type { PageParams, PageResult } from '@/apis/models/base/page';
|
||||
import type { Result } from '@/axios';
|
||||
|
||||
import type { DefParameterResultVO, DefParameterUpdateVO } from '../../models/system';
|
||||
import type { DefParameterPageQuery, DefParameterResultVO, DefParameterUpdateVO } from '../../models/system';
|
||||
|
||||
import { ndmClient } from '../../client';
|
||||
|
||||
export const postDefParameterPage = async (stationCode: string, pageQuery: PageParams<DefParameterPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<PageResult<DefParameterResultVO>>(`${prefix}/api/system/defParameter/page`, pageQuery);
|
||||
const [err, defParameterData] = resp;
|
||||
if (err || !defParameterData) {
|
||||
throw err;
|
||||
}
|
||||
return defParameterData;
|
||||
};
|
||||
|
||||
export const putDefParameter = async (stationCode: string, updateVO: DefParameterUpdateVO) => {
|
||||
const resp = await ndmClient.put<Result<DefParameterResultVO>>(`${stationCode}/api/system/defParameter`, { ...updateVO });
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.put<Result<DefParameterResultVO>>(`${prefix}/api/system/defParameter`, { ...updateVO });
|
||||
return resp;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user