From cf6c9f700e60dc7d2524bef5ea755f8e74b6b1f2 Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Sat, 4 Dec 2021 10:33:02 +0800 Subject: [PATCH 01/39] added tailwindcss in the app --- Gemfile | 3 +- Gemfile.lock | 8 +- app/javascript/packs/application.js | 1 + app/javascript/stylesheets/application.scss | 3 + app/javascript/stylesheets/tailwind.config.js | 16 + app/views/layouts/application.html.erb | 2 + package.json | 3 + postcss.config.js | 1 + yarn.lock | 561 +++++++++++++++++- 9 files changed, 583 insertions(+), 15 deletions(-) create mode 100644 app/javascript/stylesheets/application.scss create mode 100644 app/javascript/stylesheets/tailwind.config.js diff --git a/Gemfile b/Gemfile index ba5697f15..2fef979f7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,10 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.7.2' +ruby '3.0.2' gem 'rails', '~> 6.0.3', '>= 6.0.3.4' +gem 'sqlite3', '~> 1.4' gem 'pg' gem 'puma', '~> 4.1' gem 'sass-rails', '>= 6' diff --git a/Gemfile.lock b/Gemfile.lock index b425d0d31..b577748a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -114,8 +114,6 @@ GEM minitest (5.14.4) msgpack (1.4.2) nio4r (2.5.7) - nokogiri (1.11.3-x86_64-darwin) - racc (~> 1.4) nokogiri (1.11.3-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) @@ -227,6 +225,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + sqlite3 (1.4.2) temple (0.8.2) thor (1.1.0) thread_safe (0.3.6) @@ -280,6 +279,7 @@ DEPENDENCIES shoulda-matchers spring spring-watcher-listen (~> 2.0.0) + sqlite3 (~> 1.4) turbolinks (~> 5) tzinfo-data vcr @@ -288,7 +288,7 @@ DEPENDENCIES webpacker (~> 4.0) RUBY VERSION - ruby 2.7.2p137 + ruby 3.0.2p107 BUNDLED WITH - 2.2.7 + 2.2.22 diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 9cd55d4b9..d2cecd40b 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -8,6 +8,7 @@ require("turbolinks").start() require("@rails/activestorage").start() require("channels") +import 'stylesheets/application' // Uncomment to copy all static images under ../images to the output folder and reference // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) diff --git a/app/javascript/stylesheets/application.scss b/app/javascript/stylesheets/application.scss new file mode 100644 index 000000000..76fcadcc0 --- /dev/null +++ b/app/javascript/stylesheets/application.scss @@ -0,0 +1,3 @@ +@import "tailwindcss/base"; +@import "tailwindcss/components"; +@import "tailwindcss/utilities"; diff --git a/app/javascript/stylesheets/tailwind.config.js b/app/javascript/stylesheets/tailwind.config.js new file mode 100644 index 000000000..15fc99118 --- /dev/null +++ b/app/javascript/stylesheets/tailwind.config.js @@ -0,0 +1,16 @@ +module.exports = { + purge: [ + './app/**/*.html.erb', + './app/helpers/*.erb', + './app/javascript/**/*.js', + './app/javascript/**/*.vue' + ], + darkMode: false, // or 'media' or 'class' + theme: { + extend: {}, + }, + variants: { + extend: {}, + }, + plugins: [], +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 73221bbe8..14d1dc990 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,6 +7,8 @@ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> + <%# inject tailwindcsss %> + <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> diff --git a/package.json b/package.json index b56a1d18e..8691acc75 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "@rails/activestorage": "^6.0.0", "@rails/ujs": "^6.0.0", "@rails/webpacker": "4.3.0", + "autoprefixer": "^9", + "postcss": "^7", + "tailwindcss": "npm:@tailwindcss/postcss7-compat", "turbolinks": "^5.2.0" }, "version": "0.1.0", diff --git a/postcss.config.js b/postcss.config.js index aa5998a80..7e0a5ec04 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,5 +1,6 @@ module.exports = { plugins: [ + require('tailwindcss')('./app/javascript/stylesheets/tailwind.config.js'), require('postcss-import'), require('postcss-flexbugs-fixes'), require('postcss-preset-env')({ diff --git a/yarn.lock b/yarn.lock index 641111eee..9985b023e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -828,6 +828,27 @@ resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7" integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + "@npmcli/move-file@^1.0.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-1.1.1.tgz#31a3afae95308ef12f58ac147b3e33aae621241d" @@ -1098,11 +1119,30 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" +acorn-node@^1.6.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" + integrity sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A== + dependencies: + acorn "^7.0.0" + acorn-walk "^7.0.0" + xtend "^4.0.2" + +acorn-walk@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" + integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== + acorn@^6.4.1: version "6.4.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== +acorn@^7.0.0: + version "7.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -1178,6 +1218,13 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -1194,6 +1241,14 @@ anymatch@~3.1.1: normalize-path "^3.0.0" picomatch "^2.0.4" +anymatch@~3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -1207,6 +1262,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.1.tgz#eb0c9a8f77786cad2af8ff2b862899842d7b6adb" + integrity sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1328,6 +1388,19 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +autoprefixer@^9: + version "9.8.8" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.8.tgz#fd4bd4595385fa6f06599de749a4d5f7a474957a" + integrity sha512-eM9d/swFopRt5gdJ7jrpCwgvEMIayITpojhkkSMRsFHYuH5bkSQ4p/9qTEHtmNudUZh22Tehu7I6CxAW0IXTKA== + dependencies: + browserslist "^4.12.0" + caniuse-lite "^1.0.30001109" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + picocolors "^0.2.1" + postcss "^7.0.32" + postcss-value-parser "^4.1.0" + autoprefixer@^9.6.1: version "9.8.6" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.6.tgz#3b73594ca1bf9266320c5acf1588d74dea74210f" @@ -1513,7 +1586,7 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@~3.0.2: +braces@^3.0.1, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -1636,6 +1709,11 @@ bytes@3.1.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== +bytes@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.1.tgz#3f018291cb4cbad9accb6e6970bca9c8889e879a" + integrity sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg== + cacache@^12.0.2: version "12.0.4" resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.4.tgz#668bcbd105aeb5f1d92fe25570ec9525c8faa40c" @@ -1751,6 +1829,11 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== +camelcase-css@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5" + integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== + camelcase-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" @@ -1814,6 +1897,14 @@ chalk@^2.0, chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chokidar@^2.1.8: version "2.1.8" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" @@ -1848,6 +1939,21 @@ chokidar@^3.4.1: optionalDependencies: fsevents "~2.3.1" +chokidar@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" + integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + chownr@^1.1.1, chownr@^1.1.2: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -1935,12 +2041,19 @@ color-convert@^1.9.0, color-convert@^1.9.1: dependencies: color-name "1.1.3" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -color-name@^1.0.0: +color-name@^1.0.0, color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== @@ -1953,6 +2066,14 @@ color-string@^1.5.4: color-name "^1.0.0" simple-swizzle "^0.2.2" +color-string@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.0.tgz#63b6ebd1bec11999d1df3a79a7569451ac2be8aa" + integrity sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + color@^3.0.0: version "3.1.3" resolved "https://registry.yarnpkg.com/color/-/color-3.1.3.tgz#ca67fb4e7b97d611dcde39eceed422067d91596e" @@ -1961,6 +2082,14 @@ color@^3.0.0: color-convert "^1.9.1" color-string "^1.5.4" +color@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/color/-/color-4.1.0.tgz#9502e6a2dcacb26adf4c60910a27628d010b3de3" + integrity sha512-o2rkkxyLGgYoeUy1OodXpbPAQNmlNBrirQ8ODO8QutzDiDMNdezSOZLNnusQ6pUpCQJUsaJIo9DZJKqa2HgH7A== + dependencies: + color-convert "^2.0.1" + color-string "^1.9.0" + colorette@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" @@ -1978,6 +2107,11 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commander@^8.0.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -2139,6 +2273,17 @@ cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" +cosmiconfig@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" + integrity sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + create-ecdh@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" @@ -2291,6 +2436,11 @@ css-tree@^1.1.2: mdn-data "2.0.14" source-map "^0.6.1" +css-unit-converter@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/css-unit-converter/-/css-unit-converter-1.1.2.tgz#4c77f5a1954e6dbff60695ecb214e3270436ab21" + integrity sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA== + css-what@^3.2.1: version "3.4.2" resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.2.tgz#ea7026fcb01777edbde52124e21f327e7ae950e4" @@ -2485,6 +2635,11 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" +defined@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" + integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= + del@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" @@ -2536,6 +2691,20 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== +detective@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" + integrity sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg== + dependencies: + acorn-node "^1.6.1" + defined "^1.0.0" + minimist "^1.1.1" + +didyoumean@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" + integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -2545,6 +2714,11 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +dlv@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.3.tgz#5c198a8a11453596e751494d49874bc7732f2e79" + integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== + dns-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" @@ -2938,11 +3112,29 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-glob@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== +fastq@^1.6.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" + integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== + dependencies: + reusify "^1.0.4" + faye-websocket@^0.11.3: version "0.11.3" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e" @@ -3116,6 +3308,15 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +fs-extra@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1" + integrity sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-minipass@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" @@ -3151,6 +3352,11 @@ fsevents@~2.3.1: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f" integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw== +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + fstream@^1.0.0, fstream@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" @@ -3238,6 +3444,20 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" +glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob-parent@~5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" @@ -3257,6 +3477,18 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, gl once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.7: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + global-modules@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" @@ -3323,6 +3555,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.2.2 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.8" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" + integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== + handle-thing@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -3479,6 +3716,11 @@ html-entities@^1.3.1: resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.4.0.tgz#cfbd1b01d2afaf9adca1b10ae7dffab98c71d2dc" integrity sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA== +html-tags@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.1.0.tgz#7b5e6f7e665e9fb41f30007ed9e0d41e97fb2140" + integrity sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg== + http-deceiver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" @@ -3585,6 +3827,13 @@ import-cwd@^2.0.0: dependencies: import-from "^2.1.0" +import-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-3.0.0.tgz#20845547718015126ea9b3676b7592fb8bd4cf92" + integrity sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg== + dependencies: + import-from "^3.0.0" + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -3593,7 +3842,7 @@ import-fresh@^2.0.0: caller-path "^2.0.0" resolve-from "^3.0.0" -import-fresh@^3.1.0: +import-fresh@^3.1.0, import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -3608,6 +3857,13 @@ import-from@^2.1.0: dependencies: resolve-from "^3.0.0" +import-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-3.0.0.tgz#055cfec38cd5a27d8057ca51376d7d3bf0891966" + integrity sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ== + dependencies: + resolve-from "^5.0.0" + import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -3769,7 +4025,7 @@ is-callable@^1.1.4, is-callable@^1.2.2: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== -is-color-stop@^1.0.0: +is-color-stop@^1.0.0, is-color-stop@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" integrity sha1-z/9HGu5N1cnhWFmPvhKWe1za00U= @@ -3788,6 +4044,13 @@ is-core-module@^2.1.0: dependencies: has "^1.0.3" +is-core-module@^2.2.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" + integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -3878,6 +4141,13 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" +is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-negative-zero@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" @@ -4095,6 +4365,15 @@ json5@^2.1.2: dependencies: minimist "^1.2.5" +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -4142,6 +4421,11 @@ last-call-webpack-plugin@^3.0.0: lodash "^4.17.5" webpack-sources "^1.1.0" +lilconfig@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.4.tgz#f4507d043d7058b380b6a8f5cb7bcd4b34cee082" + integrity sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA== + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -4231,6 +4515,11 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" +lodash.topath@^4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.topath/-/lodash.topath-4.5.2.tgz#3616351f3bba61994a0931989660bd03254fd009" + integrity sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak= + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -4241,6 +4530,11 @@ lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.1 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + loglevel@^1.6.8: version "1.7.1" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197" @@ -4374,6 +4668,11 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -4398,6 +4697,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + dependencies: + braces "^3.0.1" + picomatch "^2.2.3" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -4455,7 +4762,7 @@ minimatch@^3.0.4, minimatch@~3.0.2: dependencies: brace-expansion "^1.1.7" -minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: +minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== @@ -4532,6 +4839,11 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +modern-normalize@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/modern-normalize/-/modern-normalize-1.1.0.tgz#da8e80140d9221426bd4f725c6e11283d34f90b7" + integrity sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -4582,6 +4894,11 @@ nan@^2.12.1, nan@^2.13.2: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== +nanoid@^3.1.30: + version "3.1.30" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" + integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -4614,6 +4931,13 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== +node-emoji@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" + integrity sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A== + dependencies: + lodash "^4.17.21" + node-forge@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" @@ -4796,6 +5120,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-hash@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5" + integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw== + object-inspect@^1.8.0, object-inspect@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a" @@ -5142,11 +5471,26 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= +picocolors@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f" + integrity sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + picomatch@^2.0.4, picomatch@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picomatch@^2.2.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -5385,6 +5729,16 @@ postcss-font-variant@^4.0.0: dependencies: postcss "^7.0.2" +postcss-functions@^3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-functions/-/postcss-functions-3.0.0.tgz#0e94d01444700a481de20de4d55fb2640564250e" + integrity sha1-DpTQFERwCkgd4g3k1V+yZAVkJQ4= + dependencies: + glob "^7.1.2" + object-assign "^4.1.1" + postcss "^6.0.9" + postcss-value-parser "^3.3.0" + postcss-gap-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/postcss-gap-properties/-/postcss-gap-properties-2.0.0.tgz#431c192ab3ed96a3c3d09f2ff615960f902c1715" @@ -5418,6 +5772,14 @@ postcss-initial@^3.0.0: lodash.template "^4.5.0" postcss "^7.0.2" +postcss-js@^2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-2.0.3.tgz#a96f0f23ff3d08cec7dc5b11bf11c5f8077cdab9" + integrity sha512-zS59pAk3deu6dVHyrGqmC3oDXBdNdajk4k1RyxeVXCrcEDBUBHoIhE4QTsmhxgzXxsaqFDAkUZfmMa5f/N/79w== + dependencies: + camelcase-css "^2.0.1" + postcss "^7.0.18" + postcss-lab-function@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/postcss-lab-function/-/postcss-lab-function-2.0.1.tgz#bb51a6856cd12289ab4ae20db1e3821ef13d7d2e" @@ -5435,6 +5797,15 @@ postcss-load-config@^2.0.0: cosmiconfig "^5.0.0" import-cwd "^2.0.0" +postcss-load-config@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-3.1.0.tgz#d39c47091c4aec37f50272373a6a648ef5e97829" + integrity sha512-ipM8Ds01ZUophjDTQYSVP70slFSYg3T0/zyfII5vzhN6V57YSxMgG5syXuwi5VtS8wSf3iL30v0uBdoIVx4Q0g== + dependencies: + import-cwd "^3.0.0" + lilconfig "^2.0.3" + yaml "^1.10.2" + postcss-loader@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-3.0.0.tgz#6b97943e47c72d845fa9e03f273773d4e8dd6c2d" @@ -5554,6 +5925,14 @@ postcss-modules-values@^3.0.0: icss-utils "^4.0.0" postcss "^7.0.6" +postcss-nested@^4: + version "4.2.3" + resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-4.2.3.tgz#c6f255b0a720549776d220d00c4b70cd244136f6" + integrity sha512-rOv0W1HquRCamWy2kFl3QazJMMe1ku6rCFoAAH+9AcxdbpDeBr6k968MLWuLjvjMcGEip01ak09hKOEgpK9hvw== + dependencies: + postcss "^7.0.32" + postcss-selector-parser "^6.0.2" + postcss-nesting@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/postcss-nesting/-/postcss-nesting-7.0.1.tgz#b50ad7b7f0173e5b5e3880c3501344703e04c052" @@ -5802,6 +6181,14 @@ postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2: uniq "^1.0.1" util-deprecate "^1.0.2" +postcss-selector-parser@^6.0.6: + version "6.0.6" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz#2c5bba8174ac2f6981ab631a42ab0ee54af332ea" + integrity sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg== + dependencies: + cssesc "^3.0.0" + util-deprecate "^1.0.2" + postcss-svgo@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-4.0.2.tgz#17b997bc711b333bab143aaed3b8d3d6e3d38258" @@ -5821,7 +6208,7 @@ postcss-unique-selectors@^4.0.1: postcss "^7.0.0" uniqs "^2.0.0" -postcss-value-parser@^3.0.0, postcss-value-parser@^3.2.3: +postcss-value-parser@^3.0.0, postcss-value-parser@^3.2.3, postcss-value-parser@^3.3.0: version "3.3.1" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== @@ -5840,6 +6227,23 @@ postcss-values-parser@^2.0.0, postcss-values-parser@^2.0.1: indexes-of "^1.0.1" uniq "^1.0.1" +postcss@^6.0.9: + version "6.0.23" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324" + integrity sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag== + dependencies: + chalk "^2.4.1" + source-map "^0.6.1" + supports-color "^5.4.0" + +postcss@^7, postcss@^7.0.18: + version "7.0.39" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.39.tgz#9624375d965630e2e1f2c02a935c82a59cb48309" + integrity sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA== + dependencies: + picocolors "^0.2.1" + source-map "^0.6.1" + postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.2, postcss@^7.0.26, postcss@^7.0.27, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6: version "7.0.35" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.35.tgz#d2be00b998f7f211d8a276974079f2e92b970e24" @@ -5849,11 +6253,25 @@ postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.2 source-map "^0.6.1" supports-color "^6.1.0" +postcss@^8.3.5: + version "8.4.4" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.4.tgz#d53d4ec6a75fd62557a66bb41978bf47ff0c2869" + integrity sha512-joU6fBsN6EIer28Lj6GDFoC/5yOZzLCfn0zHAn/MYXI7aPt4m4hK5KC5ovEZXy+lnCjmYIbQWngvju2ddyEr8Q== + dependencies: + nanoid "^3.1.30" + picocolors "^1.0.0" + source-map-js "^1.0.1" + prepend-http@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= +pretty-hrtime@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" + integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -5944,6 +6362,16 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +purgecss@^4.0.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/purgecss/-/purgecss-4.1.3.tgz#683f6a133c8c4de7aa82fe2746d1393b214918f7" + integrity sha512-99cKy4s+VZoXnPxaoM23e5ABcP851nC2y2GROkkjS8eJaJtlciGavd7iYAw2V84WeBqggZ12l8ef44G99HmTaw== + dependencies: + commander "^8.0.0" + glob "^7.1.7" + postcss "^8.3.5" + postcss-selector-parser "^6.0.6" + q@^1.1.2: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -5982,6 +6410,16 @@ querystringify@^2.1.1: resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +quick-lru@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" + integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== + randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -6074,6 +6512,13 @@ readdirp@~3.5.0: dependencies: picomatch "^2.2.1" +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -6082,6 +6527,14 @@ redent@^1.0.0: indent-string "^2.1.0" strip-indent "^1.0.1" +reduce-css-calc@^2.1.8: + version "2.1.8" + resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-2.1.8.tgz#7ef8761a28d614980dc0c982f772c93f7a99de03" + integrity sha512-8liAVezDmUcH+tdzoEGrhfbGcP7nOV4NkGE3a74+qqvE7nt9i4sKLGBuZNOnpI4WiGksiNPklZxva80061QiPg== + dependencies: + css-unit-converter "^1.1.1" + postcss-value-parser "^3.3.0" + regenerate-unicode-properties@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" @@ -6234,6 +6687,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -6247,6 +6705,14 @@ resolve@^1.1.7, resolve@^1.10.0, resolve@^1.12.0: is-core-module "^2.1.0" path-parse "^1.0.6" +resolve@^1.20.0: + version "1.20.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" + integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== + dependencies: + is-core-module "^2.2.0" + path-parse "^1.0.6" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -6257,6 +6723,11 @@ retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + rgb-regex@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1" @@ -6274,7 +6745,7 @@ rimraf@2, rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1: dependencies: glob "^7.1.3" -rimraf@^3.0.2: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -6289,6 +6760,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -6583,6 +7061,11 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== +source-map-js@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf" + integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA== + source-map-resolve@^0.5.0: version "0.5.3" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" @@ -6907,7 +7390,7 @@ supports-color@^2.0.0: resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.3.0: +supports-color@^5.3.0, supports-color@^5.4.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== @@ -6921,7 +7404,7 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0: +supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -6947,6 +7430,47 @@ svgo@^1.0.0: unquote "~1.1.1" util.promisify "~1.0.0" +"tailwindcss@npm:@tailwindcss/postcss7-compat": + version "2.2.17" + resolved "https://registry.yarnpkg.com/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.17.tgz#dc78f3880a2af84163150ff426a39e42b9ae8922" + integrity sha512-3h2svqQAqYHxRZ1KjsJjZOVTQ04m29LjfrLjXyZZEJuvUuJN+BCIF9GI8vhE1s0plS0mogd6E6YLg6mu4Wv/Vw== + dependencies: + arg "^5.0.1" + autoprefixer "^9" + bytes "^3.0.0" + chalk "^4.1.2" + chokidar "^3.5.2" + color "^4.0.1" + cosmiconfig "^7.0.1" + detective "^5.2.0" + didyoumean "^1.2.2" + dlv "^1.1.3" + fast-glob "^3.2.7" + fs-extra "^10.0.0" + glob-parent "^6.0.1" + html-tags "^3.1.0" + is-color-stop "^1.1.0" + is-glob "^4.0.1" + lodash "^4.17.21" + lodash.topath "^4.5.2" + modern-normalize "^1.1.0" + node-emoji "^1.11.0" + normalize-path "^3.0.0" + object-hash "^2.2.0" + postcss "^7" + postcss-functions "^3" + postcss-js "^2" + postcss-load-config "^3.1.0" + postcss-nested "^4" + postcss-selector-parser "^6.0.6" + postcss-value-parser "^4.1.0" + pretty-hrtime "^1.0.3" + purgecss "^4.0.3" + quick-lru "^5.1.1" + reduce-css-calc "^2.1.8" + resolve "^1.20.0" + tmp "^0.2.1" + tapable@^1.0.0, tapable@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" @@ -7037,6 +7561,13 @@ timsort@^0.3.0: resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= +tmp@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== + dependencies: + rimraf "^3.0.0" + to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" @@ -7206,6 +7737,11 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -7549,7 +8085,7 @@ ws@^6.2.1: dependencies: async-limiter "~1.0.0" -xtend@^4.0.0, xtend@~4.0.1: +xtend@^4.0.0, xtend@^4.0.2, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== @@ -7574,6 +8110,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml@^1.10.0, yaml@^1.10.2: + version "1.10.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" + integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== + yaml@^1.7.2: version "1.10.0" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" From fb81657b5f2355a722805038c080a5d00ea6bf25 Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Tue, 7 Dec 2021 19:47:10 +0800 Subject: [PATCH 02/39] added migrations for users table --- app/models/user.rb | 2 ++ db/migrate/20211207113835_create_users.rb | 14 ++++++++++++++ db/schema.rb | 16 +++++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 app/models/user.rb create mode 100644 db/migrate/20211207113835_create_users.rb diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 000000000..379658a50 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ApplicationRecord +end diff --git a/db/migrate/20211207113835_create_users.rb b/db/migrate/20211207113835_create_users.rb new file mode 100644 index 000000000..9209365c6 --- /dev/null +++ b/db/migrate/20211207113835_create_users.rb @@ -0,0 +1,14 @@ +class CreateUsers < ActiveRecord::Migration[6.0] + def change + create_table :users do |t| + # creates role_id column which is a foreign_key id of a role + t.references :role, foreign_key: true + t.string :firstname + t.string :lastname + t.string :username + t.text :password + t.string :email + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b10373ba6..15173aef0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,19 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 0) do +ActiveRecord::Schema.define(version: 2021_12_07_113835) do - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" + create_table "users", force: :cascade do |t| + t.integer "role_id" + t.string "firstname" + t.string "lastname" + t.string "username" + t.text "password" + t.string "email" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["role_id"], name: "index_users_on_role_id" + end + add_foreign_key "users", "roles" end From fde0ff606e77052f5cbb1f812506eb8df019457c Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Tue, 7 Dec 2021 19:54:17 +0800 Subject: [PATCH 03/39] created migration for creating roles table --- app/models/role.rb | 2 ++ db/migrate/20211207115255_create_roles.rb | 8 ++++++++ db/schema.rb | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/models/role.rb create mode 100644 db/migrate/20211207115255_create_roles.rb diff --git a/app/models/role.rb b/app/models/role.rb new file mode 100644 index 000000000..5c14f940d --- /dev/null +++ b/app/models/role.rb @@ -0,0 +1,2 @@ +class Role < ApplicationRecord +end diff --git a/db/migrate/20211207115255_create_roles.rb b/db/migrate/20211207115255_create_roles.rb new file mode 100644 index 000000000..c9feb08b2 --- /dev/null +++ b/db/migrate/20211207115255_create_roles.rb @@ -0,0 +1,8 @@ +class CreateRoles < ActiveRecord::Migration[6.0] + def change + create_table :roles do |t| + t.string :type + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 15173aef0..0232eb103 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,13 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_12_07_113835) do +ActiveRecord::Schema.define(version: 2021_12_07_115255) do + + create_table "roles", force: :cascade do |t| + t.string "type" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end create_table "users", force: :cascade do |t| t.integer "role_id" From fae80aacaf8771dc9639657fb8de2569ce70b229 Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Tue, 7 Dec 2021 20:20:24 +0800 Subject: [PATCH 04/39] create migration for cryptocurrency table --- app/models/crypto_currency.rb | 2 ++ db/migrate/20211207121628_create_crypto_currencies.rb | 11 +++++++++++ db/schema.rb | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/models/crypto_currency.rb create mode 100644 db/migrate/20211207121628_create_crypto_currencies.rb diff --git a/app/models/crypto_currency.rb b/app/models/crypto_currency.rb new file mode 100644 index 000000000..3022a2ee4 --- /dev/null +++ b/app/models/crypto_currency.rb @@ -0,0 +1,2 @@ +class CryptoCurrency < ApplicationRecord +end diff --git a/db/migrate/20211207121628_create_crypto_currencies.rb b/db/migrate/20211207121628_create_crypto_currencies.rb new file mode 100644 index 000000000..062db8193 --- /dev/null +++ b/db/migrate/20211207121628_create_crypto_currencies.rb @@ -0,0 +1,11 @@ +class CreateCryptoCurrencies < ActiveRecord::Migration[6.0] + def change + create_table :crypto_currencies do |t| + t.string :code, :limit => 3 + t.string :name + t.decimal :rate + t.boolean :is_active, default: false + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 0232eb103..91829216a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,16 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_12_07_115255) do +ActiveRecord::Schema.define(version: 2021_12_07_121628) do + + create_table "crypto_currencies", force: :cascade do |t| + t.string "code", limit: 3 + t.string "name" + t.decimal "rate" + t.boolean "is_active", default: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end create_table "roles", force: :cascade do |t| t.string "type" From d11794f3a0f6eebb40104b7d58224bb82afa90b4 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 20:52:43 +0800 Subject: [PATCH 05/39] Align ruby tool version to latest --- .tool-versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tool-versions b/.tool-versions index 3e17a2955..ac20a13cb 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -ruby 2.7.2 +ruby 3.0.2 yarn 1.22.4 nodejs 12.18.3 From 1c304ce51f9bfa18a21b9294b9ac17e65fbeff46 Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Tue, 14 Dec 2021 21:01:24 +0800 Subject: [PATCH 06/39] created user registration form --- app/assets/stylesheets/users.scss | 3 +++ app/controllers/users_controller.rb | 9 ++++++++ app/helpers/users_helper.rb | 2 ++ app/javascript/stylesheets/application.scss | 5 +++++ app/javascript/stylesheets/tailwind.config.js | 7 +------ app/views/users/_form.html.haml | 21 +++++++++++++++++++ app/views/users/index.html.haml | 2 ++ app/views/users/new.html.haml | 6 ++++++ config/routes.rb | 2 +- db/migrate/20211207113835_create_users.rb | 2 +- db/migrate/20211207115255_create_roles.rb | 2 +- db/schema.rb | 5 ++++- 12 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 app/assets/stylesheets/users.scss create mode 100644 app/controllers/users_controller.rb create mode 100644 app/helpers/users_helper.rb create mode 100644 app/views/users/_form.html.haml create mode 100644 app/views/users/index.html.haml create mode 100644 app/views/users/new.html.haml diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss new file mode 100644 index 000000000..efc25261d --- /dev/null +++ b/app/assets/stylesheets/users.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Users controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 000000000..86633c1e4 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,9 @@ +class UsersController < ApplicationController + def index + @roles = Role.all + end + + def new + @user = User.new + end +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..2310a240d --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/javascript/stylesheets/application.scss b/app/javascript/stylesheets/application.scss index 76fcadcc0..e2c97204f 100644 --- a/app/javascript/stylesheets/application.scss +++ b/app/javascript/stylesheets/application.scss @@ -1,3 +1,8 @@ @import "tailwindcss/base"; @import "tailwindcss/components"; + select { + padding: 14px; + background-color: transparent; + width: 100%; + } @import "tailwindcss/utilities"; diff --git a/app/javascript/stylesheets/tailwind.config.js b/app/javascript/stylesheets/tailwind.config.js index 15fc99118..62dfdaf3f 100644 --- a/app/javascript/stylesheets/tailwind.config.js +++ b/app/javascript/stylesheets/tailwind.config.js @@ -1,10 +1,5 @@ module.exports = { - purge: [ - './app/**/*.html.erb', - './app/helpers/*.erb', - './app/javascript/**/*.js', - './app/javascript/**/*.vue' - ], + purge: [], darkMode: false, // or 'media' or 'class' theme: { extend: {}, diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml new file mode 100644 index 000000000..6ebc0d972 --- /dev/null +++ b/app/views/users/_form.html.haml @@ -0,0 +1,21 @@ += form_with model: @user do |f| + %div{ class: 'w-full' } + = f.label :firstname, class: 'text-sm' + = f.text_field :firstname, class: "p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300" + %div{ class: 'w-full' } + = f.label :lastname, class: 'text-sm' + = f.text_field :lastname, class: "p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300" + %div{ class: 'w-full' } + = f.label :email, class: 'text-sm' + = f.text_field :email, class: "p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300" + %div{ class: 'w-full' } + = f.label :password, class: 'text-sm' + = f.text_field :password, class: "p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300" + %div{ class: 'w-full' } + = f.label :confirm_password, class: 'text-sm' + = f.text_field :confirm_password, class: "p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300" + %div{ class: 'w-full flex flex-col' } + = f.label 'Country / Area of Residence', class: 'text-sm' + %div{ class: 'border rounded mt-1' } + = f.select :country, ["Berlin", "Chicago", "Madrid"] + = f.submit 'Create Account', class: 'w-full bg-yellow-300 mt-8 p-4 rounded-lg text-sm' diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml new file mode 100644 index 000000000..4e3e36bd4 --- /dev/null +++ b/app/views/users/index.html.haml @@ -0,0 +1,2 @@ +%h1 Users#index +%p Find me in app/views/users/index.html.haml diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml new file mode 100644 index 000000000..2b234970c --- /dev/null +++ b/app/views/users/new.html.haml @@ -0,0 +1,6 @@ +%div{ class: 'w-full h-screen flex flex-col items-center justify-center' } + %div{ class: 'w-96' } + %div{ class: 'w-full text-center' } + %h1{ class: 'text-gray-800 text-2xl font-bold pb-3' } Create Binance Account + %p{ class: 'text-gray-600 text-base pb-4' } Register with your email + = render 'form' \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c06383a17..c89aa1283 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,3 @@ Rails.application.routes.draw do - # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html + resources :users end diff --git a/db/migrate/20211207113835_create_users.rb b/db/migrate/20211207113835_create_users.rb index 9209365c6..0b5855d24 100644 --- a/db/migrate/20211207113835_create_users.rb +++ b/db/migrate/20211207113835_create_users.rb @@ -1,8 +1,8 @@ class CreateUsers < ActiveRecord::Migration[6.0] def change create_table :users do |t| - # creates role_id column which is a foreign_key id of a role t.references :role, foreign_key: true + t.references :country, foreign_key: true t.string :firstname t.string :lastname t.string :username diff --git a/db/migrate/20211207115255_create_roles.rb b/db/migrate/20211207115255_create_roles.rb index c9feb08b2..64ea8f2f7 100644 --- a/db/migrate/20211207115255_create_roles.rb +++ b/db/migrate/20211207115255_create_roles.rb @@ -1,7 +1,7 @@ class CreateRoles < ActiveRecord::Migration[6.0] def change create_table :roles do |t| - t.string :type + t.string :name t.timestamps end end diff --git a/db/schema.rb b/db/schema.rb index 91829216a..4ee7ac8ed 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -22,13 +22,14 @@ end create_table "roles", force: :cascade do |t| - t.string "type" + t.string "name" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end create_table "users", force: :cascade do |t| t.integer "role_id" + t.integer "country_id" t.string "firstname" t.string "lastname" t.string "username" @@ -36,8 +37,10 @@ t.string "email" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.index ["country_id"], name: "index_users_on_country_id" t.index ["role_id"], name: "index_users_on_role_id" end + add_foreign_key "users", "countries" add_foreign_key "users", "roles" end From 6a2c3a08ecd9b7fef175c3e5f7ed770440fa4339 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:15:52 +0800 Subject: [PATCH 07/39] Destroyed CryptoCurrency model for redefinition --- app/models/crypto_currency.rb | 2 -- db/migrate/20211207121628_create_crypto_currencies.rb | 11 ----------- 2 files changed, 13 deletions(-) delete mode 100644 app/models/crypto_currency.rb delete mode 100644 db/migrate/20211207121628_create_crypto_currencies.rb diff --git a/app/models/crypto_currency.rb b/app/models/crypto_currency.rb deleted file mode 100644 index 3022a2ee4..000000000 --- a/app/models/crypto_currency.rb +++ /dev/null @@ -1,2 +0,0 @@ -class CryptoCurrency < ApplicationRecord -end diff --git a/db/migrate/20211207121628_create_crypto_currencies.rb b/db/migrate/20211207121628_create_crypto_currencies.rb deleted file mode 100644 index 062db8193..000000000 --- a/db/migrate/20211207121628_create_crypto_currencies.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateCryptoCurrencies < ActiveRecord::Migration[6.0] - def change - create_table :crypto_currencies do |t| - t.string :code, :limit => 3 - t.string :name - t.decimal :rate - t.boolean :is_active, default: false - t.timestamps - end - end -end From 3a0bc0d8b98860662a29097bddd2862caaf8deca Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:16:58 +0800 Subject: [PATCH 08/39] Generate model Cryptocurrency --- app/models/cryptocurrency.rb | 2 ++ db/migrate/20211214131652_create_cryptocurrencies.rb | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 app/models/cryptocurrency.rb create mode 100644 db/migrate/20211214131652_create_cryptocurrencies.rb diff --git a/app/models/cryptocurrency.rb b/app/models/cryptocurrency.rb new file mode 100644 index 000000000..7c1e64fbb --- /dev/null +++ b/app/models/cryptocurrency.rb @@ -0,0 +1,2 @@ +class Cryptocurrency < ApplicationRecord +end diff --git a/db/migrate/20211214131652_create_cryptocurrencies.rb b/db/migrate/20211214131652_create_cryptocurrencies.rb new file mode 100644 index 000000000..8066c6ae6 --- /dev/null +++ b/db/migrate/20211214131652_create_cryptocurrencies.rb @@ -0,0 +1,8 @@ +class CreateCryptocurrencies < ActiveRecord::Migration[6.0] + def change + create_table :cryptocurrencies do |t| + + t.timestamps + end + end +end From a6040b0cc3a1319e90f345f7c1aa27bc46004143 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:17:59 +0800 Subject: [PATCH 09/39] Populate cryptocurrency table columns --- db/migrate/20211214131652_create_cryptocurrencies.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/migrate/20211214131652_create_cryptocurrencies.rb b/db/migrate/20211214131652_create_cryptocurrencies.rb index 8066c6ae6..7f277b856 100644 --- a/db/migrate/20211214131652_create_cryptocurrencies.rb +++ b/db/migrate/20211214131652_create_cryptocurrencies.rb @@ -1,6 +1,12 @@ class CreateCryptocurrencies < ActiveRecord::Migration[6.0] def change create_table :cryptocurrencies do |t| + t.string :name + t.string :description + t.bigint :max_supply + t.string :currency_symbol + t.string :slug + t.boolean :is_active t.timestamps end From cda36d74e9cb6a03c556fd5f5287d40bb2d0800f Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:18:51 +0800 Subject: [PATCH 10/39] Rails DB Migration --- db/schema.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 91829216a..c1229d0b8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,13 +10,15 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_12_07_121628) do +ActiveRecord::Schema.define(version: 2021_12_14_131652) do - create_table "crypto_currencies", force: :cascade do |t| - t.string "code", limit: 3 + create_table "cryptocurrencies", force: :cascade do |t| t.string "name" - t.decimal "rate" - t.boolean "is_active", default: false + t.string "description" + t.bigint "max_supply" + t.string "currency_symbol" + t.string "slug" + t.boolean "is_active" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end From aad33a0ea4c75549fdc04f18614e352bd833640b Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:21:30 +0800 Subject: [PATCH 11/39] Redefine cryptocurrency table Removed description column Changed currency_symbol to symbol --- db/migrate/20211214131652_create_cryptocurrencies.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/migrate/20211214131652_create_cryptocurrencies.rb b/db/migrate/20211214131652_create_cryptocurrencies.rb index 7f277b856..0c8c453bf 100644 --- a/db/migrate/20211214131652_create_cryptocurrencies.rb +++ b/db/migrate/20211214131652_create_cryptocurrencies.rb @@ -2,9 +2,8 @@ class CreateCryptocurrencies < ActiveRecord::Migration[6.0] def change create_table :cryptocurrencies do |t| t.string :name - t.string :description t.bigint :max_supply - t.string :currency_symbol + t.string :symbol t.string :slug t.boolean :is_active From fd2cc75d7094190d65a1f8995ae95a4c1b07ff5f Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:22:58 +0800 Subject: [PATCH 12/39] DB migrate cryptocurrency table --- db/schema.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index c1229d0b8..6a5b626d5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -14,9 +14,8 @@ create_table "cryptocurrencies", force: :cascade do |t| t.string "name" - t.string "description" t.bigint "max_supply" - t.string "currency_symbol" + t.string "symbol" t.string "slug" t.boolean "is_active" t.datetime "created_at", precision: 6, null: false From 06bae0ef3f5e604b1833a9759348e45adc802c19 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:40:45 +0800 Subject: [PATCH 13/39] Created db seed for sample cryptocurrencies --- db/seeds.rb | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2acc..fcf3c04ad 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,23 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). +# Author: github.com/rns.jey # -# Examples: +# This seed file contains a list of data for 10 unique cryptocurrencies # -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) +# Column fields: +# @name [String] the name of the currency +# @max_supply [BigInt] the max_supply for the currency +# @symbol [String] the symbol for the crypto currency +# @slug [String] a slug for each currency formatted to work with the CoinMarketCap API (api.coinmarketcap.com) +# @is_active [Boolean] active status of an existing cryptocurrency + +cryptocurrencies = Cryptocurrency.create([ + { name: 'Bitcoin', max_supply: 21000000, symbol: 'BTC', slug: 'bitcoin', is_active: true } + { name: 'Ethereum', symbol: 'ETH', slug: 'ethereum', is_active: true } + { name: 'Binance Coin', max_supply: 166801148, symbol: 'BNB', slug: 'binance-coin', is_active: true } + { name: 'Tether', symbol: 'USDT', slug: 'tether', is_active: true } + { name: 'Solana', symbol: 'SOL', slug: 'solana', is_active: true } + { name: "USD Coin", symbol: "USDC", slug: "usd-coin", is_active: true } + { name: "Cardano", max_supply: 45000000000, symbol: "ADA", slug: "cardano", is_active: true } + { name: "XRP", max_supply: 100000000000, symbol: "XRP", slug: "xrp", is_active: true } + { name: "Dogecoin", symbol: "DOGE", slug: "dogecoin", is_active: true } + { name: "Polkadot", symbol: "DOT", slug: "polkadot-new", is_active: true } +]) \ No newline at end of file From 57602ccbd2a01a97c384033fb90dedc8020529ed Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:43:12 +0800 Subject: [PATCH 14/39] Put comma at the end of every lines --- db/seeds.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index fcf3c04ad..a41fa5753 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -10,14 +10,14 @@ # @is_active [Boolean] active status of an existing cryptocurrency cryptocurrencies = Cryptocurrency.create([ - { name: 'Bitcoin', max_supply: 21000000, symbol: 'BTC', slug: 'bitcoin', is_active: true } - { name: 'Ethereum', symbol: 'ETH', slug: 'ethereum', is_active: true } - { name: 'Binance Coin', max_supply: 166801148, symbol: 'BNB', slug: 'binance-coin', is_active: true } - { name: 'Tether', symbol: 'USDT', slug: 'tether', is_active: true } - { name: 'Solana', symbol: 'SOL', slug: 'solana', is_active: true } - { name: "USD Coin", symbol: "USDC", slug: "usd-coin", is_active: true } - { name: "Cardano", max_supply: 45000000000, symbol: "ADA", slug: "cardano", is_active: true } - { name: "XRP", max_supply: 100000000000, symbol: "XRP", slug: "xrp", is_active: true } - { name: "Dogecoin", symbol: "DOGE", slug: "dogecoin", is_active: true } - { name: "Polkadot", symbol: "DOT", slug: "polkadot-new", is_active: true } + { name: 'Bitcoin', max_supply: 21000000, symbol: 'BTC', slug: 'bitcoin', is_active: true }, + { name: 'Ethereum', symbol: 'ETH', slug: 'ethereum', is_active: true }, + { name: 'Binance Coin', max_supply: 166801148, symbol: 'BNB', slug: 'binance-coin', is_active: true }, + { name: 'Tether', symbol: 'USDT', slug: 'tether', is_active: true }, + { name: 'Solana', symbol: 'SOL', slug: 'solana', is_active: true }, + { name: 'USD Coin', symbol: 'USDC', slug: 'usd-coin', is_active: true }, + { name: 'Cardano', max_supply: 45000000000, symbol: 'ADA', slug: 'cardano', is_active: true }, + { name: 'XRP', max_supply: 100000000000, symbol: 'XRP', slug: 'xrp', is_active: true }, + { name: 'Dogecoin', symbol: 'DOGE', slug: 'dogecoin', is_active: true }, + { name: 'Polkadot', symbol: 'DOT', slug: 'polkadot-new', is_active: true } ]) \ No newline at end of file From 9750eacd942d133964cf2c1ba1f36c938caf24ab Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:49:38 +0800 Subject: [PATCH 15/39] Added httparty ruby gem --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 2fef979f7..e42d305d5 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,7 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'devise' gem 'hamlit-rails' +gem 'httparty' group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] From 1ff15ba4f00967a35daf82d5192eb6e9539c4f3c Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:50:10 +0800 Subject: [PATCH 16/39] Installed httparty ruby gem --- Gemfile.lock | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index b577748a1..94f67deb6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,6 +96,9 @@ GEM hamlit (>= 1.2.0) railties (>= 4.0.1) hashdiff (1.0.1) + httparty (0.20.0) + mime-types (~> 3.0) + multi_xml (>= 0.5.2) i18n (1.8.10) concurrent-ruby (~> 1.0) jbuilder (2.11.2) @@ -110,9 +113,13 @@ GEM mini_mime (>= 0.1.1) marcel (1.0.1) method_source (1.0.0) + mime-types (3.4.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2021.1115) mini_mime (1.1.0) minitest (5.14.4) msgpack (1.4.2) + multi_xml (0.6.0) nio4r (2.5.7) nokogiri (1.11.3-x86_64-linux) racc (~> 1.4) @@ -267,6 +274,7 @@ DEPENDENCIES devise factory_bot_rails hamlit-rails + httparty jbuilder (~> 2.7) listen (~> 3.2) pg From e2f019c37ad448f8ab150bc1f619ef1416748fc6 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 14 Dec 2021 21:52:51 +0800 Subject: [PATCH 17/39] Defined current_price method this will request a cryptocurrency from API and returns it's current price --- app/models/cryptocurrency.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/models/cryptocurrency.rb b/app/models/cryptocurrency.rb index 7c1e64fbb..1c80ba7b3 100644 --- a/app/models/cryptocurrency.rb +++ b/app/models/cryptocurrency.rb @@ -1,2 +1,18 @@ class Cryptocurrency < ApplicationRecord + def current_price + api_key = "ce205881-4940-48a0-814e-3e4bb539eaeb" + url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest" + symbol = self.symbol + query = { + "symbol" => symbol + } + headers = { + "X-CMC_PRO_API_KEY" => api_key, + "Accepts" => "application/json" + } + request = HTTParty.get(url, :headers => headers, :query => query) + puts request + + response = JSON.parse(request.body)["data"][symbol]["quote"]["USD"]["price"] + end end From 47d447554affd534da7fdf82460a69baa37bbac3 Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Tue, 14 Dec 2021 22:34:12 +0800 Subject: [PATCH 18/39] created users index page with table component --- app/views/users/index.html.haml | 125 +++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 2 deletions(-) diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 4e3e36bd4..b17a13e5e 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,2 +1,123 @@ -%h1 Users#index -%p Find me in app/views/users/index.html.haml +%div{ class: 'w-full h-screen text-gray-800' } + %div{ class: 'bg-black' } + %svg{ xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 80120 1024', style: 'fill: #F0B90B', class: 'p-5' } + %path{ d: 'M230.997333 512L116.053333 626.986667 0 512l116.010667-116.010667L230.997333 512zM512 230.997333l197.973333 197.973334 116.053334-115.968L512 0 197.973333 314.026667l116.053334 115.968L512 230.997333z m395.989333 164.992L793.002667 512l116.010666 116.010667L1024.981333 512l-116.992-116.010667zM512 793.002667l-197.973333-198.997334-116.053334 116.010667L512 1024l314.026667-314.026667-116.053334-115.968L512 793.002667z m0-165.973334l116.010667-116.053333L512 396.032 395.989333 512 512 626.986667z m1220.010667 11.946667v-1.962667c0-75.008-40.021333-113.024-105.002667-138.026666 39.978667-21.973333 73.984-58.026667 73.984-121.002667v-1.962667c0-88.021333-70.997333-145.024-185.002667-145.024h-260.992v561.024h267.008c126.976 0.981333 210.005333-51.029333 210.005334-153.002666z m-154.026667-239.957333c0 41.984-34.005333 58.965333-89.002667 58.965333h-113.962666V338.986667h121.984c52.010667 0 80.981333 20.992 80.981333 58.026666v2.005334z m31.018667 224c0 41.984-32.981333 61.013333-87.04 61.013333h-146.944v-123.050667h142.976c63.018667 0 91.008 23.04 91.008 61.013334v1.024z m381.994666 169.984V230.997333h-123.989333v561.024h123.989333v0.981334z m664.021334 0V230.997333h-122.026667v346.026667l-262.997333-346.026667h-114.005334v561.024h122.026667v-356.010666l272 356.992h104.96z m683.946666 0L3098.026667 228.010667h-113.962667l-241.024 564.992h127.018667l50.986666-125.994667h237.013334l50.986666 125.994667h130.005334z m-224.981333-235.008h-148.992l75.008-181.973334 73.984 181.973334z m814.037333 235.008V230.997333h-122.026666v346.026667l-262.997334-346.026667h-114.005333v561.024h122.026667v-356.010666l272 356.992h104.96z m636.970667-91.008l-78.976-78.976c-44.032 39.978667-83.029333 65.962667-148.010667 65.962666-96 0-162.986667-80-162.986666-176v-2.986666c0-96 67.968-174.976 162.986666-174.976 55.978667 0 100.010667 23.978667 144 62.976l78.976-91.008c-51.968-50.986667-114.986667-86.997333-220.970666-86.997334-171.989333 0-292.992 130.986667-292.992 290.005334V512c0 160.981333 122.965333 288.981333 288 288.981333 107.989333 1.024 171.989333-36.992 229.973333-98.986666z m527.018667 91.008v-109.994667h-305.024v-118.016h265.002666v-109.994667h-265.002666V340.992h301.013333V230.997333h-422.997333v561.024h427.008v0.981334z' } + %div{ class: 'shadow p-7' } + %h1{ class: 'text-3xl' } Fiat and Spot + %div{ class: 'w-full p-6 flex w-full flex-col bg-gray-100' } + %div{ class: 'w-full shadow flex gap-2 bg-gray-50' } + %div{ class: 'p-5' } + %label Fiat and Spot balance + %h1{ class: 'text-3xl mt-1' } 0.00000000 + %label{ class: 'text-gray-500' } ≈ ₱0.000000 + %div{ class: 'p-5' } + %label Spot balance + %h1{ class: 'text-3xl mt-1' } 0.00000000 + %label{ class: 'text-gray-500' } ≈ ₱0.000000 + %div{ class: 'p-5' } + %label Fiat balance + %h1{ class: 'text-3xl mt-1' } 0.00000000 + %label{ class: 'text-gray-500' } ≈ ₱0.000000 + %div{ class: 'w-full shadow inline-grid p-6 mt-6 bg-gray-50' } + %input{ class: 'border w-48 py-1 px-3 text-sm rounded bg-transparent hover:border-yellow-300', placeholder: 'Search Coin' } + %div{ class: 'table w-full mt-6' } + %div{ class: 'table-header-group bg-gray-200' } + %div{ class: 'table-row' } + %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400' } Coin + %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-64' } Total + %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-64' } Available + %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-64' } In Order + %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-36' } BTC Value + %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400' } Action + %div{ class: 'table-row-group ' } + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + \ No newline at end of file From 78234b56253d740bfcc7e399bd87ecfd893f719e Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 15 Dec 2021 19:39:56 +0800 Subject: [PATCH 19/39] Generate model Wallet --- app/models/wallet.rb | 2 ++ db/migrate/20211215113934_create_wallets.rb | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 app/models/wallet.rb create mode 100644 db/migrate/20211215113934_create_wallets.rb diff --git a/app/models/wallet.rb b/app/models/wallet.rb new file mode 100644 index 000000000..987db9e81 --- /dev/null +++ b/app/models/wallet.rb @@ -0,0 +1,2 @@ +class Wallet < ApplicationRecord +end diff --git a/db/migrate/20211215113934_create_wallets.rb b/db/migrate/20211215113934_create_wallets.rb new file mode 100644 index 000000000..a40680eb0 --- /dev/null +++ b/db/migrate/20211215113934_create_wallets.rb @@ -0,0 +1,8 @@ +class CreateWallets < ActiveRecord::Migration[6.0] + def change + create_table :wallets do |t| + + t.timestamps + end + end +end From 99590abee59a077586864835eb80b11b57911974 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 15 Dec 2021 19:50:01 +0800 Subject: [PATCH 20/39] Populate wallets table columns --- db/migrate/20211215113934_create_wallets.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20211215113934_create_wallets.rb b/db/migrate/20211215113934_create_wallets.rb index a40680eb0..8444c91ed 100644 --- a/db/migrate/20211215113934_create_wallets.rb +++ b/db/migrate/20211215113934_create_wallets.rb @@ -1,6 +1,8 @@ class CreateWallets < ActiveRecord::Migration[6.0] def change create_table :wallets do |t| + t.float :balance + t.integer :user_id t.timestamps end From 2f77087a2e45c756e113f48576c8d9c141e0ebe5 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 15 Dec 2021 19:50:39 +0800 Subject: [PATCH 21/39] Rails dg migrate wallets table --- db/schema.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 4cfd03178..7cae8b4a5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_12_14_131652) do +ActiveRecord::Schema.define(version: 2021_12_15_113934) do create_table "cryptocurrencies", force: :cascade do |t| t.string "name" @@ -23,14 +23,13 @@ end create_table "roles", force: :cascade do |t| - t.string "name" + t.string "type" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end create_table "users", force: :cascade do |t| t.integer "role_id" - t.integer "country_id" t.string "firstname" t.string "lastname" t.string "username" @@ -38,10 +37,15 @@ t.string "email" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.index ["country_id"], name: "index_users_on_country_id" t.index ["role_id"], name: "index_users_on_role_id" end - add_foreign_key "users", "countries" + create_table "wallets", force: :cascade do |t| + t.float "balance" + t.integer "user_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + add_foreign_key "users", "roles" end From b17351c3420f7e18257ca4f4e76b7473256eeedd Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 15 Dec 2021 19:51:19 +0800 Subject: [PATCH 22/39] Created wallets routes --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index c89aa1283..a2bdfe69a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,4 @@ Rails.application.routes.draw do resources :users + resources :wallets end From 09092fb3fc5296c9ce62e917725fa3d4a2a129b7 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 15 Dec 2021 19:53:34 +0800 Subject: [PATCH 23/39] Moved users view index page to wallets view folder as its page --- app/views/{users => wallets}/index.html.haml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/views/{users => wallets}/index.html.haml (100%) diff --git a/app/views/users/index.html.haml b/app/views/wallets/index.html.haml similarity index 100% rename from app/views/users/index.html.haml rename to app/views/wallets/index.html.haml From 45db682d09bf354973ae7c4781fdb367b7133ba8 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 15 Dec 2021 19:57:26 +0800 Subject: [PATCH 24/39] Define a variable that will hold all cryptocurrency data --- app/controllers/wallets_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/controllers/wallets_controller.rb diff --git a/app/controllers/wallets_controller.rb b/app/controllers/wallets_controller.rb new file mode 100644 index 000000000..e528fcd80 --- /dev/null +++ b/app/controllers/wallets_controller.rb @@ -0,0 +1,5 @@ +class WalletsController < ApplicationController + def index + @cryptos = Cryptocurrency.all + end +end From c801ea68c8c53f8a5b4b0d4570f8a9b63b8ac38b Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Thu, 16 Dec 2021 18:58:21 +0800 Subject: [PATCH 25/39] Display cryptocurrencies in a table --- app/views/wallets/index.html.haml | 103 ++++-------------------------- 1 file changed, 12 insertions(+), 91 deletions(-) diff --git a/app/views/wallets/index.html.haml b/app/views/wallets/index.html.haml index b17a13e5e..3cdafc7ce 100644 --- a/app/views/wallets/index.html.haml +++ b/app/views/wallets/index.html.haml @@ -30,94 +30,15 @@ %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-36' } BTC Value %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400' } Action %div{ class: 'table-row-group ' } - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - %div{ class: 'table-row hover:bg-gray-100' } - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } Title - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 - %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' - \ No newline at end of file + - @cryptos.each do |crypto| + %div{ class: 'table-row hover:bg-gray-100' } + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = crypto.name + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 + %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } + = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' + = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + \ No newline at end of file From 2c253a0cd3c6b659440a6df0e1211095037f826b Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 4 Jan 2022 18:16:48 +0800 Subject: [PATCH 26/39] Hide API key --- .gitignore | 1 + Gemfile | 1 + Gemfile.lock | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index aef65f16f..3be5435bd 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ yarn-debug.log* .yarn-integrity config/database.yml +.env diff --git a/Gemfile b/Gemfile index e42d305d5..ec15b7c6f 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'devise' gem 'hamlit-rails' gem 'httparty' +gem 'dotenv-rails' group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] diff --git a/Gemfile.lock b/Gemfile.lock index 94f67deb6..d00d5b304 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,10 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.4.4) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) erubi (1.10.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -272,6 +276,7 @@ DEPENDENCIES byebug database_rewinder devise + dotenv-rails factory_bot_rails hamlit-rails httparty From b8464426314bbb82eabc530250b8818d368bda05 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 4 Jan 2022 19:56:31 +0800 Subject: [PATCH 27/39] Added crypto name/symbol in wallets table to identify what crypto owned --- db/migrate/20211215113934_create_wallets.rb | 1 + db/schema.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/db/migrate/20211215113934_create_wallets.rb b/db/migrate/20211215113934_create_wallets.rb index 8444c91ed..5d6f3fb8f 100644 --- a/db/migrate/20211215113934_create_wallets.rb +++ b/db/migrate/20211215113934_create_wallets.rb @@ -1,6 +1,7 @@ class CreateWallets < ActiveRecord::Migration[6.0] def change create_table :wallets do |t| + t.string :cryptocurrency t.float :balance t.integer :user_id diff --git a/db/schema.rb b/db/schema.rb index 7cae8b4a5..04e37a9a4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -41,6 +41,7 @@ end create_table "wallets", force: :cascade do |t| + t.string "cryptocurrency" t.float "balance" t.integer "user_id" t.datetime "created_at", precision: 6, null: false From 9de92997b6f27f63f316acb6295924bb999149d1 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 4 Jan 2022 19:57:30 +0800 Subject: [PATCH 28/39] Hide API key --- app/models/cryptocurrency.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/cryptocurrency.rb b/app/models/cryptocurrency.rb index 1c80ba7b3..54c7ae489 100644 --- a/app/models/cryptocurrency.rb +++ b/app/models/cryptocurrency.rb @@ -1,6 +1,6 @@ class Cryptocurrency < ApplicationRecord def current_price - api_key = "ce205881-4940-48a0-814e-3e4bb539eaeb" + api_key = ENV["COINMARKET_API_KEY"] url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest" symbol = self.symbol query = { From fd842a68334118612ed869ffc9290ee887e66abe Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Tue, 4 Jan 2022 19:57:57 +0800 Subject: [PATCH 29/39] Display all cryptocoins from API --- app/controllers/wallets_controller.rb | 10 +++++++++- app/views/wallets/index.html.haml | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/controllers/wallets_controller.rb b/app/controllers/wallets_controller.rb index e528fcd80..ea285b81b 100644 --- a/app/controllers/wallets_controller.rb +++ b/app/controllers/wallets_controller.rb @@ -1,5 +1,13 @@ class WalletsController < ApplicationController def index - @cryptos = Cryptocurrency.all + @api_key = ENV["COINMARKET_API_KEY"] + @url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest" + @headers = { + "X-CMC_PRO_API_KEY" => @api_key, + "Accepts" => "application/json" + } + @request = HTTParty.get(@url, :headers => @headers) + + @response = JSON.parse(@request.body)["data"] end end diff --git a/app/views/wallets/index.html.haml b/app/views/wallets/index.html.haml index 3cdafc7ce..e3d304e14 100644 --- a/app/views/wallets/index.html.haml +++ b/app/views/wallets/index.html.haml @@ -30,10 +30,10 @@ %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-36' } BTC Value %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400' } Action %div{ class: 'table-row-group ' } - - @cryptos.each do |crypto| + - for crypto in @response %div{ class: 'table-row hover:bg-gray-100' } %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = crypto.name + = crypto["name"] %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 From b9c597ae63f5b173808ce39e1848dd7a3ad8a244 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 18:55:30 +0800 Subject: [PATCH 30/39] Changed max supply column into currency kind(type) --- db/migrate/20211214131652_create_cryptocurrencies.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20211214131652_create_cryptocurrencies.rb b/db/migrate/20211214131652_create_cryptocurrencies.rb index 0c8c453bf..18786a984 100644 --- a/db/migrate/20211214131652_create_cryptocurrencies.rb +++ b/db/migrate/20211214131652_create_cryptocurrencies.rb @@ -2,7 +2,7 @@ class CreateCryptocurrencies < ActiveRecord::Migration[6.0] def change create_table :cryptocurrencies do |t| t.string :name - t.bigint :max_supply + t.string :kind t.string :symbol t.string :slug t.boolean :is_active From 9b7d04e95ab874a387b3f5348e484cfabcc86a54 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 18:56:40 +0800 Subject: [PATCH 31/39] Db migrate cryptocurrency migration changes --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 04e37a9a4..3c1d768c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -14,7 +14,7 @@ create_table "cryptocurrencies", force: :cascade do |t| t.string "name" - t.bigint "max_supply" + t.string "kind" t.string "symbol" t.string "slug" t.boolean "is_active" From 0e57e9f69ef746516070080ce497f268576dcd5c Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 18:57:08 +0800 Subject: [PATCH 32/39] Created db seed to populate cryptocurrency table --- db/seeds.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index a41fa5753..7876a4388 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -10,14 +10,15 @@ # @is_active [Boolean] active status of an existing cryptocurrency cryptocurrencies = Cryptocurrency.create([ - { name: 'Bitcoin', max_supply: 21000000, symbol: 'BTC', slug: 'bitcoin', is_active: true }, - { name: 'Ethereum', symbol: 'ETH', slug: 'ethereum', is_active: true }, - { name: 'Binance Coin', max_supply: 166801148, symbol: 'BNB', slug: 'binance-coin', is_active: true }, - { name: 'Tether', symbol: 'USDT', slug: 'tether', is_active: true }, - { name: 'Solana', symbol: 'SOL', slug: 'solana', is_active: true }, - { name: 'USD Coin', symbol: 'USDC', slug: 'usd-coin', is_active: true }, - { name: 'Cardano', max_supply: 45000000000, symbol: 'ADA', slug: 'cardano', is_active: true }, - { name: 'XRP', max_supply: 100000000000, symbol: 'XRP', slug: 'xrp', is_active: true }, - { name: 'Dogecoin', symbol: 'DOGE', slug: 'dogecoin', is_active: true }, - { name: 'Polkadot', symbol: 'DOT', slug: 'polkadot-new', is_active: true } + { name: 'Bitcoin', kind: 'Crypto', symbol: 'BTC', slug: 'bitcoin', is_active: true }, + { name: 'Ethereum', kind: 'Crypto', symbol: 'ETH', slug: 'ethereum', is_active: true }, + { name: 'Binance Coin', kind: 'Crypto', symbol: 'BNB', slug: 'binance-coin', is_active: true }, + { name: 'Tether', kind: 'Crypto', symbol: 'USDT', slug: 'tether', is_active: true }, + { name: 'Solana', kind: 'Crypto', symbol: 'SOL', slug: 'solana', is_active: true }, + { name: 'USD Coin', kind: 'Crypto', symbol: 'USDC', slug: 'usd-coin', is_active: true }, + { name: 'Cardano', kind: 'Crypto', symbol: 'ADA', slug: 'cardano', is_active: true }, + { name: 'XRP', kind: 'Crypto', symbol: 'XRP', slug: 'xrp', is_active: true }, + { name: 'Dogecoin', kind: 'Crypto', symbol: 'DOGE', slug: 'dogecoin', is_active: true }, + { name: 'Polkadot', kind: 'Crypto', symbol: 'DOT', slug: 'polkadot-new', is_active: true }, + { name: 'Philippine Peso', kind: 'Currency', symbol: 'PHP', is_active: true } ]) \ No newline at end of file From 305ea45e928877c91111b5bb3053f1533da0d166 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 18:58:38 +0800 Subject: [PATCH 33/39] Created cryptocurrency routes --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index a2bdfe69a..18f5ed0c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do resources :users + resources :cryptocurrencies resources :wallets end From 4d6522ddad14908dc57adf481c66f1c8ff320990 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 18:59:14 +0800 Subject: [PATCH 34/39] Removed crypto API request and changed to just a simple wallets controller --- app/controllers/wallets_controller.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/controllers/wallets_controller.rb b/app/controllers/wallets_controller.rb index ea285b81b..284e7a6f7 100644 --- a/app/controllers/wallets_controller.rb +++ b/app/controllers/wallets_controller.rb @@ -1,13 +1,9 @@ class WalletsController < ApplicationController def index - @api_key = ENV["COINMARKET_API_KEY"] - @url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest" - @headers = { - "X-CMC_PRO_API_KEY" => @api_key, - "Accepts" => "application/json" - } - @request = HTTParty.get(@url, :headers => @headers) - - @response = JSON.parse(@request.body)["data"] + @cryptos = Cryptocurrency.all + end + + def show + @crypto = Cryptocurrency.find(params[:id]) end end From eea1664555ab253cc259e5f988d1e6e5786dd780 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 19:00:21 +0800 Subject: [PATCH 35/39] Created cryptocurrency controller --- app/controllers/cryptocurrencies_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/controllers/cryptocurrencies_controller.rb diff --git a/app/controllers/cryptocurrencies_controller.rb b/app/controllers/cryptocurrencies_controller.rb new file mode 100644 index 000000000..66c26f771 --- /dev/null +++ b/app/controllers/cryptocurrencies_controller.rb @@ -0,0 +1,9 @@ +class CryptocurrenciesController < ApplicationController + def index + @cryptos = Cryptocurrency.all + end + + def show + @crypto = Cryptocurrency.find(params[:id]) + end +end From da012712a8d14eb30820d4fa9a60898a13324856 Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Wed, 5 Jan 2022 19:02:27 +0800 Subject: [PATCH 36/39] Changed crypto displays from api response to crypto table --- app/views/cryptocurrencies/show.html.haml | 5 +++++ app/views/wallets/index.html.haml | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 app/views/cryptocurrencies/show.html.haml diff --git a/app/views/cryptocurrencies/show.html.haml b/app/views/cryptocurrencies/show.html.haml new file mode 100644 index 000000000..f40cd4819 --- /dev/null +++ b/app/views/cryptocurrencies/show.html.haml @@ -0,0 +1,5 @@ +%h1 + = @crypto.name + +%p + 1 #{@crypto.symbol} = #{number_to_currency(@crypto.current_price, unit: "USD", format: "%n %u")} \ No newline at end of file diff --git a/app/views/wallets/index.html.haml b/app/views/wallets/index.html.haml index e3d304e14..ec3566df5 100644 --- a/app/views/wallets/index.html.haml +++ b/app/views/wallets/index.html.haml @@ -30,15 +30,14 @@ %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-36' } BTC Value %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400' } Action %div{ class: 'table-row-group ' } - - for crypto in @response + - @cryptos.each do |crypto| %div{ class: 'table-row hover:bg-gray-100' } %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = crypto["name"] + = crypto.name %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "Buy", nil, class: 'text-yellow-500 hover:underline' - = link_to "Convert", nil, class: 'ml-4 text-yellow-500 hover:underline' + = link_to "View", crypto, class: 'text-yellow-500 hover:underline' \ No newline at end of file From ceffd54f0aec8f444daa1d05841932127fd5b83a Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Thu, 6 Jan 2022 15:26:43 +0800 Subject: [PATCH 37/39] Display selected crypto --- app/controllers/wallets_controller.rb | 6 ++++++ app/views/wallets/new.html.haml | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 app/views/wallets/new.html.haml diff --git a/app/controllers/wallets_controller.rb b/app/controllers/wallets_controller.rb index 284e7a6f7..230cf0a4a 100644 --- a/app/controllers/wallets_controller.rb +++ b/app/controllers/wallets_controller.rb @@ -1,9 +1,15 @@ class WalletsController < ApplicationController def index @cryptos = Cryptocurrency.all + @owned = Wallet.where(user_id: 3).distinct.pluck(:cryptocurrency) end def show @crypto = Cryptocurrency.find(params[:id]) end + + def new + @crypto = Cryptocurrency.find(params[:id]) + @crypto_owned = Wallet.where(user_id: 3, cryptocurrency: @crypto.symbol).sum(:balance) + end end diff --git a/app/views/wallets/new.html.haml b/app/views/wallets/new.html.haml new file mode 100644 index 000000000..2fdb208e7 --- /dev/null +++ b/app/views/wallets/new.html.haml @@ -0,0 +1,7 @@ +%h1 + = @crypto.name + +%p + 1 #{@crypto.symbol} = #{number_to_currency(@crypto.current_price, unit: "USD", format: "%n %u")} + %br/ + = @crypto_owned \ No newline at end of file From 684419860d5014acd840f54d230def63310f285c Mon Sep 17 00:00:00 2001 From: JM Arenas Date: Thu, 6 Jan 2022 15:27:12 +0800 Subject: [PATCH 38/39] Display total balance per crypto owned --- app/controllers/cryptocurrencies_controller.rb | 1 + app/views/cryptocurrencies/show.html.haml | 3 ++- app/views/wallets/index.html.haml | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/cryptocurrencies_controller.rb b/app/controllers/cryptocurrencies_controller.rb index 66c26f771..2d461e4e8 100644 --- a/app/controllers/cryptocurrencies_controller.rb +++ b/app/controllers/cryptocurrencies_controller.rb @@ -5,5 +5,6 @@ def index def show @crypto = Cryptocurrency.find(params[:id]) + @crypto_owned = Wallet.where(user_id: 3, cryptocurrency: @crypto.symbol).sum(:balance) end end diff --git a/app/views/cryptocurrencies/show.html.haml b/app/views/cryptocurrencies/show.html.haml index f40cd4819..ae1627e0a 100644 --- a/app/views/cryptocurrencies/show.html.haml +++ b/app/views/cryptocurrencies/show.html.haml @@ -2,4 +2,5 @@ = @crypto.name %p - 1 #{@crypto.symbol} = #{number_to_currency(@crypto.current_price, unit: "USD", format: "%n %u")} \ No newline at end of file + 1 #{@crypto.symbol} = #{number_to_currency(@crypto.current_price, unit: "USD", format: "%n %u")} + = @crypto_owned \ No newline at end of file diff --git a/app/views/wallets/index.html.haml b/app/views/wallets/index.html.haml index ec3566df5..a057fd8c7 100644 --- a/app/views/wallets/index.html.haml +++ b/app/views/wallets/index.html.haml @@ -30,6 +30,7 @@ %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400 w-36' } BTC Value %div{ class: 'table-cell text-left py-4 px-4 text-xs text-gray-400' } Action %div{ class: 'table-row-group ' } + = @owned - @cryptos.each do |crypto| %div{ class: 'table-row hover:bg-gray-100' } %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } @@ -39,5 +40,5 @@ %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } 0.00000000 %div{ class: 'table-cell text-left py-6 px-4 text-gray-600 border-b' } - = link_to "View", crypto, class: 'text-yellow-500 hover:underline' + = link_to "View", new_wallet_path(:id => crypto.id), class: 'text-yellow-500 hover:underline' \ No newline at end of file From 85951364e8ced246ed7c0857e6e311d4d6ddcf9c Mon Sep 17 00:00:00 2001 From: sun-asterisk Date: Mon, 10 Jan 2022 19:42:28 +0800 Subject: [PATCH 39/39] devise gem: ui not finalized and sign-in is working --- Gemfile | 1 + Gemfile.lock | 15 + app/api/QuoteRandomizer/client.rb | 11 + app/api/QuoteRandomizer/request.rb | 19 ++ app/controllers/application_controller.rb | 1 + app/models/user.rb | 4 + app/views/devise/confirmations/new.html.erb | 16 + .../mailer/confirmation_instructions.html.erb | 5 + .../devise/mailer/email_changed.html.erb | 7 + .../devise/mailer/password_change.html.erb | 3 + .../reset_password_instructions.html.erb | 8 + .../mailer/unlock_instructions.html.erb | 7 + app/views/devise/passwords/edit.html.erb | 25 ++ app/views/devise/passwords/new.html.erb | 16 + app/views/devise/registrations/edit.html.erb | 43 +++ app/views/devise/registrations/new.html.erb | 29 ++ app/views/devise/sessions/new.html.erb | 33 ++ .../devise/shared/_error_messages.html.erb | 15 + app/views/devise/shared/_links.html.erb | 25 ++ app/views/devise/unlocks/new.html.erb | 16 + app/views/layouts/application.html.erb | 5 + app/views/users/_form.html.haml | 2 +- config/initializers/devise.rb | 311 ++++++++++++++++++ config/locales/devise.en.yml | 65 ++++ config/routes.rb | 1 + db/migrate/20211207113835_create_users.rb | 14 - .../20220107022930_devise_create_users.rb | 44 +++ db/schema.rb | 19 +- 28 files changed, 735 insertions(+), 25 deletions(-) create mode 100644 app/api/QuoteRandomizer/client.rb create mode 100644 app/api/QuoteRandomizer/request.rb create mode 100644 app/views/devise/confirmations/new.html.erb create mode 100644 app/views/devise/mailer/confirmation_instructions.html.erb create mode 100644 app/views/devise/mailer/email_changed.html.erb create mode 100644 app/views/devise/mailer/password_change.html.erb create mode 100644 app/views/devise/mailer/reset_password_instructions.html.erb create mode 100644 app/views/devise/mailer/unlock_instructions.html.erb create mode 100644 app/views/devise/passwords/edit.html.erb create mode 100644 app/views/devise/passwords/new.html.erb create mode 100644 app/views/devise/registrations/edit.html.erb create mode 100644 app/views/devise/registrations/new.html.erb create mode 100644 app/views/devise/sessions/new.html.erb create mode 100644 app/views/devise/shared/_error_messages.html.erb create mode 100644 app/views/devise/shared/_links.html.erb create mode 100644 app/views/devise/unlocks/new.html.erb create mode 100644 config/initializers/devise.rb create mode 100644 config/locales/devise.en.yml delete mode 100644 db/migrate/20211207113835_create_users.rb create mode 100644 db/migrate/20220107022930_devise_create_users.rb diff --git a/Gemfile b/Gemfile index ec15b7c6f..de9e7f4ce 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'devise' gem 'hamlit-rails' gem 'httparty' gem 'dotenv-rails' +gem 'rest-client' group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] diff --git a/Gemfile.lock b/Gemfile.lock index d00d5b304..f85ce869f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,8 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.4.4) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) dotenv-rails (2.7.6) dotenv (= 2.7.6) @@ -100,6 +102,9 @@ GEM hamlit (>= 1.2.0) railties (>= 4.0.1) hashdiff (1.0.1) + http-accept (1.7.0) + http-cookie (1.0.4) + domain_name (~> 0.5) httparty (0.20.0) mime-types (~> 3.0) multi_xml (>= 0.5.2) @@ -124,6 +129,7 @@ GEM minitest (5.14.4) msgpack (1.4.2) multi_xml (0.6.0) + netrc (0.11.0) nio4r (2.5.7) nokogiri (1.11.3-x86_64-linux) racc (~> 1.4) @@ -176,6 +182,11 @@ GEM responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) rexml (3.2.5) rspec-core (3.10.1) rspec-support (~> 3.10.0) @@ -246,6 +257,9 @@ GEM turbolinks-source (5.2.0) tzinfo (1.2.9) thread_safe (~> 0.1) + unf (0.1.4) + unf_ext + unf_ext (0.0.8) unicode-display_width (2.0.0) vcr (6.0.0) warden (1.2.9) @@ -285,6 +299,7 @@ DEPENDENCIES pg puma (~> 4.1) rails (~> 6.0.3, >= 6.0.3.4) + rest-client rspec-rails rubocop-rails rubocop-rspec diff --git a/app/api/QuoteRandomizer/client.rb b/app/api/QuoteRandomizer/client.rb new file mode 100644 index 000000000..965094ff6 --- /dev/null +++ b/app/api/QuoteRandomizer/client.rb @@ -0,0 +1,11 @@ +module QuoteRandomizer + class Client + def self.today + response = Request.call(http_method: 'get', endpoint:'/today.json') + end + + def self.random(lang="en") + response = Request.call(http_method: 'get', endpoint:'/random.json') + end + end +end \ No newline at end of file diff --git a/app/api/QuoteRandomizer/request.rb b/app/api/QuoteRandomizer/request.rb new file mode 100644 index 000000000..a9f57e74d --- /dev/null +++ b/app/api/QuoteRandomizer/request.rb @@ -0,0 +1,19 @@ +require 'rest-client' + +module QuoteRandomizer + class Request + BASE_URL = 'https://uselessfacts.jsph.pl/' + TOKEN = 'token' + + def self.call(http_method:, endpoint:) + result = RestClient::Request.execute( + method: http_method, + url: "#{BASE_URL}#{endpoint}", + # url: "#{BASE_URL}#{endpoint}?apikey=#{TOKEN}" + headers: {'Content-Type'=> 'application/json'} + ) + JSON.parse(result) + end + end + +end \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d12a..6b4dcfa85 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,2 +1,3 @@ class ApplicationController < ActionController::Base + before_action :authenticate_user! end diff --git a/app/models/user.rb b/app/models/user.rb index 379658a50..47567994e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,2 +1,6 @@ class User < ApplicationRecord + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :validatable end diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 000000000..b12dd0cbe --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,16 @@ +

