This commit is contained in:
ryanwong
2022-02-06 22:15:10 -05:00
parent 46625dd6cd
commit a07577bffa
145 changed files with 12008 additions and 0 deletions
View File
+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*/
/**
* calendar 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.calendar.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.calendar.findAndCountAll(options);
const edges = rows.map((calendar) => ({
cursor: calendar.id,
node: calendar,
}));
const pageInfo = {
endCursor: last(edges)?.cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('calendar -> error', error);
return new ApolloError('InternalServerError');
}
}
+56
View File
@@ -0,0 +1,56 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* code 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.code.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.code.findAndCountAll(options);
const edges = rows.map((code) => ({
cursor: code.id,
node: code,
}));
const pageInfo = {
endCursor: last(edges).cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('code -> 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*/
/**
* link 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.link.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.link.findAndCountAll(options);
const edges = rows.map((link) => ({
cursor: link.id,
node: link,
}));
const pageInfo = {
endCursor: last(edges)?.cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('link -> error', error);
return new ApolloError('InternalServerError');
}
}
+56
View File
@@ -0,0 +1,56 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* links 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.links.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.links.findAndCountAll(options);
const edges = rows.map((links) => ({
cursor: links.id,
node: links,
}));
const pageInfo = {
endCursor: last(edges).cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('links -> error', error);
return new ApolloError('InternalServerError');
}
}
+56
View File
@@ -0,0 +1,56 @@
"use strict";
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* note 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.note.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.note.findAndCountAll(options);
const edges = rows.map((note) => ({
cursor: note.id,
node: note,
}));
const pageInfo = {
endCursor: last(edges)?.cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('note -> error', error);
return new ApolloError('InternalServerError');
}
}
+57
View File
@@ -0,0 +1,57 @@
'use strict';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* notes 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');
const { QueryTypes } = require('sequelize');
module.exports = async (_, { first, after }, { db, credential }, info) => {
//Check Auth if user allowed
try {
const attributes = db.notes.intersection(graphqlFields(info).edges.node);
const options = {
where: {},
limit: first,
attributes,
};
const users = await sequelize.query('SELECT * FROM `notes`', { type: QueryTypes.SELECT });
console.log('Notes are: ' + users);
if (after) {
options.where = {
id: {
[Sequelize.Op.gt]: after,
},
};
}
const { count, rows } = await db.notes.findAndCountAll(options);
const edges = rows.map((notes) => ({
cursor: notes.id,
node: notes,
}));
const pageInfo = {
endCursor: last(edges).cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('notes -> 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 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.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.findAndCountAll(options);
const edges = rows.map((profile) => ({
cursor: profile.id,
node: profile,
}));
const pageInfo = {
endCursor: last(edges).cursor,
hasNextPage: 0 < count - first,
};
return {
edges,
pageInfo,
};
} catch (error) {
console.log('profile -> 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*/
/**
* 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');
}
}