lesli_letter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_letter_manifest.js +39 -0
  4. data/app/assets/images/lesli_letter/letter-logo.svg +1 -0
  5. data/app/assets/javascripts/lesli_letter/application.js +3980 -0
  6. data/app/assets/stylesheets/lesli_letter/application.scss +37 -0
  7. data/app/assets/stylesheets/lesli_letter/notebooks.scss +43 -0
  8. data/app/assets/stylesheets/lesli_letter/notes.scss +71 -0
  9. data/app/controllers/lesli_letter/accounts_controller.rb +60 -0
  10. data/app/controllers/lesli_letter/application_controller.rb +4 -0
  11. data/app/controllers/lesli_letter/dashboards_controller.rb +4 -0
  12. data/app/controllers/lesli_letter/notebooks_controller.rb +98 -0
  13. data/app/controllers/lesli_letter/notes_controller.rb +114 -0
  14. data/app/helpers/lesli_letter/accounts_helper.rb +4 -0
  15. data/app/helpers/lesli_letter/application_helper.rb +4 -0
  16. data/app/helpers/lesli_letter/dashboards_helper.rb +4 -0
  17. data/app/helpers/lesli_letter/notebooks_helper.rb +4 -0
  18. data/app/helpers/lesli_letter/notes_helper.rb +4 -0
  19. data/app/jobs/lesli_letter/application_job.rb +4 -0
  20. data/app/mailers/lesli_letter/application_mailer.rb +6 -0
  21. data/app/models/lesli_letter/account.rb +39 -0
  22. data/app/models/lesli_letter/application_record.rb +5 -0
  23. data/app/models/lesli_letter/dashboard.rb +31 -0
  24. data/app/models/lesli_letter/note.rb +7 -0
  25. data/app/models/lesli_letter/notebook.rb +7 -0
  26. data/app/services/lesli_letter/note_service.rb +64 -0
  27. data/app/services/lesli_letter/notebook_service.rb +52 -0
  28. data/app/views/lesli_letter/accounts/_account.html.erb +2 -0
  29. data/app/views/lesli_letter/accounts/_form.html.erb +17 -0
  30. data/app/views/lesli_letter/accounts/edit.html.erb +10 -0
  31. data/app/views/lesli_letter/accounts/index.html.erb +14 -0
  32. data/app/views/lesli_letter/accounts/new.html.erb +9 -0
  33. data/app/views/lesli_letter/accounts/show.html.erb +10 -0
  34. data/app/views/lesli_letter/dashboards/show.html.erb +1 -0
  35. data/app/views/lesli_letter/notebooks/edit.html.erb +10 -0
  36. data/app/views/lesli_letter/notebooks/index.html.erb +1 -0
  37. data/app/views/lesli_letter/notebooks/new.html.erb +9 -0
  38. data/app/views/lesli_letter/notebooks/show.html.erb +10 -0
  39. data/app/views/lesli_letter/notes/edit.html.erb +10 -0
  40. data/app/views/lesli_letter/notes/index.html.erb +1 -0
  41. data/app/views/lesli_letter/notes/new.html.erb +9 -0
  42. data/app/views/lesli_letter/notes/show.html.erb +10 -0
  43. data/app/views/lesli_letter/partials/_engine-navigation.html.erb +37 -0
  44. data/config/locales/translations.en.yml +23 -0
  45. data/config/locales/translations.es.yml +23 -0
  46. data/config/routes.rb +57 -0
  47. data/db/migrate/v1/0305000110_create_lesli_letter_accounts.rb +42 -0
  48. data/db/migrate/v1/0305050110_create_lesli_letter_dashboards.rb +51 -0
  49. data/db/migrate/v1/0305050210_create_lesli_letter_dashboard_components.rb +53 -0
  50. data/db/migrate/v1/0305100110_create_lesli_letter_notebooks.rb +46 -0
  51. data/db/migrate/v1/0305110110_create_lesli_letter_notes.rb +48 -0
  52. data/db/seed/development.rb +53 -0
  53. data/db/seed/production.rb +35 -0
  54. data/db/seed/test.rb +35 -0
  55. data/db/seeds.rb +43 -0
  56. data/lib/lesli_letter/engine.rb +49 -0
  57. data/lib/lesli_letter/version.rb +4 -0
  58. data/lib/lesli_letter.rb +6 -0
  59. data/lib/tasks/lesli_letter_tasks.rake +4 -0
  60. data/lib/vue/application.js +77 -0
  61. data/lib/vue/apps/notebooks/index.vue +85 -0
  62. data/lib/vue/apps/notes/components/note-preview.vue +45 -0
  63. data/lib/vue/apps/notes/index.vue +102 -0
  64. data/lib/vue/stores/note.js +90 -0
  65. data/lib/vue/stores/notebooks.js +61 -0
  66. data/lib/vue/stores/notes.js +61 -0
  67. data/lib/vue/stores/translations.json +58 -0
  68. data/license +674 -0
  69. data/readme.md +76 -0
  70. metadata +128 -0
