summaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-11-28 17:14:38 +0100
committerMinteck <contact@minteck.org>2022-11-28 17:14:38 +0100
commit18efd30a263ec0d79a26a82cbd8c90c9f81056b7 (patch)
treeaea01bf3506dda706719fc68eb37b77ed9ef3fe8 /src/types
downloadautoreport-mane.tar.gz
autoreport-mane.tar.bz2
autoreport-mane.zip
Open sourceHEADmane
Diffstat (limited to 'src/types')
-rw-r--r--src/types/Report.ts68
-rw-r--r--src/types/UUID.ts7
2 files changed, 75 insertions, 0 deletions
diff --git a/src/types/Report.ts b/src/types/Report.ts
new file mode 100644
index 0000000..c4ce342
--- /dev/null
+++ b/src/types/Report.ts
@@ -0,0 +1,68 @@
+import AutoreportBase from "../core/AutoreportBase";
+import UUID from "./UUID";
+
+export interface Report extends AutoreportBase {
+ id: UUID;
+ service: string;
+ time: Date;
+ severity: ReportSeverity;
+ response: ReportResponse;
+ error: ReportError;
+ systemInfo: SystemInformation;
+}
+
+export interface ReportError extends AutoreportBase {
+ message: string;
+ stacktrace: string;
+ logs?: string;
+ potentialFix: string|null;
+}
+
+export interface SystemInformation extends SystemProcess {
+ systemUptime: number;
+ os: string;
+}
+
+export interface SystemProcess extends AutoreportBase {
+ pid: number;
+ user: string;
+ executable: string;
+ memoryUsed: number;
+ cpuTime: number;
+ uptime: number;
+}
+
+export enum ReportSeverity {
+ // Low - something went wrong where it shouldn't, but it's not that bad
+ // Medium - something went wrong where it shouldn't, should be looked into
+ // High - something went wrong where it shouldn't, must be looked into
+ // Critical - something went wrong where it really shouldn't of, must be looked into right that moment
+ // Fatal - something went so wrong that the service will not recover without help, must be looked into right that moment
+
+ Low,
+ Medium,
+ High,
+ Critical,
+ Fatal
+}
+
+export enum ReportResponse {
+ // None - not been responded to yet
+ // Acknowledged - report has been acknowledged
+ // Ignored - report has been ignored
+ // STFU - "Shut The Fuck Up", we're already aware of this please stop telling us
+
+ None,
+ Acknowledged,
+ Ignored,
+ STFU
+}
+
+export enum ProcessState {
+ Stopped,
+ Running,
+ Starting,
+ Idle,
+ Blocked,
+ Stopping
+} \ No newline at end of file
diff --git a/src/types/UUID.ts b/src/types/UUID.ts
new file mode 100644
index 0000000..4a6c1eb
--- /dev/null
+++ b/src/types/UUID.ts
@@ -0,0 +1,7 @@
+import uuid from "uuid-v4";
+
+export default class UUID extends String {
+ constructor() {
+ super(uuid());
+ }
+} \ No newline at end of file