quiz init commit

This commit is contained in:
modeht
2022-04-11 06:32:47 +02:00
commit 3e49e31399
445 changed files with 109700 additions and 0 deletions
View File
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* active Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.active.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_active -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* activity_log Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { name } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.activity_log.insert({ name },{returnAllFields: true});
} catch (error) {
console.log('create_activity_log -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* answer Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.answer.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_answer -> error', error);
return new ApolloError('InternalServerError');
}
};
+40
View File
@@ -0,0 +1,40 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* credential Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { email,
password } = args;
const v = new Validator({ email: args.email,
password: args.password}, { email: "required|valid_email",
password: "required" });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.credential.insert({ email,
password },{returnAllFields: true});
} catch (error) {
console.log('create_credential -> error', error);
return new ApolloError('InternalServerError');
}
};
+38
View File
@@ -0,0 +1,38 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* image Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { url,
caption } = args;
const v = new Validator({ url: args.url}, { url: "required" });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.image.insert({ url,
caption },{returnAllFields: true});
} catch (error) {
console.log('create_image -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* output_variable Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.output_variable.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_output_variable -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* profile_header Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.profile_header.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_profile_header -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* question Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.question.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_question -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* quiz Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.quiz.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_quiz -> error', error);
return new ApolloError('InternalServerError');
}
};
+40
View File
@@ -0,0 +1,40 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* refer_log Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { user_id,
type } = args;
const v = new Validator({ user_id: args.user_id,
type: args.type}, { user_id: "required|integer",
type: "required|integer" });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.refer_log.insert({ user_id,
type },{returnAllFields: true});
} catch (error) {
console.log('create_refer_log -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* rule Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.rule.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_rule -> error', error);
return new ApolloError('InternalServerError');
}
};
+36
View File
@@ -0,0 +1,36 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* rules Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { } = args;
const v = new Validator({ }, { });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.rules.insert({ },{returnAllFields: true});
} catch (error) {
console.log('create_rules -> error', error);
return new ApolloError('InternalServerError');
}
};
+62
View File
@@ -0,0 +1,62 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* user Resolve Add
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
const { ApolloError ,UserInputError} = require('apollo-server-express');
const { Validator } = require('node-input-validator');
module.exports = async (parent, args, {db}, info) => {
try {
const { role_id,
profile_id,
organization_id,
first_name,
last_name,
phone,
image,
refer,
stripe_uid,
paypal_uid,
expire_at,
status } = args;
const v = new Validator({ first_name: args.first_name,
last_name: args.last_name,
status: args.status}, { first_name: "required",
last_name: "required",
status: "required" });
v.check().then(function (matched) {
if (!matched) {
Object.keys(v.errors).forEach((error) => {
return new UserInputError(v.errors[error].message);
});
}
});
return await db.user.insert({ role_id,
profile_id,
organization_id,
first_name,
last_name,
phone,
image,
refer,
stripe_uid,
paypal_uid,
expire_at,
status },{returnAllFields: true});
} catch (error) {
console.log('create_user -> error', error);
return new ApolloError('InternalServerError');
}
};