@@ -0,0 +1,52 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ module LesliLetter
34
+ class NotebookService < Lesli::ApplicationLesliService
35
+
36
+ def find id
37
+ self.resource = current_user.account.roles.find_by_id(id)
38
+ self
39
+ end
40
+
41
+
42
+ # @return [Array] Paginated index of users.
43
+ # @description Return a paginated array of users, used mostly in frontend views
44
+ def index
45
+ current_user.account.letter.notebooks
46
+ .select(:id, :name, :description)
47
+ .page(query[:pagination][:page])
48
+ .per(query[:pagination][:perPage])
49
+ .order(updated_at: :desc, name: :asc)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,2 @@
1
+ <div id="<%= dom_id account %>">
2
+ </div>
@@ -0,0 +1,17 @@
1
+ <%= form_with(model: account) do |form| %>
2
+ <% if account.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(account.errors.count, "error") %> prohibited this account from being saved:</h2>
5
+
6
+ <ul>
7
+ <% account.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div>
15
+ <%= form.submit %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h1>Editing account</h1>
2
+
3
+ <%= render "form", account: @account %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this account", @account %> |
9
+ <%= link_to "Back to accounts", accounts_path %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Accounts</h1>
4
+
5
+ <div id="accounts">
6
+ <% @accounts.each do |account| %>
7
+ <%= render account %>
8
+ <p>
9
+ <%= link_to "Show this account", account %>
10
+ </p>
11
+ <% end %>
12
+ </div>
13
+
14
+ <%= link_to "New account", new_account_path %>
@@ -0,0 +1,9 @@
1
+ <h1>New account</h1>
2
+
3
+ <%= render "form", account: @account %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to accounts", accounts_path %>
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @account %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this account", edit_account_path(@account) %> |
7
+ <%= link_to "Back to accounts", accounts_path %>
8
+
9
+ <%= button_to "Destroy this account", @account, method: :delete %>
10
+ </div>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1,10 @@
1
+ <h1>Editing notebook</h1>
2
+
3
+ <%= render "form", notebook: @notebook %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this notebook", @notebook %> |
9
+ <%= link_to "Back to notebooks", notebooks_path %>
10
+ </div>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1,9 @@
1
+ <h1>New notebook</h1>
2
+
3
+ <%= render "form", notebook: @notebook %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to notebooks", notebooks_path %>
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @notebook %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this notebook", edit_notebook_path(@notebook) %> |
7
+ <%= link_to "Back to notebooks", notebooks_path %>
8
+
9
+ <%= button_to "Destroy this notebook", @notebook, method: :delete %>
10
+ </div>
@@ -0,0 +1,10 @@
1
+ <h1>Editing note</h1>
2
+
3
+ <%= render "form", note: @note %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this note", @note %> |
9
+ <%= link_to "Back to notes", notes_path %>
10
+ </div>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1,9 @@
1
+ <h1>New note</h1>
2
+
3
+ <%= render "form", note: @note %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to notes", notes_path %>
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @note %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this note", edit_note_path(@note) %> |
7
+ <%= link_to "Back to notes", notes_path %>
8
+
9
+ <%= button_to "Destroy this note", @note, method: :delete %>
10
+ </div>
@@ -0,0 +1,37 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS development platform.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+
35
+ <%= navigation_item(lesli_letter.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
36
+ <%= navigation_item(lesli_letter.notes_path, "Notes", "ri-article-line"); %>
37
+ <%= navigation_item(lesli_letter.notebooks_path, "Notebooks", "ri-booklet-line"); %>
@@ -0,0 +1,23 @@
1
+ ---
2
+ :en:
3
+ lesli_letter:
4
+ notes:
5
+ toolbar_search_placeholder: Search by title or content...
6
+ view_title: Notes
7
+ lesli:
8
+ shared:
9
+ view_discussions: Discussions
10
+ button_add_new: Add new
11
+ button_reload: Reload
12
+ view_files: Files
13
+ view_quick_actions: Quick actions
14
+ button_list: List
15
+ button_save: Save
16
+ button_delete: Delete
17
+ button_edit: Edit
18
+ view_status_active: Active
19
+ view_status_inactive: Inactive
20
+ button_settings: Settings
21
+ application:
22
+ navigation_logout: Logout
23
+ navigation_my_profile: My profile
@@ -0,0 +1,23 @@
1
+ ---
2
+ :es:
3
+ lesli_letter:
4
+ notes:
5
+ toolbar_search_placeholder: Buscar por titulo o contenido...
6
+ view_title: Notas
7
+ lesli:
8
+ shared:
9
+ view_discussions: Discusiones
10
+ button_add_new: Agregar nuevo
11
+ button_reload: Recargar
12
+ view_files: Archivos
13
+ view_quick_actions: Acciones rapidas
14
+ button_list: Lista
15
+ button_save: Guardar
16
+ button_delete: Eliminar
17
+ button_edit: Editar
18
+ view_status_active: Activo
19
+ view_status_inactive: Inactivo
20
+ button_settings: Configuración
21
+ application:
22
+ navigation_logout: Cerrar sesión
23
+ navigation_my_profile: Mi perfil
data/config/routes.rb ADDED
@@ -0,0 +1,57 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+ LesliLetter::Engine.routes.draw do
33
+ resources :notes
34
+
35
+ # Dashboard alias
36
+ root to: "dashboards#show"
37
+
38
+
39
+ # Dashboard
40
+ resource :dashboard, only: [:show]
41
+ # resources :dashboards do
42
+ # collection do
43
+ # post "list" => :index
44
+ # get :options
45
+ # end
46
+ # scope module: :dashboard do
47
+ # resources :components
48
+ # end
49
+ # end
50
+
51
+
52
+
53
+ resources :notes, only: [:index, :show, :update]
54
+ resources :notebooks, only: [:index]
55
+ #resources :dashboards
56
+ #resources :accounts
57
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ class CreateLesliLetterAccounts < ActiveRecord::Migration[6.0]
34
+ def change
35
+ create_table :lesli_letter_accounts do |t|
36
+ t.integer :status
37
+ t.datetime :deleted_at, index: true
38
+ t.timestamps
39
+ end
40
+ add_reference(:lesli_letter_accounts, :account, foreign_key: { to_table: :lesli_accounts })
41
+ end
42
+ end
@@ -0,0 +1,51 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ class CreateLesliLetterDashboards < ActiveRecord::Migration[6.1]
34
+ def change
35
+ gem_path = Lesli::System.engine("Lesli", "dir")
36
+ table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000501_dashboards.json")))
37
+ create_table :lesli_letter_dashboards do |t|
38
+ table_base_structure.each do |column|
39
+ t.send(
40
+ column["type"].parameterize.underscore.to_sym,
41
+ column["name"].parameterize.underscore.to_sym
42
+ )
43
+ end
44
+ t.timestamps
45
+ end
46
+
47
+ add_reference(:lesli_letter_dashboards, :account, foreign_key: { to_table: :lesli_letter_accounts })
48
+ add_reference(:lesli_letter_dashboards, :user, foreign_key: { to_table: :lesli_users })
49
+ #add_reference(:lesli_admin_dashboards, :role, foreign_key: { to_table: :roles })
50
+ end
51
+ end
@@ -0,0 +1,53 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ class CreateLesliLetterDashboardComponents < ActiveRecord::Migration[6.1]
34
+ def change
35
+ gem_path = Lesli::System.engine("Lesli", "dir")
36
+ table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000502_dashboard_components.json")))
37
+ create_table :lesli_letter_dashboard_components do |t|
38
+ table_base_structure.each do |column|
39
+ t.send(
40
+ column["type"].parameterize.underscore.to_sym,
41
+ column["name"].parameterize.underscore.to_sym
42
+ )
43
+ end
44
+ t.timestamps
45
+ end
46
+
47
+ add_reference(
48
+ :lesli_letter_dashboard_components, :dashboard,
49
+ foreign_key: { to_table: :lesli_letter_dashboards },
50
+ index: { name: "lesli_letter_dashboard_components_index" }
51
+ )
52
+ end
53
+ end
@@ -0,0 +1,46 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ class CreateLesliLetterNotebooks < ActiveRecord::Migration[7.0]
34
+ def change
35
+ create_table :lesli_letter_notebooks do |t|
36
+ t.string :name
37
+ t.string :description
38
+ t.string :icon
39
+ t.boolean :active
40
+ t.datetime :deleted_at, index: true
41
+ t.timestamps
42
+ end
43
+ add_reference(:lesli_letter_notebooks, :user, foreign_key: { to_table: :lesli_users })
44
+ add_reference(:lesli_letter_notebooks, :account, foreign_key: { to_table: :lesli_letter_accounts })
45
+ end
46
+ end
@@ -0,0 +1,48 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ class CreateLesliLetterNotes < ActiveRecord::Migration[7.0]
34
+ def change
35
+ create_table :lesli_letter_notes do |t|
36
+ t.string :name
37
+ t.string :type
38
+ t.string :privacy
39
+ t.string :icon
40
+ t.text :content
41
+ t.datetime :deleted_at, index: true
42
+ t.timestamps
43
+ end
44
+ add_reference(:lesli_letter_notes, :notebook, foreign_key: { to_table: :lesli_letter_notebooks })
45
+ add_reference(:lesli_letter_notes, :user, foreign_key: { to_table: :lesli_users })
46
+ add_reference(:lesli_letter_notes, :account, foreign_key: { to_table: :lesli_letter_accounts })
47
+ end
48
+ end
@@ -0,0 +1,53 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ current_user = Lesli::User.first
34
+
35
+ 10.times do |index|
36
+ notebook = current_user.account.letter.notebooks.create!({
37
+ :name => "Demo notebook ##{index}",
38
+ :description => "My printer number #{index} is not working",
39
+ :active => true,
40
+ :user => current_user
41
+ })
42
+
43
+ 25.times do |index|
44
+ notebook.notes.create!({
45
+ :name => "Demo note ##{index}",
46
+ #:type => "",
47
+ :privacy => "private",
48
+ :content => "In the shadowy realms where darkness prevails, a fellowship emerges, forged in the crucible of adversity. Hearts ablaze with courage, swords unsheathed, they embark on an odyssey through perilous lands. Bound by a singular ring and destiny's intertwining threads, they traverse the daunting landscapes of Middle-earth. Each step echoes with the weight of history, a journey marked by sacrifice and valor. Amidst the towering peaks of Mordor, their unwavering unity stands as a beacon against the encroaching night. In this epic tale, even the smallest among them carries the potential to alter the course of history, proving that strength lies not in size but in the bonds forged on the precipice of doom.",
49
+ :user => current_user,
50
+ :account => current_user.account
51
+ })
52
+ end
53
+ end