Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilgkrishnan committed Nov 17, 2022
2 parents 737aaa4 + be6cfcb commit 717416c
Show file tree
Hide file tree
Showing 168 changed files with 3,704 additions and 2,705 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ APP_BASE_URL="localhost:3000"
# Mailer Configuration
EMAIL_DELIVERY_METHOD='letter_opener'
MAILER_SENDER="[email protected]"
REPLY_TO_EMAIL="[email protected]"

# SendGrid Email Configuration
SENDGRID_USERNAME='apikey'
Expand Down Expand Up @@ -36,6 +37,7 @@ SIDEKIQ_PASSWORD: <some_password>
# Stripe
STRIPE_PUBLISHABLE_KEY="stripe_publishable_key"
STRIPE_SECRET_KEY="stripe_secret_key"
STRIPE_WEBHOOK_ENDPOINT_SECRET="stripe_webhook_endpoint_secret"

#Wise
WISE_API_URL="https://api.sandbox.transferwise.tech"
Expand Down
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.3"
gem "rails", "~> 7.0.4"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
# gem "sprockets-rails", ">= 3.4.1"
Expand Down Expand Up @@ -44,6 +44,9 @@ gem "redis", "~> 4.0"
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# A ruby implementation of the RFC 7519 OAuth JSON Web Token (JWT) standard.
# gem "jwt"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]

Expand Down Expand Up @@ -198,4 +201,5 @@ group :test do

