Skip to content

Commit

Permalink
not sure how these were missed 🤔
Browse files Browse the repository at this point in the history
  • Loading branch information
fermion committed Mar 6, 2024
1 parent 610be55 commit 3fea19f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/graphql/mutations/upsert_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UpsertProject < BaseMutation
argument :ends_on, GraphQL::Types::ISO8601Date, required: false, description: "The date this assignment ends."

# return type from the mutation
type Types::StaffPlan::ProjectType
type Types::StaffPlan::ProjectType, null: true

def resolve(id: nil, client_id: nil, name: nil, status: nil, cost: nil, payment_frequency: nil, starts_on: nil, ends_on: nil)
current_company = context[:current_company]
Expand All @@ -32,7 +32,7 @@ def resolve(id: nil, client_id: nil, name: nil, status: nil, cost: nil, payment_
GraphQL::ExecutionError.new("Client not found", extensions: { attribute: "client_id" })
)

return
return {}
end

project = client.projects.new
Expand Down
8 changes: 4 additions & 4 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type Mutation {
"""
The ID of the client for this project.
"""
clientId: ID!
clientId: ID

"""
The cost of the project.
Expand All @@ -133,7 +133,7 @@ type Mutation {
"""
The name of the project.
"""
name: String!
name: String

"""
The frequency of payment for the project.
Expand All @@ -148,8 +148,8 @@ type Mutation {
"""
The status of the assignment.
"""
status: String!
): Project!
status: String
): Project

"""
Create or update a work week record for a StaffPlan user.
Expand Down
2 changes: 1 addition & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Project < ApplicationRecord
VALID_PAYMENT_FREQUENCIES = [WEEKLY, MONTHLY, FORTNIGHTLY, QUARTERLY, ANNUALLY].freeze

validates :client_id, presence: true
validates :name, presence: true, uniqueness: { case_sensitive: false }
validates :name, presence: true, uniqueness: { scope: :client_id, case_sensitive: false }
validates :status, inclusion: { in: VALID_STATUSES }, allow_blank: true
validates :cost, numericality: { greater_than_or_equal_to: 0.0 }, allow_blank: true
validates :payment_frequency, inclusion: { in: VALID_PAYMENT_FREQUENCIES }, allow_blank: true
Expand Down
3 changes: 1 addition & 2 deletions spec/sidekiq/sync_customer_subscription_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
company.subscription.stripe_id,
{ items: [
{id: company.subscription.item_id, quantity: 2 }
]},
{proration_date: Date.today.iso8601}
]}
)

SyncCustomerSubscriptionJob.perform_inline(company.id)
Expand Down

0 comments on commit 3fea19f

Please sign in to comment.