var _Maybe = function(val) {
this.val = val;
}
var map = function(f, obj) {
return obj.map(f);
}
var Maybe = function(x) {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApiController < ApplicationController | |
| def create | |
| query_string = params[:query] | |
| query_variables = ensure_hash(params[:variables]) | |
| result = MeetupEventPlannerSchema.execute( | |
| query_string, | |
| variables: query_variables, | |
| context: { } | |
| ) | |
| render json: result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails.application.routes.draw do | |
| devise_for :users | |
| mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/api" | |
| root to: redirect("/graphiql") | |
| resources :api | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AuthUserType = GraphQL::ObjectType.define do | |
| name 'AuthUser' | |
| description 'The authenticated user model type' | |
| field :id, types.ID, 'The id of this user' | |
| field :name, !types.String, 'The name of the user' | |
| field :email, !types.String, 'The email of the user' | |
| field :bio, types.String, 'The bio of the user' | |
| field :created_at, types.String, 'The datetime string when the user was created' | |
| field :events, types[EventType], 'The user events' | |
| field :avatar, types.String, 'The user avatar' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| field :authUser, AuthUserType do | |
| argument :auth_token, !types.String | |
| resolve -> (obj, args, ctx) do | |
| User.find_by(auth_token: args[:auth_token]) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // import dependencies here | |
| class EventsContainer extends Component { | |
| constructor() { | |
| super(); | |
| this.handleMore = this.handleMore.bind(this); | |
| } | |
| handleMore() { | |
| const { | |
| actions, | |
| refetch, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| field :events, types[EventType] do | |
| argument :first, types.Int | |
| resolve -> (obj, args, ctx) { | |
| events = Event.all.sort_by(&:start_date).reverse | |
| if args[:first] | |
| events = events.first(args[:first]) | |
| end | |
| events | |
| } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module EventMutations | |
| Create = GraphQL::Relay::Mutation.define do | |
| name 'CreateEvent' | |
| input_field :event, EventInputType | |
| input_field :auth_token, !types.String | |
| return_field :event, EventType | |
| resolve -> (inputs, ctx) do | |
| event_inputs = inputs[:event] | |
| start_date = Date.strptime(event_inputs[:start_date], '%m/%d/%Y').to_datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateEvent extends Component { | |
| // ... | |
| handleSubmit() { | |
| const { | |
| actions, | |
| mutate, | |
| fields, | |
| guestList, | |
| user, | |
| } = this.props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Profile extends Component { | |
| // Removed for brevity. View the whole component | |
| // here: https://github.com/RyanCCollins/meetup-event-planner/tree/master/client/app/src/containers/ProfileContainer | |
| handleSaving() { | |
| const { | |
| updateProfile, | |
| bioInput, | |
| avatarInput, | |
| employerInput, | |
| actions, |