Skip to content

Instantly share code, notes, and snippets.

View acomito's full-sized avatar

Anthony Comito acomito

View GitHub Profile
type MasterPanel {
id: ID
}
// TOP LEVEL IMPORTS
import gql from 'graphql-tag';
export default gql`
query getcoffeecupreport($timestamp: Float, $shift: String, $count: Int, $skip: Int) {
getcoffeecupreport(timestamp: $timestamp, shift: $shift, count: $count, skip: $skip) {
total
machines {
id
name
// ==========================================
// USERS
// ==========================================
const USERS = {
id: String,
firstName: String,
lastName: String,
email: String,
title: String,
employeeId: String,
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@accounts/boost@^0.19.0":
version "0.19.0"
resolved "https://registry.yarnpkg.com/@accounts/boost/-/boost-0.19.0.tgz#c3ac2df56977d41748ef797cfe758fa338cb66e8"
dependencies:
"@accounts/database-manager" "^0.19.0"
"@accounts/graphql-api" "^0.19.0"
import { typeCheck } from 'type-check';
export default ({ name }) => {
// setup a variable called programName that we'll eventually return
let programName = name;
// if no program exists, return null
if (!name) {
console.log('You need to pass a name');
return null;
@acomito
acomito / medium-8.js
Created August 11, 2019 12:54
collections/Users/helpers.js
import Users from './model';
const getById = async id => {
try {
if (!id) return null;
// search for inventory item
let doc = await Users.findOne({ _id: id });
return doc; // firebase doesnt include the id, so tack it on
} catch (err) {
console.log(err);
@acomito
acomito / medium-7.js
Created August 11, 2019 12:54
collections/Users/model.js
import Mongo from 'modules/mongodb';
const EmailModel = new Mongo.Schema({
address: String
});
const schema = new Mongo.Schema({
id: String,
emails: [EmailModel]
});
import { gql } from 'apollo-server';
import UserProfiles from 'collections/UserProfiles/model';
import Users from 'collections/Users/helpers';
export const UserProfileResolvers = {
UserProfile: {
id: root => {
// in some cases we'll already have masked _id for id, so check if id exists and return that if it does exist
if (root.id) return root.id;
// if id doesn't exist yet, we'll return _id as id
// // TOP LEVEL IMPORTS
import { merge } from 'lodash';
import { gql } from 'apollo-server';
// // User
import { QueryResolvers, QuerySchema } from './types/Query';
import { MutationSchema, MutationResolvers } from './types/Mutation';
import { UserProfileSchema, UserProfileResolvers } from './types/UserProfile';
// using interefaces with each vendor's schema (caterer, venue, etc) will throw an error if one of the types is missing something form our Vendor interface... not exactly like classes/inheritance, but at least it will keep the sub-types in like with the Vendor type.... albeit not DRY
// import mongoose from 'mongoose';
import AccountsPassword from '@accounts/password';
import MongoDBInterface from '@accounts/mongo';
import AccountsServer from '@accounts/server';
import { AccountsModule } from '@accounts/graphql-api';
import { ApolloServer } from 'apollo-server';
import { merge } from 'lodash';
import { typeDefs, CustomResolvers } from './src/graphql-api/index';
import { db } from './src/modules/mongodb.js';
import emailTransporter from './src/modules/email.js';