# Strategies for cleaning databases in Ruby.
gem "database_cleaner", "~> 2.0"
gem "hash_dot"
end
123 changes: 61 additions & 62 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,72 +13,72 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.3.1)
actionpack (= 7.0.3.1)
activesupport (= 7.0.3.1)
actioncable (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.3.1)
actionpack (= 7.0.3.1)
activejob (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
actionmailbox (7.0.4)
actionpack (= 7.0.4)
activejob (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.3.1)
actionpack (= 7.0.3.1)
actionview (= 7.0.3.1)
activejob (= 7.0.3.1)
activesupport (= 7.0.3.1)
actionmailer (7.0.4)
actionpack (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activesupport (= 7.0.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.3.1)
actionview (= 7.0.3.1)
activesupport (= 7.0.3.1)
actionpack (7.0.4)
actionview (= 7.0.4)
activesupport (= 7.0.4)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.3.1)
actionpack (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
actiontext (7.0.4)
actionpack (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.3.1)
activesupport (= 7.0.3.1)
actionview (7.0.4)
activesupport (= 7.0.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_interaction (4.1.0)
activemodel (>= 5, < 8)
activesupport (>= 5, < 8)
activejob (7.0.3.1)
activesupport (= 7.0.3.1)
activejob (7.0.4)
activesupport (= 7.0.4)
globalid (>= 0.3.6)
activemodel (7.0.3.1)
activesupport (= 7.0.3.1)
activerecord (7.0.3.1)
activemodel (= 7.0.3.1)
activesupport (= 7.0.3.1)
activemodel (7.0.4)
activesupport (= 7.0.4)
activerecord (7.0.4)
activemodel (= 7.0.4)
activesupport (= 7.0.4)
activerecord-import (1.4.0)
activerecord (>= 4.2)
activestorage (7.0.3.1)
actionpack (= 7.0.3.1)
activejob (= 7.0.3.1)
activerecord (= 7.0.3.1)
activesupport (= 7.0.3.1)
activestorage (7.0.4)
actionpack (= 7.0.4)
activejob (= 7.0.4)
activerecord (= 7.0.4)
activesupport (= 7.0.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.3.1)
activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -214,6 +214,7 @@ GEM
grover (1.1.1)
combine_pdf (~> 1.0)
nokogiri (~> 1.0)
hash_dot (2.5.0)
hashdiff (1.0.1)
hashie (5.0.0)
i18n (1.10.0)
Expand Down Expand Up @@ -261,16 +262,12 @@ GEM
digest
net-protocol
strscan
net-pop (0.1.1)
digest
net-pop (0.1.2)
net-protocol
timeout
net-protocol (0.1.3)
timeout
net-smtp (0.3.1)
digest
net-smtp (0.3.3)
net-protocol
timeout
newrelic_rpm (8.7.0)
nio4r (2.5.8)
nokogiri (1.13.9-aarch64-linux)
Expand Down Expand Up @@ -325,20 +322,20 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (7.0.3.1)
actioncable (= 7.0.3.1)
actionmailbox (= 7.0.3.1)
actionmailer (= 7.0.3.1)
actionpack (= 7.0.3.1)
actiontext (= 7.0.3.1)
actionview (= 7.0.3.1)
activejob (= 7.0.3.1)
activemodel (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
rails (7.0.4)
actioncable (= 7.0.4)
actionmailbox (= 7.0.4)
actionmailer (= 7.0.4)
actionpack (= 7.0.4)
actiontext (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activemodel (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
bundler (>= 1.15.0)
railties (= 7.0.3.1)
railties (= 7.0.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -348,9 +345,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (7.0.3.1)
actionpack (= 7.0.3.1)
activesupport (= 7.0.3.1)
railties (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -482,11 +479,11 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stripe (6.2.0)
strscan (3.0.3)
strscan (3.0.4)
thor (1.2.1)
tilt (2.0.10)
timeout (0.3.0)
tzinfo (2.0.4)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
uniform_notifier (1.16.0)
Expand Down Expand Up @@ -531,6 +528,7 @@ DEPENDENCIES
activerecord-import
annotate
aws-sdk-s3
bcrypt (~> 3.1.7)
bootsnap (>= 1.4.4)
bullet
bundler-audit
Expand All @@ -547,6 +545,7 @@ DEPENDENCIES
faker
foreman
grover
hash_dot
honeybadger
image_processing (>= 1.2)
jbuilder (~> 2.11)
Expand All @@ -561,7 +560,7 @@ DEPENDENCIES
puma (~> 5.0)
pundit (~> 2.2)
rack-mini-profiler (>= 2.3.3)
rails (~> 7.0.3)
rails (~> 7.0.4)
rails-controller-testing (~> 1.0, >= 1.0.5)
ransack
react-rails
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://getmiru.com/assets/images/image01.svg?v=097ef681" width="200" />
<img src="https://miru.so/static/media/miru-blue-logo-with-text.5ba2b3fe09b9f038473f0a131f8a8bec.svg" width="200" />
<br/>
</p>

Expand Down Expand Up @@ -166,10 +166,10 @@ You can deploy Miru on Heroku using the one-click-deployment button:
## Community Support

- Feel free to join our [Discord](https://discord.gg/UABXyQQ82c) channel for support and questions.
- Subscribe our latest [blog articles](https://blog.getmiru.com) and tutorials.
- Subscribe our latest [blog articles](https://blog.miru.so) and tutorials.
- [Discussions](https://github.com/saeloun/miru-web/discussions): Post your questions regarding Miru Web
- [**Twitter**](https://twitter.com/getmiru)
- [Documentation](https://docs.getmiru.com/)
- [Documentation](https://docs.miru.so)

## Contributing
We encourage everyone to contribute to Miru Web! Check out [Contributing Guide](CONTRIBUTING.md) for guidelines about how to proceed.. <br>
Expand Down
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "Miru",
"repository": "https://github.com/saeloun/miru-web",
"description": "Miru is an open-source to for time tracking, invoice management, and accounting easy for small businesses worldwide.",
"website": "https://getmiru.com/",
"logo": "https://getmiru.com/assets/images/image01.svg",
"website": "https://miru.so/",
"logo": "https://miru.so/static/media/miru-blue-logo-with-text.5ba2b3fe09b9f038473f0a131f8a8bec.svg",
"success_url": "/",
"env": {
"SECRET_TOKEN": {
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/api/v1/base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

class Api::V1::BaseController < ActionController::API
include Authenticable
include CurrentCompanyConcern
end
36 changes: 36 additions & 0 deletions app/controllers/api/v1/timesheet_entry_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

class Api::V1::TimesheetEntryController < Api::V1::BaseController
include Timesheet

before_action :ensure_project_member

def create
timesheet_entry = project.timesheet_entries.new(timesheet_entry_params)
timesheet_entry.user = current_user
timesheet_entry.save!
render json: {
notice: I18n.t("timesheet_entry.create.message"),
entry: timesheet_entry.formatted_entry
}
end

private

def project_member
ProjectMember.find_by(user_id: current_user.id, project_id: project.id)
end

def project
@_project ||= current_company.projects.kept.find(params[:timesheet_entry][:project_id])
end

def timesheet_entry_params
params.require(:timesheet_entry).permit(
:project_id, :duration, :work_date, :note, :bill_status)
end

def ensure_project_member
return render json: { notice: "User is not a project member." }, status: :forbidden if project_member.blank?
end
end
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ApplicationController < ActionController::Base
include ErrorHandler
include CurrentCompanyConcern
include Pagy::Backend
include SetCurrentDetails

before_action :authenticate_user!, :validate_company!

Expand Down
33 changes: 33 additions & 0 deletions app/controllers/concerns/authenticable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

module Authenticable
extend ActiveSupport::Concern

included do
before_action :authenticate_token
end

def authenticate_token
return render json: { status: 401, notice: "Invalid Token." }, status: 401 if current_user.blank?
end

private

def current_user
@current_user ||= User.find_by(token:)
end

def bearer_token
pattern = /^Bearer /
header = request.headers["Authorization"]
header.gsub(pattern, "") if header && header.match(pattern)
end

def token
if bearer_token.present?
@_token = bearer_token
elsif params[:auth_token].present?
@_token = params[:auth_token]
end
end
end
12 changes: 12 additions & 0 deletions app/controllers/concerns/set_current_details.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module SetCurrentDetails
extend ActiveSupport::Concern

included do
before_action do
Current.user = current_user
Current.company = current_company
end
end
end
Loading

0 comments on commit 717416c

Please sign in to comment.