initial commit

This commit is contained in:
2023-09-07 14:23:30 -05:00
commit 857aa1af52
213 changed files with 5930 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
# frozen_string_literal: true
require 'teamsnap'
require 'net/http'
require 'uri'
require 'date'
class TeamController < ApplicationController
include SessionsHelper
before_action :logged_in_user
def show
team_id = params[:team_id]
session[:team_id] = team_id
team = TeamSnap::Team.find(@teamsnap_client, team_id)
upcoming_events = TeamSnap::Event.search(@teamsnap_client, {
team_id: team_id, started_after: Date.today.strftime("%Y-%m-%d"), page_size: 4
})
past_events = TeamSnap::Event.search(@teamsnap_client, {
team_id: team_id, started_before: Date.today.strftime("%Y-%m-%d"), page_size: 4, sort_start_date: "desc"
})
items = TeamSnap::AvailabilitySummary.search(@teamsnap_client, {:event_id => upcoming_events.map{|e|e.id}.join(",")})
render 'show', locals: { team: team, upcoming_events: upcoming_events, past_events: past_events, availability_summaries: items }
end
def list
teams = TeamSnap::Team.search(@teamsnap_client, { user_id: @user_id })
render 'list', locals: { teams: teams }
end
end