quiz init commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* active Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_active -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* activity_log Resolve Update
|
||||
* @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.edit({ name }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_activity_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* answer Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_answer -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* credential Resolve Update
|
||||
* @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" });
|
||||
|
||||
v.check().then(function (matched) {
|
||||
if (!matched) {
|
||||
Object.keys(v.errors).forEach((error) => {
|
||||
return new UserInputError(v.errors[error].message);
|
||||
});
|
||||
}
|
||||
});
|
||||
return await db.credential.edit({ email,
|
||||
password }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_credential -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* image Resolve Update
|
||||
* @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.edit({ url,
|
||||
caption }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_image -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* output_variable Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_output_variable -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* profile_header Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_profile_header -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* question Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_question -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* quiz Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_quiz -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* refer_log Resolve Update
|
||||
* @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.refer_log.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_refer_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rule Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_rule -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rules Resolve Update
|
||||
* @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.edit({ }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_rules -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* user Resolve Update
|
||||
* @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}, { });
|
||||
|
||||
v.check().then(function (matched) {
|
||||
if (!matched) {
|
||||
Object.keys(v.errors).forEach((error) => {
|
||||
return new UserInputError(v.errors[error].message);
|
||||
});
|
||||
}
|
||||
});
|
||||
return await db.user.edit({ role_id,
|
||||
profile_id,
|
||||
organization_id,
|
||||
first_name,
|
||||
last_name,
|
||||
phone,
|
||||
image,
|
||||
refer,
|
||||
stripe_uid,
|
||||
paypal_uid,
|
||||
expire_at,
|
||||
status }, args.id);
|
||||
} catch (error) {
|
||||
console.log('update_user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user