Resend confirmation instructions

+ +<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> +
+ +
+ <%= f.submit "Resend confirmation instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 000000000..dc55f64f6 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/email_changed.html.erb b/app/views/devise/mailer/email_changed.html.erb new file mode 100644 index 000000000..32f4ba803 --- /dev/null +++ b/app/views/devise/mailer/email_changed.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @email %>!

+ +<% if @resource.try(:unconfirmed_email?) %> +

We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

+<% else %> +

We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

+<% end %> diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 000000000..b41daf476 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +

Hello <%= @resource.email %>!

+ +

We're contacting you to notify you that your password has been changed.

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 000000000..f667dc12f --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password. You can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 000000000..41e148bf2 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 000000000..5fbb9ff0a --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,25 @@ +

Change your password

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + <%= f.hidden_field :reset_password_token %> + +
+ <%= f.label :password, "New password" %>
+ <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum)
+ <% end %> + <%= f.password_field :password, autofocus: true, autocomplete: "new-password" %> +
+ +
+ <%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %> +
+ +
+ <%= f.submit "Change my password" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 000000000..9b486b81b --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,16 @@ +

Forgot your password?

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %> +
+ +
+ <%= f.submit "Send me reset password instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 000000000..38d95b85a --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,43 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %> +
+ + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %> + +
+ <%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, autocomplete: "new-password" %> + <% if @minimum_password_length %> +
+ <%= @minimum_password_length %> characters minimum + <% end %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %> +
+ +
+ <%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password, autocomplete: "current-password" %> +
+ +
+ <%= f.submit "Update" %> +
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 000000000..d655b66f6 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,29 @@ +

