191 lines
6.2 KiB
TypeScript
191 lines
6.2 KiB
TypeScript
import axios from "axios";
|
|
import {
|
|
type LinkService,
|
|
type LinkSearchParam,
|
|
type LinkList,
|
|
type LinkFormData,
|
|
type LinkInfo,
|
|
type LinkLogList,
|
|
type LinkStatsList,
|
|
type LinkVrblList,
|
|
type LinkVrblFormData,
|
|
type LinkVrbl,
|
|
type LinkTable,
|
|
type LinkTableColumnsList,
|
|
type LinkTableColumns,
|
|
type LinkTableColData,
|
|
type LinkTableFormData,
|
|
} from "../model/link-interface";
|
|
|
|
export class LinkApiService implements LinkService {
|
|
public async getLinkList(params: LinkSearchParam): Promise<LinkList> {
|
|
const response = await axios.get<LinkList>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkList`,
|
|
{ params }
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLinkInfo(linkSn: string): Promise<LinkInfo> {
|
|
const response = await axios.get<LinkInfo>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkInfo/${linkSn}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async linkQuickStart(linkSn: string): Promise<string> {
|
|
const response = await axios.patch<string>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/linkQuickStart/${linkSn}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async updateLinkInfo(data: LinkFormData): Promise<void> {
|
|
await axios.put<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/updateLinkInfo`,
|
|
data,
|
|
);
|
|
}
|
|
|
|
public async insertLinkInfo(data: LinkFormData): Promise<void> {
|
|
await axios.post<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/insertLinkInfo`,
|
|
data,
|
|
);
|
|
}
|
|
|
|
public async deleteLink(linkSn: string): Promise<void> {
|
|
await axios.delete<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/deleteLink/${linkSn}`,
|
|
);
|
|
}
|
|
|
|
public async getLinkLogList(params: LinkSearchParam): Promise<LinkLogList> {
|
|
const response = await axios.get<LinkLogList>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/selectLinkLoglist`,
|
|
{ params }
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLinkStatsList(params: LinkSearchParam): Promise<LinkStatsList> {
|
|
const response = await axios.get<LinkStatsList>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/selectLinkStats`,
|
|
{ params }
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLinkVrblList(linkSn: string): Promise<LinkVrblList> {
|
|
const response = await axios.get<LinkVrblList>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkVrblList/${linkSn}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async insertLinkVrbl(data: LinkVrblFormData): Promise<number> {
|
|
const response = await axios.post<number>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/insertLinkVrbl`,
|
|
data,
|
|
);
|
|
|
|
return response.data;
|
|
}
|
|
|
|
public async deleteLinkVrbl(data: string[]): Promise<void> {
|
|
await axios.delete<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/deleteLinkVrbl`,
|
|
{
|
|
data
|
|
}
|
|
);
|
|
}
|
|
|
|
public async getLinkVrblInfo(linkVrblSn: string): Promise<LinkVrbl> {
|
|
const response = await axios.get<LinkVrbl>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkVrblInfo/${linkVrblSn}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async updateLinkVrblInfo(data: LinkVrblFormData): Promise<void> {
|
|
await axios.put<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/updateLinkVrblInfo`,
|
|
data,
|
|
);
|
|
}
|
|
|
|
public async getLinkTableInfo(linkSn: string): Promise<LinkTable> {
|
|
const response = await axios.get<LinkTable>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkTableInfo/${linkSn}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLinkTableColList(linkSn: string): Promise<LinkTableColumnsList> {
|
|
const response = await axios.get<LinkTableColumnsList>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkTableColList/${linkSn}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getLinkTableColInfo(params: { colSn: string; tblSn:string; }): Promise<LinkTableColumns> {
|
|
const response = await axios.get<LinkTableColumns>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/getLinkTableColInfo`,
|
|
{ params }
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async insertLinkTableCol(data: LinkTableColData): Promise<void> {
|
|
await axios.post<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/insertLinkTableCol`,
|
|
data
|
|
);
|
|
}
|
|
|
|
public async deleteLinkTableCol(data: string[]): Promise<void> {
|
|
await axios.delete<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/deleteLinkTableCol`,
|
|
{
|
|
data
|
|
},
|
|
);
|
|
}
|
|
|
|
public async updateLinkTableCol(data: LinkTableColData): Promise<void> {
|
|
axios.put<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/updateLinkTableCol`,
|
|
data,
|
|
);
|
|
}
|
|
|
|
public async insertLinkTableInfo(data: LinkTableFormData): Promise<void> {
|
|
await axios.post<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/insertLinkTableInfo`,
|
|
data
|
|
);
|
|
}
|
|
|
|
public async updateLinkTableInfo(data: LinkTableFormData): Promise<void> {
|
|
await axios.put<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/updateLinkTableInfo`,
|
|
data
|
|
);
|
|
}
|
|
|
|
public async countLinkTblNm(tblNm: string): Promise<{count: number, tbl_sn: string}> {
|
|
const response = await axios.get<{count: number, tbl_sn: string}>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/countLinkTblNm/${tblNm}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async updateLinkResultCode(linkSn: string): Promise<void> {
|
|
await axios.patch<void>(
|
|
`${process.env.NEXT_PUBLIC_LINK_BACKEND_API_HOST}/updateLinkResultCode/${linkSn}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
export const LinkApi = new LinkApiService(); |