first commit

This commit is contained in:
ryanwong
2022-04-12 08:57:07 -04:00
commit 1bab399b38
446 changed files with 109788 additions and 0 deletions
View File
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}
+56
View File
@@ -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');
}
}