GithubHelp home page GithubHelp logo

kakeibo's Introduction

家計簿アプリ

自分の出費を記録してどのぐらい出費したかわかるようにできるアプリです
データ化する事によって自分の出費がどのぐらいか把握できる様に、、、
あなたの無駄遣いを救いたい
出費を登録、編集、削除ができます
明細一覧に使った合計額が表示されます
使った出費をカテゴリで分けて管理できます
特に難しい操作は無く、どの年代でも使えます
自分自身、家計簿アプリを使用しており、自分でも開発してみたいという考えで開発をしてみました
開発してく中で理解力が深まりRubyが大好きになりました

アプリのURL

https://my--kakeibo.herokuapp.com/
ゲストデータが用意してあります
email: [email protected]
password: 1234
ログインに成功したら明細の登録をしていただき挙動を確認ください

開発中で解決したエラーをQiitaの記事に書きました

https://qiita.com/djedmphi/items/d2619e6634a79edcf7fc
https://qiita.com/djedmphi/items/0a92423d20a212f38028

デプロイ先

Heroku

使用書

  1. 会員登録をしてください
  2. 登録が完了しましたらマイページに移ります
  3. 明細を登録するで自分の出費を登録できます
  4. カテゴリ一覧でカテゴリが管理できます
  5. つぶやき広場で悩みなど書けます

ER図

スクリーンショット 2022-07-05 2 52 25

目指した課題

目標に対して迅速に作れることを意識して作りました
開発期間は3ヶ月です
綺麗なコードを心掛けました

これから実装予定

家族で1つの家計簿を管理する機能を追加予定
相当な難易度らしいですがレベルアップのため挑戦します

カレンダー機能

こだわったところ

1. カテゴリの追加を非同期処理(ajax)にした

非同期は今後通る道だと考え挑戦してアドバイスを貰いながらなんとか実装出来ました!!
複雑なjsを書いてます
自分の使っているアプリにはない機能でposts/newから非同期でcategoryが追加できるのが強みです。
自分にとって傑作です


2. ログイン機能

ログインの理解力を深めったかったのでdevideじゃない実装をしてみました!!
deviseだとワンコマンドで出来てしまう為、中の処理がフワフワだったのですが自分で作る事により、理解力がより一層深まりました
deviseが如何に便利か思い知らされました


3. 検索機能

スコープをガンガン使用して
データの取り出しをしてみました
whereがない分、コードがとても見やすいです
何月何日からの間検索ができます

models/post.rb

  scope :eager_load_category, -> { eager_load(:category) }
  scope :keyword, ->(keyword) { where('memo LIKE ?', "%#{keyword}%") if keyword.present? }
  scope :prices, ->(price) { where('price = ? ', price) if price.present? }
  scope :use_day, ->(use_day, end_day) { where("use_day BETWEEN ? AND ? ", use_day.to_s, end_day.to_s) if use_day.present? && end_day.present? }

4. TDD開発

TDD開発が主流と聞いたので初めはテストから書きました!
itを書いていく中、あれが足りない、これが足りないなど気づけることが出来たのでかなり恩恵を感じました


5. S3に画像を保存

AWSの使用が今後必ず訪れると分かったのでローカル、herokuで画像が保存される設定をしました


6. ブックマーク機能(ajax)

ついでにブックマークもajaxしてみました
将来的には、jsonを返却するAPIに変更し、フロントエンドもこれに対応する。


実装した機能

1. 明細登録機能(posts)+画像登録

一覧ページでは合計額、件数が表示されるようにしています
使った出費の値段+画像+日付+メモ+カテゴリーの登録ができるようになってます
登録、編集、削除ができます
スクリーンショット 2022-07-03 16 58 40


2. ログイン機能(users)

ユーザーの登録、編集、退会ができます
スクリーンショット 2022-06-30 0 40 48


3. カテゴリー管理機能

使った出費のカテゴリを登録、編集、削除ができます
スクリーンショット 2022-06-30 0 47 11


4. ブックマーク機能 スクリーンショット 2022-06-30 0 50 51


5. 検索機能

キーワード検索: メモをキーワード検索できます
完全一致検索: 値段を検索できます ※完全一致した明細しか検索できません
間検索: 使った日付の間を検索できます
スクリーンショット 2022-06-30 0 53 14


6. つぶやき機能

つぶやける広場を実装してみました
2chみたいな作りにしました
スクリーンショット 2022-07-03 16 41 52


使用環境

  • M1 mac
  • Ruby 3.1.0
  • PostgreSQL 14.2
  • RuboCop
  • AWS S3
  • Rails 6.1.4
  • RSpec

テーブル設計

userテーブル

schema.rb

create_table "users", force: :cascade do |t|
    t.string "name"
    t.string "password"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.string "email"
    t.index ["email"], name: "index_users_on_email", unique: true
    t.index ["name"], name: "index_users_on_name", unique: true
  end

アソシエーション

models/post.rb

has_many :posts, dependent: :destroy
has_many :categories, dependent: :destroy
has_many :post_likes, dependent: :destroy
has_many :tweet_likes, dependent: :destroy

categoryテーブル

schema.rb

create_table "categories", force: :cascade do |t|
  t.string "name"
  t.datetime "created_at", precision: 6, null: false
  t.datetime "updated_at", precision: 6, null: false
  t.integer "user_id"
end

アソシエーション

models/category.rb

has_many :posts, dependent: :destroy
belongs_to :user

postテーブル

schema.rb

create_table "posts", force: :cascade do |t|
  t.integer "user_id"
  t.datetime "created_at", precision: 6, null: false
  t.datetime "updated_at", precision: 6, null: false
  t.string "memo"
  t.integer "category_id"
  t.integer "price", default: 0
  t.date "u
end

アソシエーション

models/post.rb

belongs_to :user
belongs_to :category
has_many :likes, dependent: :destroy
has_one_attached :image


Post_likeテーブル

schema.rb

create_table "post_likes", force: :cascade do |t|
  t.integer "user_id"
  t.integer "post_id"
  t.datetime "created_at", precision: 6, null: false
  t.datetime "updated_at", precision: 6, null: false
end

アソシエーション

models/post_like.rb

 belongs_to :user
 belongs_to :post

tweetテーブル

schema.rb

create_table "tweets", force: :cascade do |t|
   t.text "content"
   t.integer "user_id"
   t.datetime "created_at", precision: 6, null: false
   t.datetime "updated_at", precision: 6, null: false
 end

アソシエーション

models/tweet.rb

belongs_to :user

tweet_like

create_table "tweet_likes", force: :cascade do |t|
  t.integer "user_id"
  t.integer "tweet_id"
  t.datetime "created_at", precision: 6, null: false
  t.datetime "updated_at", precision: 6, null: false
end

アソシエーション

models/post_like.rb

belongs_to :user
belongs_to :tweet

kakeibo's People

Contributors

neko-reset avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.