Skip to content

Commit 7783285

Browse files
committed
fixes upstream conflict
2 parents b65ab56 + 359d90d commit 7783285

9 files changed

Lines changed: 89 additions & 102 deletions

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ So, you want to learn how to program? Contributing to Operation Code is a great
3333
* [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
3434

3535
### Make (for Windows only)
36-
Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files. It is a standard part of the GNU library and is included in most distrubtions of Linux, as well as OSX. Unfortunately, Windows does not have a native make program, so it will need to be installed and added to PATH in order for the command line commands to work. You can use the [GNUWin general installation guide](http://gnuwin32.sourceforge.net/install.html) as a general guide on how to install a GNU package and add it to PATH.
36+
Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files. It is a standard part of the GNU library and is included in most distributions of Linux, as well as OSX. Unfortunately, Windows does not have a native make program, so it will need to be installed and added to PATH in order for the command line commands to work. You can use the [GNUWin general installation guide](http://gnuwin32.sourceforge.net/install.html) as a general guide on how to install a GNU package and add it to PATH.
3737

3838
* [Install Make](http://gnuwin32.sourceforge.net/packages/make.htm)
3939

@@ -44,7 +44,7 @@ So, you want to learn how to program? Contributing to Operation Code is a great
4444
* Forking a repo is done through GitHub's web UI. It can be found in the top right corner of the **Operation Code**'s [GitHub](https://github.com/OperationCode/operationcode_backend) page.
4545

4646
* The following commands will pull down the source code from your forked repo.
47-
* Make sure to replace `[YOUR-GITHUB-NAME]` with your GitHub name. (example: https://github.com/iserbit/operationcode_backend.git)
47+
* Make sure to replace `[YOUR-GITHUB-NAME]` with your GitHub name. (example: https://github.com/iserbit/operationcode_backend.git)
4848

4949
#### Local Development Environment
5050
_Fork the repo first._

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# README
22

33
* Ruby version
4-
2.3.1
4+
2.3.3
55
* System dependencies
66
PostgreSQL 9.5.6
77
React 2.0.1

app/controllers/api/v1/users_controller.rb

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module Api
22
module V1
33
class UsersController < ApplicationController
4+
before_action :authenticate_user!, only: %i[update]
5+
46
def index
57
render json: { user_count: User.count }, status: :ok
68
rescue StandardError => e
@@ -12,12 +14,21 @@ def create
1214

1315
if user.save
1416
UserMailer.welcome(user).deliver unless user.invalid?
15-
render json: user
17+
sign_in(user)
18+
render json: { token: user.token }
1619
else
1720
render json: user.errors, status: :unprocessable_entity
1821
end
1922
end
2023

24+
def update
25+
if current_user.update_attributes(user_params)
26+
render json: current_user
27+
else
28+
render json: current_user.errors, status: :unprocessable_entity
29+
end
30+
end
31+
2132
def verify
2233
verified = IdMe.verify! params[:access_token]
2334

@@ -40,7 +51,36 @@ def by_location
4051
private
4152

4253
def user_params
43-
params.require(:user).permit(:email, :zip, :password, :first_name, :last_name, :mentor, :slack_name, :verified, :state)
54+
params.require(:user).permit(
55+
:email,
56+
:zip,
57+
:password,
58+
:mentor,
59+
:slack_name,
60+
:first_name,
61+
:last_name,
62+
:bio,
63+
:verified,
64+
:state,
65+
:address1,
66+
:address2,
67+
:username,
68+
:volunteer,
69+
:branch_of_service,
70+
:years_of_service,
71+
:pay_grade,
72+
:military_occupational_specialty,
73+
:github,
74+
:twitter,
75+
:linked_in,
76+
:employment_status,
77+
:education,
78+
:company_role,
79+
:company_name,
80+
:education_level,
81+
:scholarship_info,
82+
interests: []
83+
)
4484
end
4585
end
4686
end

config/code_schools.yml

Lines changed: 14 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,6 @@
4747
state: TN
4848
zip: 37210
4949

50-
- name: Dev Bootcamp
51-
url: http://devbootcamp.com
52-
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/dev_bootcamp.jpg
53-
full_time: true
54-
hardware_included: false
55-
has_online: false
56-
online_only: false
57-
locations:
58-
- va_accepted: false
59-
address1: 633 Folsom Street (at Hawthorne)
60-
address2: 6th Floor
61-
city: San Francisco
62-
state: CA
63-
zip: 94107
64-
- va_accepted: false
65-
address1: 1033 W. Van Buren Street
66-
address2: 3rd Floor
67-
city: Chicago
68-
state: IL
69-
zip: 60607
70-
- va_accepted: false
71-
address1: 48 Wall Street
72-
address2: 15th Floor
73-
city: New York
74-
state: NY
75-
zip: 10005
76-
7750
- name: Galvanize
7851
url: https://new.galvanize.com
7952
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/galvanize.jpg
@@ -142,22 +115,6 @@
142115
state: CA
143116
zip: 94105
144117

145-
- name: RefactorU
146-
url: http://refactoru.com
147-
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/refactoru.jpg
148-
full_time: true
149-
hardware_included: false
150-
has_online: false
151-
online_only: false
152-
notes: RefactorU is proud and honored to announce that its Web Development Bootcamp has been approved by the <a href="http://www.benefits.va.gov/gibill/">Colorado State Approving Agency for Veterans Education & Training</a>. Students eligible for the The Post-9/11 GI Bill, Montgomery GI Bill (Active Duty/Selected Reserve), Reserve Educational Assistance Program, Veterans Educational Assistance Program, and Survivors’ and Dependents’ Educational Assistance Program may be eligible to apply those benefits to RefactorU’s Web Application Development Bootcamp.
153-
locations:
154-
- va_accepted: true
155-
address1: 5717 Arapahoe Avenue
156-
address2: "Suite #216"
157-
city: Boulder
158-
state: CO
159-
zip: 80303
160-
161118
- name: Turing School of Software & Design
162119
url: http://turing.io/
163120
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/turing.jpg
@@ -173,60 +130,6 @@
173130
state: CO
174131
zip: 80202
175132

176-
- name: The Iron Yard
177-
url: https://www.theironyard.com
178-
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/iron_yard.jpg
179-
full_time: true
180-
hardware_included: false
181-
has_online: false
182-
online_only: false
183-
locations:
184-
- va_accepted: false
185-
address1: 101 S. Garland Avenue
186-
address2: Suite 102
187-
city: Orlando
188-
state: FL
189-
zip: 32801
190-
- va_accepted: false
191-
address1: "260 1st Avenue S"
192-
address2: Suite 300
193-
city: Tampa Bay
194-
state: FL
195-
zip: 33701
196-
- va_accepted: false
197-
address1: 3423 Piedmont Road NE
198-
city: Atlanta
199-
state: GA
200-
zip: 30305
201-
- va_accepted: false
202-
address1: 334 Blackwell Street
203-
address2: Suite B017
204-
city: Durham
205-
state: NC
206-
zip: 27701
207-
- va_accepted: false
208-
address1: 510 Mill Street
209-
city: Mount Pleasant
210-
state: SC
211-
zip: 29464
212-
- va_accepted: false
213-
address1: 411 University Ridge
214-
address2: Suite 220
215-
city: Greenville
216-
state: SC
217-
zip: 29601
218-
- va_accepted: false
219-
address1: 3601 South Congress Avenue
220-
address2: Suite c304
221-
city: Austin
222-
state: TX
223-
zip: 78704
224-
- va_accepted: false
225-
address1: 1121 Delano Street
226-
city: Houstin
227-
state: TX
228-
zip: 77003
229-
230133
- name: General Assembly
231134
url: https://generalassemb.ly
232135
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/general_assembly.jpg
@@ -771,3 +674,17 @@
771674
city: Chicago
772675
state: IL
773676
zip: 60603
677+
678+
- name: DevPoint Labs
679+
url: http://www.devpointlabs.com/
680+
logo: https://raw.githubusercontent.com/OperationCode/operationcode_frontend/master/src/images/codeSchoolLogos/DPL_logo.png
681+
full_time: true
682+
hardware_included: false
683+
has_online: false
684+
online_only: false
685+
locations:
686+
- va_accepted: true
687+
address1: 370 South 300 East
688+
city: Downtown Salt Lake City
689+
state: UT
690+
zip: 84111

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
resources :tags, only: :index
3131
resources :team_members, only: [:index, :create, :update, :destroy]
3232
resources :users, only: [:index, :create]
33+
patch '/users', to: 'users#update'
3334

3435
devise_scope :user do
3536
post '/sessions', to: 'sessions#create'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class AddAdditionalFieldsForProfilesToUsers < ActiveRecord::Migration[5.0]
2+
def change
3+
add_column :users, :company_role, :string
4+
add_column :users, :company_name, :string
5+
add_column :users, :education_level, :string
6+
add_column :users, :interests, :string
7+
end
8+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddScholarshipInfoFieldToUsers < ActiveRecord::Migration[5.0]
2+
def change
3+
add_column :users, :scholarship_info, :boolean, default: false
4+
end
5+
end

db/schema.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@
191191
t.string "linkedin"
192192
t.string "employment_status"
193193
t.string "education"
194+
t.string "company_role"
195+
t.string "company_name"
196+
t.string "education_level"
197+
t.string "interests"
198+
t.boolean "scholarship_info", default: false
194199
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
195200
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
196201
end

test/controllers/api/v1/users_controller_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ class Api::V1::UsersControllerTest < ActionDispatch::IntegrationTest
1010
assert_equal 200, response.status
1111
end
1212

13+
test 'can update a user' do
14+
user = create(:user)
15+
headers = authorization_headers(user)
16+
17+
refute_equal 'new first name', user.first_name
18+
patch api_v1_users_url, params: { user: { first_name: 'new first name'} }, headers: headers, as: :json
19+
user.reload
20+
assert_equal 'new first name', user.first_name
21+
assert_response :success
22+
end
23+
1324
test ":by_location returns User.count of users located in the passed in location" do
1425
tom = create :user
1526
sam = create :user

0 commit comments

Comments
 (0)