Files
turnosxpress/sysadmin/src/models/WapServers.Model.ts
T

129 lines
2.6 KiB
TypeScript

import { IPayload } from "./Payload.Model";
export type FindWapServerParams = {
id?: string;
name?: string;
description?: string;
countBots?: number;
maxBots?: number;
port?: number;
active?: boolean;
countBotsFrom?: number;
countBotsTo?: number;
};
export interface IWapServer {
id?: string;
name?: string;
description?: string;
ipv4: string;
ipv6: string;
countBots: number;
maxBots: number;
port: number;
active: boolean;
}
export type UpdateWapServerParams = {
serverId: string;
name?: string;
ipv4?: string;
port?: number;
maxBots?: number;
active?: boolean;
};
export type CreateWapServerParams = {
name: string;
ipv4: string;
port: number;
maxBots: number;
ipv6?: string;
description?: string;
active?: boolean;
};
export type PaginateWapServerParams = FindWapServerParams & {
page: number;
limit: number;
};
export type PaginateWapServerResults = {
data: IWapServer[];
page: number;
pages: number;
};
export type SysAdminGetWapServerParams = PaginateWapServerParams & {
payload: IPayload;
};
export type WapServerByIdParams = {
serverId: string;
};
export type WapServerDeleteParams = WapServerByIdParams & {
force?: boolean;
};
export type WapServerDeleteResult = {
serverId: string;
deleted: true;
force?: boolean;
detachedOrganizations?: number;
deletedRuntimeBots?: number;
skippedRuntimeBots?: number;
auditFailed?: boolean;
auditMessage?: string;
};
export type WapServerOrganizationActionParams = WapServerByIdParams & {
organizationId: string;
};
export type WapServerQrResult = WapServerOrganizationActionParams & {
qr: string;
};
export type WapServerDetachResult = WapServerOrganizationActionParams & {
botDeleted: boolean;
botAlreadyMissing: boolean;
before: number;
after: number;
};
export type WapAssignedOrganization = {
id: string;
name?: string;
};
export type WapContainerDto = {
id?: string;
name?: string;
organizationId?: string;
image?: string;
state?: string;
status?: string;
ports?: unknown[];
created?: number;
};
export type WapServerAuditResult = {
serverId: string;
assignedOrganizations: WapAssignedOrganization[];
detectedBots: WapContainerDto[];
validBots: WapContainerDto[];
ghostBots: WapContainerDto[];
missingBots: WapAssignedOrganization[];
expectedCountBots: number;
storedCountBots: number;
runtimeCountBots: number;
countMismatch: boolean;
};
export type WapServerRecalculateCountResult = {
serverId: string;
before: number;
after: number;
};