2025-04-24 18:49:20 +02:00
|
|
|
// --- Imports ---
|
2025-03-30 22:53:50 +02:00
|
|
|
const AppError = require("./appError");
|
|
|
|
|
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
// --- Functions ---
|
2025-03-30 22:53:50 +02:00
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
async function validateNewModData(mod_data) {
|
2025-03-31 17:00:28 +02:00
|
|
|
|
|
|
|
throw new AppError(501, "Not implemented");
|
|
|
|
//TODO
|
2025-04-24 18:49:20 +02:00
|
|
|
// try {
|
|
|
|
// node_schemas.validateNewModData(node_data);
|
|
|
|
// } catch (err) {
|
|
|
|
// throw new AppError(400, "Missing or invalid fields", "Bad request", err);
|
|
|
|
// }
|
2025-03-31 17:00:28 +02:00
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
}
|
2025-03-31 17:00:28 +02:00
|
|
|
|
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
async function validateNewUserData(user_data) {
|
2025-03-31 17:00:28 +02:00
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
throw new AppError(501, "Not implemented");
|
|
|
|
//TODO
|
|
|
|
// try {
|
|
|
|
// node_schemas.validateNewUserData(node_data);
|
|
|
|
// } catch (err) {
|
|
|
|
// throw new AppError(400, "Missing or invalid fields", "Bad request", err);
|
|
|
|
// }
|
2025-03-31 17:00:28 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
async function validateCretendials(identifier, password) {
|
|
|
|
|
|
|
|
throw new AppError(501, "Not implemented");
|
|
|
|
}
|
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
|
|
|
|
// --- Utils ---
|
|
|
|
|
2025-03-31 17:00:28 +02:00
|
|
|
async function isEmail(text) {
|
|
|
|
const email_regex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
|
|
|
|
return email_regex.test(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function isID(text) {
|
|
|
|
const id_regex = /[a-zA-Z0-9_]+/;
|
|
|
|
return id_regex.test(text);
|
2025-03-30 22:53:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2025-04-24 18:49:20 +02:00
|
|
|
module.exports = { validateNewModData, validateNewUserData, isEmail, isID };
|