-
Notifications
You must be signed in to change notification settings - Fork 108
Issue365 add jobs #366
base: master
Are you sure you want to change the base?
Issue365 add jobs #366
Changes from 5 commits
ada2703
a1ffefe
777af57
8543559
6f022f0
e2c5b19
a1bcd87
b9e40d6
263375b
75eed14
2c0596f
7656a81
8960e38
c85f56d
f6de002
ef27d87
d8c8336
9ea4d55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ActiveAdmin.register Job do | ||
permit_params :title, :source_url, :source, :city, :state, :country, :description, :status, :remote | ||
|
||
index do | ||
selectable_column | ||
id_column | ||
|
||
column :title | ||
column :source_url | ||
column :source | ||
column :city | ||
column :state | ||
column :country | ||
column :description | ||
column :status | ||
column :remote | ||
|
||
actions | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Api | ||
module V1 | ||
class JobsController < ApiController | ||
def index | ||
render json: Job.all, status: :ok | ||
rescue StandardError => e | ||
render json: { errors: e.message }, status: :unprocessable_entity | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Api | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did this extra controller sneak in? |
||
module V1 | ||
class JobsController < ApiController | ||
def index | ||
render json: Job.all, status: :ok | ||
rescue StandardError => e | ||
render json: { errors: e.message }, status: :unprocessable_entity | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Job < ApplicationRecord | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does having this in the models section of the code base make it clear enough that this is separate from Sidekiq Jobs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so, yes. Though, it might be helpful to rename the background jobs from Job(s) to Worker(s). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure you don't want JobJobs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that you mention it, maybe |
||
acts_as_taggable_on | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you pls add a method similar to this one in here: https://github.com/OperationCode/operationcode_backend/blob/master/app/models/user.rb#L130-L141 As well as an associated test. This will confirm that a given job can have tags (plural) added to it, and then we can use this method to query for any jobs that match the search criteria. |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreateJobs < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :jobs do |t| | ||
t.string :title | ||
t.string :source_url | ||
t.string :source | ||
t.string :city | ||
t.string :state | ||
t.string :country | ||
t.text :description | ||
t.string :status | ||
t.boolean :remote, default: false | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pls add a form for creating/updating. Here is an example:
https://github.com/OperationCode/operationcode_backend/blob/master/app/admin/code_school.rb#L28-L45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I add the form and try to add a job I get the following error: "
Should I install that gem, or are we already using something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hpjaj I don't see where you responded here. If @leenyburger issue has been addressed, disregard just getting visibility.