first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* active Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.active.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.active.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((active) => ({
|
||||
cursor: active.id,
|
||||
node: active,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('active -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* activity_log Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.activity_log.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.activity_log.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((activity_log) => ({
|
||||
cursor: activity_log.id,
|
||||
node: activity_log,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('activity_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* answer Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.answer.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.answer.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((answer) => ({
|
||||
cursor: answer.id,
|
||||
node: answer,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('answer -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* credential Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.credential.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.credential.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((credential) => ({
|
||||
cursor: credential.id,
|
||||
node: credential,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('credential -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* image Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.image.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.image.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((image) => ({
|
||||
cursor: image.id,
|
||||
node: image,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('image -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* output_variable Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.output_variable.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.output_variable.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((output_variable) => ({
|
||||
cursor: output_variable.id,
|
||||
node: output_variable,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('output_variable -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* profile_header Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.profile_header.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.profile_header.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((profile_header) => ({
|
||||
cursor: profile_header.id,
|
||||
node: profile_header,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('profile_header -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* question Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.question.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.question.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((question) => ({
|
||||
cursor: question.id,
|
||||
node: question,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('question -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* quiz Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.quiz.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.quiz.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((quiz) => ({
|
||||
cursor: quiz.id,
|
||||
node: quiz,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('quiz -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* refer_log Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.refer_log.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.refer_log.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((refer_log) => ({
|
||||
cursor: refer_log.id,
|
||||
node: refer_log,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('refer_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rule Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.rule.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.rule.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((rule) => ({
|
||||
cursor: rule.id,
|
||||
node: rule,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('rule -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rules Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.rules.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.rules.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((rules) => ({
|
||||
cursor: rules.id,
|
||||
node: rules,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('rules -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* user Resolve All
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const Sequelize = require('sequelize');
|
||||
const { last } = require('lodash');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, { first, after }, { db, credential }, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
const attributes = db.user.intersection(graphqlFields(info).edges.node);
|
||||
|
||||
const options = {
|
||||
where: {},
|
||||
limit: first,
|
||||
attributes,
|
||||
};
|
||||
|
||||
if (after) {
|
||||
options.where = {
|
||||
id: {
|
||||
[Sequelize.Op.gt]: after,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const { count, rows } = await db.user.findAndCountAll(options);
|
||||
|
||||
const edges = rows.map((user) => ({
|
||||
cursor: user.id,
|
||||
node: user,
|
||||
}));
|
||||
|
||||
const pageInfo = {
|
||||
endCursor: last(edges)?.cursor,
|
||||
hasNextPage: 0 < count - first,
|
||||
};
|
||||
|
||||
return {
|
||||
edges,
|
||||
pageInfo,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.log('user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* active Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.active.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_active -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* activity_log Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.activity_log.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_activity_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* answer Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.answer.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_answer -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* credential Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.credential.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_credential -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* image Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.image.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_image -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* output_variable Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.output_variable.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_output_variable -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* profile_header Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.profile_header.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_profile_header -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* question Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.question.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_question -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* quiz Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.quiz.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_quiz -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* refer_log Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.refer_log.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_refer_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rule Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.rule.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_rule -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rules Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.rules.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_rules -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* user Resolve Delete
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
|
||||
module.exports = async (parent, args, {db}, info) => {
|
||||
//Check Auth if user allowed
|
||||
try {
|
||||
|
||||
return await db.user.realDelete(args.id);
|
||||
} catch (error) {
|
||||
console.log('delete_user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: {{{year}}}*/
|
||||
/**
|
||||
* Resolve Index
|
||||
* @copyright {{{year}}} Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
const allUserResolver = require("./all/allUser");
|
||||
const singleUserResolver = require("./single/singleUser");
|
||||
const createUserResolver = require("./create/createUser");
|
||||
const updateUserResolver = require("./update/updateUser");
|
||||
const deleteUserResolver = require("./delete/deleteUser");
|
||||
const typeUserResolver = require("./type/typeUser");
|
||||
|
||||
|
||||
const allActivityLogResolver = require("./all/allActivityLog");
|
||||
const singleActivityLogResolver = require("./single/singleActivityLog");
|
||||
const createActivityLogResolver = require("./create/createActivityLog");
|
||||
const updateActivityLogResolver = require("./update/updateActivityLog");
|
||||
const deleteActivityLogResolver = require("./delete/deleteActivityLog");
|
||||
const typeActivityLogResolver = require("./type/typeActivityLog");
|
||||
|
||||
|
||||
const allReferLogResolver = require("./all/allReferLog");
|
||||
const singleReferLogResolver = require("./single/singleReferLog");
|
||||
const createReferLogResolver = require("./create/createReferLog");
|
||||
const updateReferLogResolver = require("./update/updateReferLog");
|
||||
const deleteReferLogResolver = require("./delete/deleteReferLog");
|
||||
const typeReferLogResolver = require("./type/typeReferLog");
|
||||
|
||||
|
||||
const allCredentialResolver = require("./all/allCredential");
|
||||
const singleCredentialResolver = require("./single/singleCredential");
|
||||
const createCredentialResolver = require("./create/createCredential");
|
||||
const updateCredentialResolver = require("./update/updateCredential");
|
||||
const deleteCredentialResolver = require("./delete/deleteCredential");
|
||||
const typeCredentialResolver = require("./type/typeCredential");
|
||||
|
||||
|
||||
const allImageResolver = require("./all/allImage");
|
||||
const singleImageResolver = require("./single/singleImage");
|
||||
const createImageResolver = require("./create/createImage");
|
||||
const updateImageResolver = require("./update/updateImage");
|
||||
const deleteImageResolver = require("./delete/deleteImage");
|
||||
const typeImageResolver = require("./type/typeImage");
|
||||
|
||||
|
||||
const allRuleResolver = require("./all/allRule");
|
||||
const singleRuleResolver = require("./single/singleRule");
|
||||
const createRuleResolver = require("./create/createRule");
|
||||
const updateRuleResolver = require("./update/updateRule");
|
||||
const deleteRuleResolver = require("./delete/deleteRule");
|
||||
const typeRuleResolver = require("./type/typeRule");
|
||||
|
||||
|
||||
const allQuizResolver = require("./all/allQuiz");
|
||||
const singleQuizResolver = require("./single/singleQuiz");
|
||||
const createQuizResolver = require("./create/createQuiz");
|
||||
const updateQuizResolver = require("./update/updateQuiz");
|
||||
const deleteQuizResolver = require("./delete/deleteQuiz");
|
||||
const typeQuizResolver = require("./type/typeQuiz");
|
||||
|
||||
|
||||
const allActiveResolver = require("./all/allActive");
|
||||
const singleActiveResolver = require("./single/singleActive");
|
||||
const createActiveResolver = require("./create/createActive");
|
||||
const updateActiveResolver = require("./update/updateActive");
|
||||
const deleteActiveResolver = require("./delete/deleteActive");
|
||||
const typeActiveResolver = require("./type/typeActive");
|
||||
|
||||
|
||||
const allOutputVariableResolver = require("./all/allOutputVariable");
|
||||
const singleOutputVariableResolver = require("./single/singleOutputVariable");
|
||||
const createOutputVariableResolver = require("./create/createOutputVariable");
|
||||
const updateOutputVariableResolver = require("./update/updateOutputVariable");
|
||||
const deleteOutputVariableResolver = require("./delete/deleteOutputVariable");
|
||||
const typeOutputVariableResolver = require("./type/typeOutputVariable");
|
||||
|
||||
|
||||
const allQuestionResolver = require("./all/allQuestion");
|
||||
const singleQuestionResolver = require("./single/singleQuestion");
|
||||
const createQuestionResolver = require("./create/createQuestion");
|
||||
const updateQuestionResolver = require("./update/updateQuestion");
|
||||
const deleteQuestionResolver = require("./delete/deleteQuestion");
|
||||
const typeQuestionResolver = require("./type/typeQuestion");
|
||||
|
||||
|
||||
const allAnswerResolver = require("./all/allAnswer");
|
||||
const singleAnswerResolver = require("./single/singleAnswer");
|
||||
const createAnswerResolver = require("./create/createAnswer");
|
||||
const updateAnswerResolver = require("./update/updateAnswer");
|
||||
const deleteAnswerResolver = require("./delete/deleteAnswer");
|
||||
const typeAnswerResolver = require("./type/typeAnswer");
|
||||
|
||||
module.exports = {
|
||||
|
||||
Query: {
|
||||
Users: allUserResolver,
|
||||
User: singleUserResolver,
|
||||
ActivityLogs: allActivityLogResolver,
|
||||
ActivityLog: singleActivityLogResolver,
|
||||
ReferLogs: allReferLogResolver,
|
||||
ReferLog: singleReferLogResolver,
|
||||
Credentials: allCredentialResolver,
|
||||
Credential: singleCredentialResolver,
|
||||
Images: allImageResolver,
|
||||
Image: singleImageResolver,
|
||||
Rules: allRuleResolver,
|
||||
Rule: singleRuleResolver,
|
||||
Quizs: allQuizResolver,
|
||||
Quiz: singleQuizResolver,
|
||||
Actives: allActiveResolver,
|
||||
Active: singleActiveResolver,
|
||||
OutputVariables: allOutputVariableResolver,
|
||||
OutputVariable: singleOutputVariableResolver,
|
||||
Questions: allQuestionResolver,
|
||||
Question: singleQuestionResolver,
|
||||
Answers: allAnswerResolver,
|
||||
Answer: singleAnswerResolver
|
||||
},
|
||||
Mutation: {
|
||||
createUser: createUserResolver,
|
||||
updateUser: updateUserResolver,
|
||||
deleteUser: deleteUserResolver,
|
||||
createActivityLog: createActivityLogResolver,
|
||||
updateActivityLog: updateActivityLogResolver,
|
||||
deleteActivityLog: deleteActivityLogResolver,
|
||||
createReferLog: createReferLogResolver,
|
||||
updateReferLog: updateReferLogResolver,
|
||||
deleteReferLog: deleteReferLogResolver,
|
||||
createCredential: createCredentialResolver,
|
||||
updateCredential: updateCredentialResolver,
|
||||
deleteCredential: deleteCredentialResolver,
|
||||
createImage: createImageResolver,
|
||||
updateImage: updateImageResolver,
|
||||
deleteImage: deleteImageResolver,
|
||||
createRule: createRuleResolver,
|
||||
updateRule: updateRuleResolver,
|
||||
deleteRule: deleteRuleResolver,
|
||||
createQuiz: createQuizResolver,
|
||||
updateQuiz: updateQuizResolver,
|
||||
deleteQuiz: deleteQuizResolver,
|
||||
createActive: createActiveResolver,
|
||||
updateActive: updateActiveResolver,
|
||||
deleteActive: deleteActiveResolver,
|
||||
createOutputVariable: createOutputVariableResolver,
|
||||
updateOutputVariable: updateOutputVariableResolver,
|
||||
deleteOutputVariable: deleteOutputVariableResolver,
|
||||
createQuestion: createQuestionResolver,
|
||||
updateQuestion: updateQuestionResolver,
|
||||
deleteQuestion: deleteQuestionResolver,
|
||||
createAnswer: createAnswerResolver,
|
||||
updateAnswer: updateAnswerResolver,
|
||||
deleteAnswer: deleteAnswerResolver
|
||||
},
|
||||
User: typeUserResolver,
|
||||
ActivityLog: typeActivityLogResolver,
|
||||
ReferLog: typeReferLogResolver,
|
||||
Credential: typeCredentialResolver,
|
||||
Image: typeImageResolver,
|
||||
Rule: typeRuleResolver,
|
||||
Quiz: typeQuizResolver,
|
||||
Active: typeActiveResolver,
|
||||
OutputVariable: typeOutputVariableResolver,
|
||||
Question: typeQuestionResolver,
|
||||
Answer: typeAnswerResolver
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.image) {
|
||||
return parent.image;
|
||||
} else {
|
||||
return parent.getImage();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.organization) {
|
||||
return parent.organization;
|
||||
} else {
|
||||
return parent.getOrganization();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.profile) {
|
||||
return parent.profile;
|
||||
} else {
|
||||
return parent.getProfile();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.question) {
|
||||
return parent.question;
|
||||
} else {
|
||||
return parent.getQuestion();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.quiz) {
|
||||
return parent.quiz;
|
||||
} else {
|
||||
return parent.getQuiz();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.referrer_user) {
|
||||
return parent.referrer_user;
|
||||
} else {
|
||||
return parent.getReferrerUser();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.role) {
|
||||
return parent.role;
|
||||
} else {
|
||||
return parent.getRole();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = (parent, args, context, info) => {
|
||||
if (parent.user) {
|
||||
return parent.user;
|
||||
} else {
|
||||
return parent.getUser();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* active Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.active.intersection(graphqlFields(info));
|
||||
|
||||
return await db.active.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_active -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* activity_log Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.activity_log.intersection(graphqlFields(info));
|
||||
|
||||
return await db.activity_log.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_activity_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* answer Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.answer.intersection(graphqlFields(info));
|
||||
|
||||
return await db.answer.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_answer -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* credential Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.credential.intersection(graphqlFields(info));
|
||||
|
||||
return await db.credential.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_credential -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* image Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.image.intersection(graphqlFields(info));
|
||||
|
||||
return await db.image.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_image -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* output_variable Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.output_variable.intersection(graphqlFields(info));
|
||||
|
||||
return await db.output_variable.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_output_variable -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* profile_header Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.profile_header.intersection(graphqlFields(info));
|
||||
|
||||
return await db.profile_header.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_profile_header -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* question Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.question.intersection(graphqlFields(info));
|
||||
|
||||
return await db.question.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_question -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* quiz Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.quiz.intersection(graphqlFields(info));
|
||||
|
||||
return await db.quiz.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_quiz -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* refer_log Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.refer_log.intersection(graphqlFields(info));
|
||||
|
||||
return await db.refer_log.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_refer_log -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rule Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.rule.intersection(graphqlFields(info));
|
||||
|
||||
return await db.rule.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_rule -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* rules Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.rules.intersection(graphqlFields(info));
|
||||
|
||||
return await db.rules.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_rules -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* user Resolve Single
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = async (_, {id}, {db}, info) => {
|
||||
try {
|
||||
const attributes = db.user.intersection(graphqlFields(info));
|
||||
|
||||
return await db.user.getByPK(id);
|
||||
} catch (error) {
|
||||
console.log('single_user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
async question({ question_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.question.intersection(graphqlFields(info));
|
||||
|
||||
return await db.question.getByPK(question_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('question -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
async user({ user_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.user.intersection(graphqlFields(info));
|
||||
|
||||
return await db.user.getByPK(user_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
async user({ user_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.user.intersection(graphqlFields(info));
|
||||
|
||||
return await db.user.getByPK(user_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
async quiz({ quiz_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.quiz.intersection(graphqlFields(info));
|
||||
|
||||
return await db.quiz.getByPK(quiz_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('quiz -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
async user({ user_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.user.intersection(graphqlFields(info));
|
||||
|
||||
return await db.user.getByPK(user_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('user -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const { ApolloError } = require('apollo-server-express');
|
||||
const graphqlFields = require('graphql-fields');
|
||||
|
||||
module.exports = {
|
||||
async profile({ profile_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.profile.intersection(graphqlFields(info));
|
||||
|
||||
return await db.profile.getByPK(profile_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('profile -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},async organization({ organization_id }, _, { db }, info) {
|
||||
try {
|
||||
const attributes = db.organization.intersection(graphqlFields(info));
|
||||
|
||||
return await db.organization.getByPK(organization_id, { attributes });
|
||||
} catch (error) {
|
||||
console.log('organization -> error', error);
|
||||
return new ApolloError('InternalServerError');
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -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