Skip to content

Instantly share code, notes, and snippets.

Jordan Last lastmjs

Block or report user

Report or block lastmjs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View datamodel.graphql
# All types defined here will be fed through the Prisma generation process
# Essentially, all of these types become database tables
type User {
id: ID! @unique
createdAt: DateTime! @private
updatedAt: DateTime! @private
email: String! @unique @userOwns(field: "id")
password: String! @private
}
View dataops.graphql
# This is where we define any custom resolvers, and where we add custom directives to any generated Prisma resolvers
type AuthPayload {
token: String!
user: User!
}
type Mutation {
# Custom resolvers
signup(email: String!, password: String!): AuthPayload!
View directives.graphql
directive @userOwns(field: String) on FIELD | FIELD_DEFINITION
directive @authenticated on FIELD | FIELD_DEFINITION
directive @private on FIELD | FIELD_DEFINITION
View ultimate-schema.ts
const ultimateSchemaString = mergeTypes([
readFileSync('./schema/datamodel.graphql').toString(),
readFileSync('./schema/dataops.graphql').toString(),
readFileSync('./schema/directives.graphql').toString(),
readFileSync('./generated/prisma.graphql').toString()
], {
all: true
});
const ultimateSchema = makeExecutableSchema({
typeDefs: ultimateSchemaString,
@lastmjs
lastmjs / block-full-stack-mentor-assessment.md
Last active Aug 25, 2019
Full Stack Mentor - Candidate Assessment
View block-full-stack-mentor-assessment.md

JavaScript

Hey Student,

Oh dear, this is a tricky one. It's definitely messed me up in the past. What's happening here is an issue of scoping and closures. A few things to point you in the right direction:

  1. Study block scoping versus function scoping in JavaScript
  2. Study JavaScript's variable declarators, var, let, and const, and understand the differences between their uses
  3. Study up a bit on closures in JavaScript
  4. With your new knowledge, try to make btnNum block scoped instead of function scoped
You can’t perform that action at this time.