types, rough billing draft

This commit is contained in:
niko
2026-07-05 15:56:24 +01:00
parent 204081ce23
commit 6b84d55928
6 changed files with 285 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
export type User = {
username: string;
displayName: string;
email: string;
password: string; // SHOULD BE EXCLUDED FROM ANY API RESPONSE. AND WON'T BE STORED IN PLAINTEXT, I AM NOT STUPID. I THINK.
id: Number;
flags: {
suspended: boolean;
operator: boolean; // This is basically SU. This will be given out by DB access.
};
}
export type Group = {
name: string;
id: Number;
flags: {
suspended: boolean;
};
members: User[];
contacts: {
billing: User[];
support: User[];
technical: User[];
other: User[];
}
billing: {
method: string;
frequency: string;
total: Number;
}
}
export type IP = {
vlan: Number; // 20: Management, 30: Internal, 40: Guest, 99: Unused
subnet: string; // /32, /30, /29, etc. Unlikely to be anything other than /32, but you never know.
device: Number; // 192.168.VLAN.DEVICE/SUBNET
}
export type Node = {
name: string;
id: Number;
status: string;
mgmtIp: IP;
type: string;
cpu: {
cores: Number;
threads: Number;
};
memory: {
total: Number;
};
storage: {
total: Number;
used: Number;
};
}
export type Instance = {
name: string;
id: Number;
status: "running" | "stopped" | "suspended" | "error";
node: Node;
ip: IP;
assigned: User | Group;
pve: {
vmid: Number;
type: "qemu" | "lxc";
};
history: {
suspended: {
reason: string;
actionRequired: boolean | null;
admin: User;
date: Date;
};
unsuspended: {
reason: string;
admin: User;
date: Date;
};
requested: {
action: "creation" | "deletion" | "modification" | null;
date: Date;
completedDate: Date | null;
};
}[];
config: {
cpu: {
cores: Number;
threads: Number;
shared: boolean;
};
memory: {
total: Number; // in MB
};
storage: {
total: Number; // in GB
used: Number; // in GB
host: string; // Will either be local or vaporygon (or whatever storage is added later)
}[];
bandwidth: {
total: Number;
used: Number;
speedCap: Number; // in kbps
};
highAvailability: boolean;
}
}