summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-06 18:05:26 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-06 18:07:14 +1100
commit3c7b5f2656b816aadaadc56f955ba5bd897a340a (patch)
tree4bff1151358fbcbe02c2b2c61b4ccb06e988bedf
parentPrettier precommit hook (diff)
downloadserver-3c7b5f2656b816aadaadc56f955ba5bd897a340a.tar.xz
Don't allow BaseClass props through schema
-rw-r--r--assets/schemas.json38
-rw-r--r--scripts/schema.js18
2 files changed, 18 insertions, 38 deletions
diff --git a/assets/schemas.json b/assets/schemas.json
index 40599f06..393fc2f0 100644
--- a/assets/schemas.json
+++ b/assets/schemas.json
@@ -20282,44 +20282,6 @@
             },
             "timezone_offset": {
                 "type": "integer"
-            },
-            "assign": {
-                "type": "object",
-                "additionalProperties": false
-            },
-            "toJSON": {
-                "type": "object",
-                "additionalProperties": false
-            },
-            "hasId": {
-                "description": "Checks if entity has an id.\nIf entity composite compose ids, it will check them all.",
-                "type": "object",
-                "additionalProperties": false
-            },
-            "save": {
-                "description": "Saves current entity in the database.\nIf entity does not exist in the database then inserts, otherwise updates.",
-                "type": "object",
-                "additionalProperties": false
-            },
-            "remove": {
-                "description": "Removes current entity from the database.",
-                "type": "object",
-                "additionalProperties": false
-            },
-            "softRemove": {
-                "description": "Records the delete date of current entity.",
-                "type": "object",
-                "additionalProperties": false
-            },
-            "recover": {
-                "description": "Recovers a given entity in the database.",
-                "type": "object",
-                "additionalProperties": false
-            },
-            "reload": {
-                "description": "Reloads entity data from the database.",
-                "type": "object",
-                "additionalProperties": false
             }
         },
         "additionalProperties": false,
diff --git a/scripts/schema.js b/scripts/schema.js
index 29665ef1..fedbf25f 100644
--- a/scripts/schema.js
+++ b/scripts/schema.js
@@ -71,6 +71,24 @@ function main() {
 		const part = TJS.generateSchema(program, name, settings, [], generator);
 		if (!part) continue;
 
+		// this is a hack. want some want to check if its a @column, instead
+		if (part.properties)
+			Object.keys(part.properties)
+				.filter((key) =>
+					[
+						// BaseClass methods
+						"toJSON",
+						"hasId",
+						"save",
+						"remove",
+						"softRemove",
+						"recover",
+						"reload",
+						"assign",
+					].includes(key),
+				)
+				.forEach((key) => delete part.properties[key]);
+
 		definitions = { ...definitions, [name]: { ...part } };
 	}