- Added A TON of stuff, separated everything neatly and cleaned most models
This commit is contained in:
13
validations/Errors.js
Normal file
13
validations/Errors.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// Http error w/ http code
|
||||
class HttpError extends Error {
|
||||
constructor(code, message) {
|
||||
super(message)
|
||||
this.name = "HttpError"
|
||||
this.code = code
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
HttpError
|
||||
}
|
||||
10
validations/IngredientValidation.js
Normal file
10
validations/IngredientValidation.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const Ingredient = {
|
||||
"id": "/IngredientValidation",
|
||||
"type": Object,
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
},
|
||||
"required": ["name"]
|
||||
}
|
||||
|
||||
module.exports = Ingredient
|
||||
12
validations/MetaSchoolValidation.js
Normal file
12
validations/MetaSchoolValidation.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const MetaSchool = {
|
||||
"id": "/MetaSchoolValidation",
|
||||
"type": Object,
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"schools": { "type": "array" }
|
||||
},
|
||||
"required": ["name", "description"]
|
||||
}
|
||||
|
||||
module.exports = MetaSchool
|
||||
12
validations/SchoolValidation.js
Normal file
12
validations/SchoolValidation.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const School = {
|
||||
"id": "/SchoolValidation",
|
||||
"type": Object,
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"meta_school_id": { "type": "number" },
|
||||
},
|
||||
"required": ["name", "description", "meta_school_id"]
|
||||
}
|
||||
|
||||
module.exports = School
|
||||
39
validations/SpellValidation.js
Normal file
39
validations/SpellValidation.js
Normal file
@@ -0,0 +1,39 @@
|
||||
const Spell = {
|
||||
"id": "/SpellValidation",
|
||||
"type": Object,
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"level": { "type": "number" },
|
||||
"charge": { "type": "number" },
|
||||
"cost": { "type": "string" },
|
||||
"is_ritual": { "type": "boolean" },
|
||||
"schools": {
|
||||
"type": { "type": "array" },
|
||||
"items": {
|
||||
"properties": {
|
||||
"id": { "type": "number" },
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"type": { "type": "array" },
|
||||
"items": {
|
||||
"properties": {
|
||||
"id": { "type": "number" },
|
||||
}
|
||||
}
|
||||
},
|
||||
"ingredients": {
|
||||
"type": { "type": "array" },
|
||||
"items": {
|
||||
"properties": {
|
||||
"id": { "type": "number" },
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["name", "description"]
|
||||
}
|
||||
|
||||
module.exports = Spell
|
||||
13
validations/UserValidation.js
Normal file
13
validations/UserValidation.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const User = {
|
||||
"id": "/UserValidation",
|
||||
"type": Object,
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"mail": { "type": "string" },
|
||||
"password": { "type": "string" },
|
||||
"banned": { "type": "boolean"},
|
||||
},
|
||||
"required": ["name", "password", "mail"]
|
||||
}
|
||||
|
||||
module.exports = User
|
||||
10
validations/VariableValidation.js
Normal file
10
validations/VariableValidation.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const Variable = {
|
||||
"id": "/VariableValidation",
|
||||
"type": Object,
|
||||
"properties": {
|
||||
"description": { "type": "string" },
|
||||
},
|
||||
"required": ["description"]
|
||||
}
|
||||
|
||||
module.exports = Variable
|
||||
Reference in New Issue
Block a user