Sign up

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %> +
+ +
+ <%= f.label :password %> + <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) + <% end %>
+ <%= f.password_field :password, autocomplete: "new-password" %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %> +
+ +
+ <%= f.submit "Sign up" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 000000000..a63887359 --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,33 @@ +
+

Binance Account Login

+

Welcome back! Log In with your Email, Phone number or QR code

+ +<% if alert %> +

<%= alert %>

+<% end %> + +<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: 'p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300' %> +
+ +
+ <%= f.label :password %>
+ <%= f.password_field :password, autocomplete: "current-password", class: 'p-3 w-full rounded border mt-1 mb-3 hover:border-yellow-300' %> +
+ + <% if devise_mapping.rememberable? %> +
+ <%= f.check_box :remember_me %> + <%= f.label :remember_me %> +
+ <% end %> + +
+ <%= f.submit "Log in", class: 'w-full bg-yellow-300 mt-8 p-4 rounded text-sm' %> +
+<% end %> + +<%= render "devise/shared/links" %> +
diff --git a/app/views/devise/shared/_error_messages.html.erb b/app/views/devise/shared/_error_messages.html.erb new file mode 100644 index 000000000..ba7ab8870 --- /dev/null +++ b/app/views/devise/shared/_error_messages.html.erb @@ -0,0 +1,15 @@ +<% if resource.errors.any? %> +
+

