├── log └── .keep ├── storage └── .keep ├── tmp └── .keep ├── vendor └── .keep ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── public ├── favicon.ico ├── apple-touch-icon.png ├── apple-touch-icon-precomposed.png ├── open_todoist_logo.png ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── .ruby-version ├── app ├── assets │ ├── images │ │ └── .keep │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── controllers │ │ ├── tasksArchiveds.scss │ │ ├── login.scss │ │ └── home.scss │ │ ├── shared │ │ ├── sidebar.scss │ │ └── header.scss │ │ └── application.scss ├── models │ ├── concerns │ │ └── .keep │ ├── application_record.rb │ ├── score.rb │ ├── project.rb │ ├── user.rb │ └── task.rb ├── controllers │ ├── concerns │ │ ├── .keep │ │ └── response.rb │ ├── home_controller.rb │ ├── application_controller.rb │ └── api │ │ └── v1 │ │ ├── users_controller.rb │ │ ├── skills_controller.rb │ │ ├── sessions_controller.rb │ │ ├── tasks_controller.rb │ │ └── projects_controller.rb ├── views │ ├── layouts │ │ ├── mailer.text.erb │ │ ├── mailer.html.erb │ │ └── application.html.erb │ └── home │ │ └── index.html.erb ├── helpers │ └── application_helper.rb ├── jobs │ └── application_job.rb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── mailers │ └── application_mailer.rb ├── javascript │ ├── packs │ │ ├── week │ │ │ └── index.vue │ │ ├── routes.js │ │ ├── App.vue │ │ ├── application.js │ │ ├── login │ │ │ └── index.vue │ │ ├── shared │ │ │ ├── header.vue │ │ │ └── sidebar.vue │ │ ├── tasksArchiveds │ │ │ └── index.vue │ │ └── home │ │ │ └── index.vue │ └── channels │ │ ├── index.js │ │ └── consumer.js └── serializers │ └── api │ └── v1 │ ├── user_serializer.rb │ ├── session_serializer.rb │ ├── task_serializer.rb │ └── project_serializer.rb ├── .browserslistrc ├── .rspec ├── start.sh ├── db ├── seeds.rb ├── migrate │ ├── 20200410224823_add_authentication_token_to_users.rb │ ├── 20200405210627_scores.rb │ ├── 20200405210811_projects.rb │ ├── 20200405210817_tasks.rb │ └── 20200405210759_devise_create_users.rb └── schema.rb ├── Procfile.old ├── config ├── webpack │ ├── loaders │ │ └── vue.js │ ├── test.js │ ├── production.js │ ├── development.js │ └── environment.js ├── spring.rb ├── environment.rb ├── initializers │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── application_controller_renderer.rb │ ├── cookies_serializer.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── assets.rb │ ├── inflections.rb │ ├── content_security_policy.rb │ └── devise.rb ├── cable.yml ├── boot.rb ├── application.rb ├── credentials.yml.enc ├── database.yml ├── routes.rb ├── locales │ ├── en.yml │ └── devise.en.yml ├── storage.yml ├── puma.rb ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb └── webpacker.yml ├── docker-entrypoint.sh ├── spec ├── support │ └── response.rb ├── factories │ ├── score.rb │ ├── task.rb │ ├── project.rb │ └── user.rb ├── spec_helper.rb ├── models │ ├── product_spec.rb │ └── task_spec.rb ├── rails_helper.rb └── requests │ └── api │ └── v1 │ ├── tasks_request_spec.rb │ └── projects_request_spec.rb ├── config.ru ├── postcss.config.js ├── bin ├── rake ├── rails ├── yarn ├── webpack ├── webpack-dev-server ├── spring ├── setup └── bundle ├── Rakefile ├── docker-compose.yml ├── CONTRIBUING.md ├── Dockerfile ├── package.json ├── .gitignore ├── .rubocop.yml ├── Gemfile ├── babel.config.js ├── README.md └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.1 2 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format documentation 4 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | bundle install && yarn install && bundle exec foreman start 2 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | User.first_or_create(email: 'root@root.com', password: '123456') 2 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /Procfile.old: -------------------------------------------------------------------------------- 1 | web: bundle exec rails s -b '0.0.0.0' -p 3334 2 | js_compiler: ./bin/webpack-dev-server 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationHelper 4 | end 5 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationJob < ActiveJob::Base 4 | end 5 | -------------------------------------------------------------------------------- /public/open_todoist_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oliveira-andre/open_todoist/HEAD/public/open_todoist_logo.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /config/webpack/loaders/vue.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test: /\.vue(\.erb)?$/, 3 | use: [{ 4 | loader: 'vue-loader' 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class HomeController < ApplicationController 4 | def index; end 5 | end 6 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ -f tmp/pids/server.pid ]; then 5 | rm tmp/pids/server.pid 6 | fi 7 | 8 | exec bundle exec "$@" 9 | -------------------------------------------------------------------------------- /app/assets/stylesheets/controllers/tasksArchiveds.scss: -------------------------------------------------------------------------------- 1 | #tasksArchiveds { 2 | ul.projects { 3 | li { 4 | cursor: pointer; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | self.abstract_class = true 5 | end 6 | -------------------------------------------------------------------------------- /spec/support/response.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Response 4 | def parsed_response 5 | JSON.parse(response.body) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Channel < ActionCable::Channel::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Spring.watch( 4 | '.ruby-version', 5 | '.rbenv-vars', 6 | 'tmp/restart.txt', 7 | 'tmp/caching-dev.txt' 8 | ) 9 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ApplicationCable 4 | class Connection < ActionCable::Connection::Base 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/score.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :score do 5 | points { rand(0..100) } 6 | rank { :iron } 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationMailer < ActionMailer::Base 4 | default from: 'from@example.com' 5 | layout 'mailer' 6 | end 7 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is used by Rack-based servers to start the application. 4 | 5 | require_relative 'config/environment' 6 | 7 | run Rails.application 8 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Load the Rails application. 4 | require_relative 'application' 5 | 6 | # Initialize the Rails application. 7 | Rails.application.initialize! 8 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /app/javascript/packs/week/index.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /app/serializers/api/v1/user_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class UserSerializer < ActiveModel::Serializer 6 | attributes :email 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # Add new mime types for use in respond_to blocks: 5 | # Mime::Type.register "text/richtext", :rtf 6 | -------------------------------------------------------------------------------- /app/serializers/api/v1/session_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class SessionSerializer < ActiveModel::Serializer 6 | attributes :authentication_token 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/task.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :task do 5 | title { FFaker::Lorem.word } 6 | description { FFaker::Lorem.phrase } 7 | status { 0 } 8 | project 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: open_todoist_production 11 | -------------------------------------------------------------------------------- /app/javascript/channels/index.js: -------------------------------------------------------------------------------- 1 | // Load all the channels within this directory and all subdirectories. 2 | // Channel files must be named *_channel.js. 3 | 4 | const channels = require.context('.', true, /_channel\.js$/) 5 | channels.keys().forEach(channels) 6 | -------------------------------------------------------------------------------- /app/serializers/api/v1/task_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class TaskSerializer < ActiveModel::Serializer 6 | attributes :id, :title, :description, :status, :schedule_date 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 4 | 5 | require 'bundler/setup' # Set up gems listed in the Gemfile. 6 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 7 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'boot' 4 | 5 | require 'rails/all' 6 | 7 | Bundler.require(*Rails.groups) 8 | 9 | module OpenTodoist 10 | class Application < Rails::Application 11 | config.load_defaults 6.0 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Configure sensitive parameters which will be filtered from the log file. 6 | Rails.application.config.filter_parameters += [:password] 7 | -------------------------------------------------------------------------------- /db/migrate/20200410224823_add_authentication_token_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAuthenticationTokenToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :authentication_token, :string, limit: 30 4 | add_index :users, :authentication_token, unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | begin 5 | load File.expand_path('spring', __dir__) 6 | rescue LoadError => e 7 | raise unless e.message.include?('spring') 8 | end 9 | require_relative '../config/boot' 10 | require 'rake' 11 | Rake.application.run 12 | -------------------------------------------------------------------------------- /app/assets/stylesheets/controllers/login.scss: -------------------------------------------------------------------------------- 1 | #login { 2 | .card { 3 | width: 400px; 4 | height: 300px; 5 | position: absolute; 6 | top: 15%; 7 | left: 50%; 8 | transform: translate(-50%, 50%); 9 | } 10 | 11 | label { 12 | color: black !important; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Add your own tasks in files placed in lib/tasks ending in .rake, 4 | # for example lib/tasks/capistrano.rake, and they will automatically 5 | # be available to Rake. 6 | 7 | require_relative 'config/application' 8 | 9 | Rails.application.load_tasks 10 | -------------------------------------------------------------------------------- /app/javascript/channels/consumer.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | 4 | import { createConsumer } from "@rails/actioncable" 5 | 6 | export default createConsumer() 7 | -------------------------------------------------------------------------------- /app/serializers/api/v1/project_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class ProjectSerializer < ActiveModel::Serializer 6 | attributes :id, :title, :schedule_date 7 | 8 | has_many :tasks, each_serializer: TaskSerializer 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/models/score.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Score < ApplicationRecord 4 | enum rank: { iron: 0, bronze: 1, silver: 2, gold: 3, platinum: 4, diamound: 5, 5 | master: 6, grand_master: 7, challenger: 8 } 6 | 7 | has_one :user 8 | 9 | validates :points, :rank, presence: true 10 | end 11 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | const { VueLoaderPlugin } = require('vue-loader') 3 | const vue = require('./loaders/vue') 4 | 5 | environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin()) 6 | environment.loaders.prepend('vue', vue) 7 | module.exports = environment 8 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # ActiveSupport::Reloader.to_prepare do 5 | # ApplicationController.renderer.defaults.merge!( 6 | # http_host: 'example.org', 7 | # https: false 8 | # ) 9 | # end 10 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Specify a serializer for the signed and encrypted cookie jars. 6 | # Valid options are :json, :marshal, and :hybrid. 7 | Rails.application.config.action_dispatch.cookies_serializer = :json 8 | -------------------------------------------------------------------------------- /db/migrate/20200405210627_scores.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Scores < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :scores do |t| 6 | t.integer :points, null: false, default: 0 7 | t.integer :rank, null: false, default: 0 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | begin 5 | load File.expand_path('spring', __dir__) 6 | rescue LoadError => e 7 | raise unless e.message.include?('spring') 8 | end 9 | APP_PATH = File.expand_path('../config/application', __dir__) 10 | require_relative '../config/boot' 11 | require 'rails/commands' 12 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | APP_ROOT = File.expand_path('..', __dir__) 5 | Dir.chdir(APP_ROOT) do 6 | exec 'yarnpkg', *ARGV 7 | rescue Errno::ENOENT 8 | warn 'Yarn executable was not detected in the system.' 9 | warn 'Download Yarn at https://yarnpkg.com/en/docs/install' 10 | exit 1 11 | end 12 | -------------------------------------------------------------------------------- /spec/factories/project.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :project do 5 | title { FFaker::Lorem.word } 6 | status { :active } 7 | user 8 | 9 | trait :archived do 10 | status { :archived } 11 | end 12 | 13 | factory :project_deactive, traits: [:deactive] 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/factories/user.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :user do 5 | email { FFaker::Internet.email } 6 | password { 'root123' } 7 | status { :active } 8 | score 9 | 10 | trait :deative do 11 | status { :deactive } 12 | end 13 | 14 | factory :user_deactive, traits: [:deactive] 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationController < ActionController::Base 4 | include Response 5 | 6 | private 7 | 8 | def load_user 9 | @user = User&.find_by(authentication_token: request.headers['token']) 10 | 11 | return @user if @user 12 | 13 | raise ActiveRecord::RecordNotFound 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |config| 4 | config.expect_with :rspec do |expectations| 5 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 6 | end 7 | 8 | config.mock_with :rspec do |mocks| 9 | mocks.verify_partial_doubles = true 10 | end 11 | 12 | config.shared_context_metadata_behavior = :apply_to_host_groups 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20200405210811_projects.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Projects < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :projects do |t| 6 | t.string :title, null: false, default: '' 7 | t.integer :status, null: false, default: 0 8 | t.datetime :schedule_date 9 | t.references :user, foreign_key: true 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/models/product_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Project, type: :model do 6 | context 'validate presence of' do 7 | it { should validate_presence_of(:title) } 8 | it { should validate_presence_of(:status) } 9 | end 10 | 11 | context 'associations' do 12 | it { should belong_to(:user) } 13 | it { should have_many(:tasks) } 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/models/task_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | 5 | RSpec.describe Task, type: :model do 6 | context 'validate presence of' do 7 | it { should validate_presence_of(:title) } 8 | it { should validate_presence_of(:status) } 9 | it { should validate_presence_of(:project_id) } 10 | end 11 | 12 | context 'associations' do 13 | it { should belong_to(:project) } 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | 0RSapoDVKa8qnTvHBKlot6hhm68sKWeoCVyDLqkX3a9wLpXkvoq1ciNMqdpaIxJi8n93Tgt/uwz1NHqTutLxtd9ZTf94avP9tXMh6emLXVJLgz6fWwhkSG+KChRrOC7dpaDvIxoK2kgDTMjYkAM2GAXPx47+q2+plH3rOF0urVwCzb3e0mJKoeD1FoK6/gH8OpOUwhL5mGOWHnZGi6RcvMsIO+cYPxVdMfMzFTpKZEcKlxOOLrgAgz/T9xC+Qo71GNQaT3oMagHbUquR8xzQ23ddRgg3ERka1uwPxlr31/Vmqwuv7+PZzG8LwZYTBJqbqz19j6klhwCczoJ452WM4Dqf2HFSNR9kcrf5VWENTtdeGeZcMqYMdLq1WRVtCN7JBwmUNl8wE8P+1LzaR6n6XIdvYAgKNYCsHXv3--hZJ9RGhsWD+VOGt2--tay8F2fGMLJsSsiN7wqy/g== -------------------------------------------------------------------------------- /app/models/project.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Project < ApplicationRecord 4 | default_scope -> { order(created_at: :desc) } 5 | enum status: { active: 0, finalized: 1, archived: 2 } 6 | 7 | validates :title, :status, presence: true 8 | 9 | belongs_to :user 10 | has_many :tasks 11 | 12 | before_save :archive_tasks 13 | 14 | private 15 | 16 | def archive_tasks 17 | return unless status == 'archived' 18 | 19 | tasks.each(&:archived!) 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /db/migrate/20200405210817_tasks.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Tasks < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :tasks do |t| 6 | t.string :title, null: false, default: '' 7 | t.text :description 8 | t.integer :status, default: 0, null: false 9 | t.datetime :schedule_date 10 | t.integer :order, default: 0, null: false 11 | t.references :project, foreign_key: true 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # Be sure to restart your server when you modify this file. 3 | 4 | # You can add backtrace silencers for libraries that you're using but 5 | # don't wish to see in your backtraces. 6 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 7 | 8 | # You can also remove all the silencers if you're trying to debug a problem 9 | # that might stem from framework code. 10 | # Rails.backtrace_cleaner.remove_silencers! 11 | -------------------------------------------------------------------------------- /app/controllers/api/v1/users_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api 4 | module V1 5 | class UsersController < ApplicationController 6 | before_action :load_user 7 | 8 | def show 9 | success_response(data: @user, model: 'User') if @user 10 | error_response unless @user 11 | end 12 | 13 | private 14 | 15 | def load_user 16 | @user = User&.find_by(authentication_token: params[:token]) 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: postgresql 3 | encoding: unicode 4 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 5 | username: <%= ENV['db_user'] %> 6 | password: <%= ENV['db_pass'] %> 7 | port: <%= ENV['db_port'] || 5432 %> 8 | host: <%= ENV['db_host'] %> 9 | 10 | development: 11 | <<: *default 12 | database: open_todoist_development 13 | 14 | test: 15 | <<: *default 16 | database: open_todoist_test 17 | 18 | production: 19 | <<: *default 20 | database: open_todoist_production 21 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |If you are the application owner check the logs for more information.
64 |Maybe you tried to change something you didn't have access to.
63 |If you are the application owner check the logs for more information.
65 |You may have mistyped the address or the page may have moved.
63 |If you are the application owner check the logs for more information.
65 |7 | inbox 8 |
9 |Appearly you don't have any project
50 | 51 | 52 |