39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/*
|
|
* This file is part of the kernelstudio package.
|
|
*
|
|
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE file
|
|
* that was distributed with this source code.
|
|
*/
|
|
|
|
import { HttpRequestClient } from '@/utils/request';
|
|
import type { FireRule, FireRulePageableResponse, FireRuleRequest } from './types';
|
|
import type { PlatformWithComponentsResponse } from '../types';
|
|
import type { BasicResponse } from '@/types';
|
|
|
|
const req = HttpRequestClient.create<BasicResponse>({
|
|
baseURL: '/api',
|
|
});
|
|
|
|
export const findFireRuleByQuery = (query: Partial<FireRuleRequest> = {}): Promise<FireRulePageableResponse> => {
|
|
return req.get('/system/rule/list', query);
|
|
};
|
|
|
|
export const createFireRule = (fireRule: FireRule): Promise<BasicResponse> => {
|
|
return req.postJson('/system/rule', fireRule);
|
|
};
|
|
|
|
export const updateFireRule = (fireRule: FireRule): Promise<BasicResponse> => {
|
|
return req.putJson('/system/rule', fireRule);
|
|
};
|
|
|
|
export const deleteFireRule = (id: number): Promise<BasicResponse> => {
|
|
return req.delete(`/system/rule/${id}`);
|
|
};
|
|
|
|
export const findAllPlatformWithComponents = (): Promise<PlatformWithComponentsResponse> => {
|
|
return req.get(`/system/firerule/platforms`);
|
|
};
|
|
|
|
|