+ <%= I18n.t("errors.messages.not_saved", + count: resource.errors.count, + resource: resource.class.model_name.human.downcase) + %> +

+
    + <% resource.errors.full_messages.each do |message| %> +
  • <%= message %>
  • + <% end %> +
+
+<% end %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb new file mode 100644 index 000000000..084af701c --- /dev/null +++ b/app/views/devise/shared/_links.html.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Log in", new_session_path(resource_name) %>
+<% end %> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end %> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end %> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end %> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end %> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
+ <% end %> +<% end %> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 000000000..ffc34de8d --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,16 @@ +

Resend unlock instructions

+ +<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= render "devise/shared/error_messages", resource: resource %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %> +
+ +
+ <%= f.submit "Resend unlock instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 14d1dc990..9502d704c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,6 +12,11 @@ + + <% if notice %> +

<%= notice %>

+ <% end %> + <%= yield %> diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 6ebc0d972..b614d7f3c 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -18,4 +18,4 @@ = f.label 'Country / Area of Residence', class: 'text-sm' %div{ class: 'border rounded mt-1' } = f.select :country, ["Berlin", "Chicago", "Madrid"] - = f.submit 'Create Account', class: 'w-full bg-yellow-300 mt-8 p-4 rounded-lg text-sm' + = f.submit 'Create Account', class: 'w-full bg-yellow-300 mt-8 p-4 rounded text-sm' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 000000000..0bfe232a7 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,311 @@ +# frozen_string_literal: true + +# Assuming you have not yet modified this file, each configuration option below +# is set to its default value. Note that some are commented out while others +# are not: uncommented lines are intended to protect your configuration from +# breaking changes in upgrades (i.e., in the event that future versions of +# Devise change the default values for those options). +# +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # The secret key used by Devise. Devise uses this key to generate + # random tokens. Changing this key will render invalid all existing + # confirmation, reset password and unlock tokens in the database. + # Devise will use the `secret_key_base` as its `secret_key` + # by default. You can change it below and use your own secret key. + # config.secret_key = '80d8a5c026b2fa1c24fd8f3b2cbc6271f4c6930ba09a0ccaeb9169c2acef946e744834f4007af4783aecb1f9be57a4df06729fc3c1f3e72dfcaa530f08f39164' + + # ==> Controller configuration + # Configure the parent class to the devise controllers. + # config.parent_controller = 'DeviseController' + + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class + # with default "from" parameter. + config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' + + # Configure the class responsible to send e-mails. + # config.mailer = 'Devise::Mailer' + + # Configure the parent class responsible to send e-mails. + # config.parent_mailer = 'ActionMailer::Base' + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [:email] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [:email] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [:email] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. + # For API-only applications to support authentication "out-of-the-box", you will likely want to + # enable this with :database unless you are using a custom strategy. + # The supported strategies are: + # :database = Support basic authentication with authentication key + password + # config.http_authenticatable = false + + # If 401 status code should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. 'Application' by default. + # config.http_authentication_realm = 'Application' + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # particular strategies by setting this option. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing skip: :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + + # When false, Devise will not attempt to reload routes on eager load. + # This can reduce the time taken to boot the app but if your application + # requires the Devise mappings to be loaded during boot time the application + # won't boot properly. + # config.reload_routes = true + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 12. If + # using other algorithms, it sets how many times you want the password to be hashed. + # The number of stretches used for generating the hashed password are stored + # with the hashed password. This allows you to change the stretches without + # invalidating existing passwords. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. Note that, for bcrypt (the default + # algorithm), the cost increases exponentially with the number of stretches (e.g. + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). + config.stretches = Rails.env.test? ? 1 : 12 + + # Set up a pepper to generate the hashed password. + # config.pepper = '9afc8dc5d65015a1904cdf5c8438ed7c9cd1821080014e78232718c6c3bb409d8a7e6edb0b93fc41b36e2013ed61fb303a1b35efccfe8bd24e1b4e0f5213301e' + + # Send a notification to the original email when the user's email is changed. + # config.send_email_changed_notification = false + + # Send a notification email when the user's password is changed. + # config.send_password_change_notification = false + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming their account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming their account, + # access will be blocked just in the third day. + # You can also set it to nil, which will allow the user to access the website + # without confirming their account. + # Default is 0.days, meaning the user cannot access the website without + # confirming their account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed, new email is stored in + # unconfirmed_email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [:email] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # secure: true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. + config.password_length = 6..128 + + # Email regex used to validate email formats. It simply asserts that + # one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [:email] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [:email] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # When set to false, does not sign a user in automatically after their password is + # reset. Defaults to true, so a user is signed in automatically after a reset. + # config.sign_in_after_reset_password = true + + # ==> Configuration for :encryptable + # Allow you to use another hashing or encryption algorithm besides bcrypt (default). + # You can use :sha1, :sha512 or algorithms from others authentication tools as + # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 + # for default behavior) and :restful_authentication_sha1 (then you should set + # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). + # + # Require the `devise-encryptable` gem when using anything other than bcrypt + # config.encryptor = :sha512 + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ['*/*', :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(scope: :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: '/my_engine' + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using OmniAuth, Devise cannot automatically set OmniAuth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = '/my_engine/users/auth' + + # ==> Turbolinks configuration + # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: + # + # ActiveSupport.on_load(:devise_failure_app) do + # include Turbolinks::Controller + # end + + # ==> Configuration for :registerable + + # When set to false, does not sign a user in automatically after their password is + # changed. Defaults to true, so a user is signed in automatically after changing a password. + # config.sign_in_after_change_password = true +end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 000000000..ab1f07060 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,65 @@ +# Additional translations at https://github.com/heartcombo/devise/wiki/I18n + +en: + devise: + confirmations: + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." + failure: + already_authenticated: "You are already signed in." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." + locked: "Your account is locked." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." + unauthenticated: "You need to sign in or sign up before continuing." + unconfirmed: "You have to confirm your email address before continuing." + mailer: + confirmation_instructions: + subject: "Confirmation instructions" + reset_password_instructions: + subject: "Reset password instructions" + unlock_instructions: + subject: "Unlock instructions" + email_changed: + subject: "Email Changed" + password_change: + subject: "Password Changed" + omniauth_callbacks: + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." + success: "Successfully authenticated from %{kind} account." + passwords: + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." + registrations: + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." + signed_up: "Welcome! You have signed up successfully." + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." + updated: "Your account has been updated successfully." + updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again" + sessions: + signed_in: "Signed in successfully." + signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." + unlocks: + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." + unlocked: "Your account has been unlocked successfully. Please sign in to continue." + errors: + messages: + already_confirmed: "was already confirmed, please try signing in" + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" + expired: "has expired, please request a new one" + not_found: "not found" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/routes.rb b/config/routes.rb index 18f5ed0c7..7a0302b26 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + devise_for :users resources :users resources :cryptocurrencies resources :wallets diff --git a/db/migrate/20211207113835_create_users.rb b/db/migrate/20211207113835_create_users.rb deleted file mode 100644 index 0b5855d24..000000000 --- a/db/migrate/20211207113835_create_users.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateUsers < ActiveRecord::Migration[6.0] - def change - create_table :users do |t| - t.references :role, foreign_key: true - t.references :country, foreign_key: true - t.string :firstname - t.string :lastname - t.string :username - t.text :password - t.string :email - t.timestamps - end - end -end diff --git a/db/migrate/20220107022930_devise_create_users.rb b/db/migrate/20220107022930_devise_create_users.rb new file mode 100644 index 000000000..9ef368e8e --- /dev/null +++ b/db/migrate/20220107022930_devise_create_users.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class DeviseCreateUsers < ActiveRecord::Migration[6.0] + def change + create_table :users do |t| + ## Database authenticatable + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + # t.integer :sign_in_count, default: 0, null: false + # t.datetime :current_sign_in_at + # t.datetime :last_sign_in_at + # t.string :current_sign_in_ip + # t.string :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + + t.timestamps null: false + end + + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true + # add_index :users, :confirmation_token, unique: true + # add_index :users, :unlock_token, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 3c1d768c1..bdbbdedde 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_12_15_113934) do +ActiveRecord::Schema.define(version: 2022_01_07_022930) do create_table "cryptocurrencies", force: :cascade do |t| t.string "name" @@ -23,21 +23,21 @@ end create_table "roles", force: :cascade do |t| - t.string "type" + t.string "name" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false end create_table "users", force: :cascade do |t| - t.integer "role_id" - t.string "firstname" - t.string "lastname" - t.string "username" - t.text "password" - t.string "email" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.index ["role_id"], name: "index_users_on_role_id" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end create_table "wallets", force: :cascade do |t| @@ -48,5 +48,4 @@ t.datetime "updated_at", precision: 6, null: false end - add_foreign_key "users", "roles" end