fontastic 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.eslintrc.json +54 -0
- package/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/dependabot.yml +6 -0
- package/.github/pull_request_template.md +21 -0
- package/.github/stale.yml +17 -0
- package/.github/workflows/macos.yml +58 -0
- package/.github/workflows/ubuntu.yml +70 -0
- package/.github/workflows/windows.yml +64 -0
- package/.node-version +1 -0
- package/.vscode/launch.json +46 -0
- package/.vscode/tasks.json +49 -0
- package/CODE_OF_CONDUCT.md +45 -0
- package/CONTRIBUTING.md +72 -0
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/_config.yml +1 -0
- package/angular.json +194 -0
- package/angular.webpack.js +32 -0
- package/app/Application.js +40 -0
- package/app/Application.ts +38 -0
- package/app/config/alert.ts +32 -0
- package/app/config/database.js +203 -0
- package/app/config/database.ts +202 -0
- package/app/config/index.js +20 -0
- package/app/config/index.ts +3 -0
- package/app/config/mimes.js +49 -0
- package/app/config/mimes.ts +54 -0
- package/app/config/system.js +497 -0
- package/app/config/system.ts +498 -0
- package/app/config/themes.ts +38 -0
- package/app/core/AppLogger.js +31 -0
- package/app/core/AppLogger.ts +38 -0
- package/app/core/ConfigManager.js +114 -0
- package/app/core/ConfigManager.ts +137 -0
- package/app/core/ConnectionManager.js +83 -0
- package/app/core/ConnectionManager.ts +95 -0
- package/app/core/FontCatalog.js +51 -0
- package/app/core/FontCatalog.ts +42 -0
- package/app/core/FontFinder.js +86 -0
- package/app/core/FontFinder.ts +96 -0
- package/app/core/FontInstaller.js +67 -0
- package/app/core/FontInstaller.ts +63 -0
- package/app/core/FontManager.js +165 -0
- package/app/core/FontManager.ts +172 -0
- package/app/core/FontObject.js +54 -0
- package/app/core/FontObject.ts +62 -0
- package/app/core/MessageHandler.js +272 -0
- package/app/core/MessageHandler.ts +337 -0
- package/app/core/SystemManager.js +140 -0
- package/app/core/SystemManager.ts +171 -0
- package/app/core/menu/Example.ts +280 -0
- package/app/core/menu/MenuBuilder.js +45 -0
- package/app/core/menu/MenuBuilder.ts +53 -0
- package/app/core/menu/templates/DarwinTemplate.js +127 -0
- package/app/core/menu/templates/DarwinTemplate.ts +142 -0
- package/app/core/menu/templates/SystemTemplate.js +124 -0
- package/app/core/menu/templates/SystemTemplate.ts +139 -0
- package/app/database/entity/Collection.schema.js +99 -0
- package/app/database/entity/Collection.schema.ts +68 -0
- package/app/database/entity/Logger.schema.js +50 -0
- package/app/database/entity/Logger.schema.ts +26 -0
- package/app/database/entity/Store.schema.js +165 -0
- package/app/database/entity/Store.schema.ts +116 -0
- package/app/database/entity/index.js +20 -0
- package/app/database/entity/index.ts +3 -0
- package/app/database/repository/Collection.repository.js +181 -0
- package/app/database/repository/Collection.repository.ts +190 -0
- package/app/database/repository/Logger.repository.js +25 -0
- package/app/database/repository/Logger.repository.ts +11 -0
- package/app/database/repository/Store.repository.js +328 -0
- package/app/database/repository/Store.repository.ts +358 -0
- package/app/database/repository/User.repository.js +12 -0
- package/app/database/repository/User.repository.ts +8 -0
- package/app/database/repository/index.js +20 -0
- package/app/database/repository/index.ts +3 -0
- package/app/enums/ChannelType.js +62 -0
- package/app/enums/ChannelType.ts +65 -0
- package/app/enums/StorageType.js +19 -0
- package/app/enums/index.js +19 -0
- package/app/enums/index.ts +2 -0
- package/app/enums/storageType.ts +14 -0
- package/app/helpers/command.js +28 -0
- package/app/helpers/command.ts +20 -0
- package/app/helpers/random.js +16 -0
- package/app/helpers/random.ts +12 -0
- package/app/main.js +82 -0
- package/app/main.ts +94 -0
- package/app/package-lock.json +2649 -0
- package/app/package.json +35 -0
- package/app/types/AppAlert.js +3 -0
- package/app/types/AppAlert.ts +8 -0
- package/app/types/AuthUser.js +7 -0
- package/app/types/AuthUser.ts +5 -0
- package/app/types/Breadcrumb.js +3 -0
- package/app/types/Breadcrumb.ts +5 -0
- package/app/types/ImportOptions.js +7 -0
- package/app/types/ImportOptions.ts +3 -0
- package/app/types/QueryOptions.js +3 -0
- package/app/types/QueryOptions.ts +12 -0
- package/app/types/SystemConfig.js +3 -0
- package/app/types/SystemConfig.ts +132 -0
- package/app/types/SystemStats.js +3 -0
- package/app/types/SystemStats.ts +7 -0
- package/app/types/SystemTheme.js +3 -0
- package/app/types/SystemTheme.ts +5 -0
- package/app/types/index.js +25 -0
- package/app/types/index.ts +8 -0
- package/docs/logo.png +0 -0
- package/docs/screenshots/readme.md +7 -0
- package/docs/screenshots/screen-grab1.png +0 -0
- package/docs/screenshots/screen-grab2.png +0 -0
- package/docs/screenshots/screen-grab3.png +0 -0
- package/e2e/main.spec.ts +59 -0
- package/e2e/playwright.config.ts +19 -0
- package/e2e/tsconfig.e2e.json +13 -0
- package/electron-builder.json +71 -0
- package/package.json +121 -0
- package/src/app/app-routing.module.ts +15 -0
- package/src/app/app.component.html +1 -0
- package/src/app/app.component.scss +0 -0
- package/src/app/app.component.spec.ts.dist +33 -0
- package/src/app/app.component.ts +37 -0
- package/src/app/app.module.ts +63 -0
- package/src/app/core/core.module.ts +11 -0
- package/src/app/core/model/AuthUserModel.ts +7 -0
- package/src/app/core/model/CustomThemeModel.ts +7 -0
- package/src/app/core/model/DbConnectionModel.ts +16 -0
- package/src/app/core/model/ImportOptionsModel.ts +5 -0
- package/src/app/core/model/LatestNewsModel.ts +7 -0
- package/src/app/core/model/SearchFormModel.ts +10 -0
- package/src/app/core/model/index.ts +6 -0
- package/src/app/core/services/alert/alert.service.spec.ts +22 -0
- package/src/app/core/services/alert/alert.service.ts +71 -0
- package/src/app/core/services/auth/auth.service.ts +30 -0
- package/src/app/core/services/boot/boot.service.ts +33 -0
- package/src/app/core/services/breadcrumb/breadcrumb.service.spec.ts +22 -0
- package/src/app/core/services/breadcrumb/breadcrumb.service.ts +30 -0
- package/src/app/core/services/config/config.service.ts +63 -0
- package/src/app/core/services/database/database.service.ts +286 -0
- package/src/app/core/services/electron/electron.service.spec.ts +12 -0
- package/src/app/core/services/electron/electron.service.ts +62 -0
- package/src/app/core/services/font/font.service.ts +79 -0
- package/src/app/core/services/gravatar/gravatar.service.spec.ts +16 -0
- package/src/app/core/services/gravatar/gravatar.service.ts +18 -0
- package/src/app/core/services/index.ts +14 -0
- package/src/app/core/services/message/message.service.ts +289 -0
- package/src/app/core/services/modal/modal.service.spec.ts +16 -0
- package/src/app/core/services/modal/modal.service.ts +34 -0
- package/src/app/core/services/news/news.service.ts +94 -0
- package/src/app/core/services/presentation/presentation.service.ts +341 -0
- package/src/app/core/services/utils/utils.service.spec.ts +12 -0
- package/src/app/core/services/utils/utils.service.ts +144 -0
- package/src/app/layout/aside/aside.component.html +9 -0
- package/src/app/layout/aside/aside.component.scss +1 -0
- package/src/app/layout/aside/aside.component.ts +26 -0
- package/src/app/layout/footer/footer.component.html +11 -0
- package/src/app/layout/footer/footer.component.scss +27 -0
- package/src/app/layout/footer/footer.component.ts +32 -0
- package/src/app/layout/header/header.component.html +35 -0
- package/src/app/layout/header/header.component.scss +60 -0
- package/src/app/layout/header/header.component.ts +229 -0
- package/src/app/layout/layout.component.html +14 -0
- package/src/app/layout/layout.component.scss +119 -0
- package/src/app/layout/layout.component.ts +23 -0
- package/src/app/layout/layout.module.ts +32 -0
- package/src/app/layout/layout.service.ts +13 -0
- package/src/app/layout/navigation/navigation.component.html +142 -0
- package/src/app/layout/navigation/navigation.component.scss +0 -0
- package/src/app/layout/navigation/navigation.component.ts +302 -0
- package/src/app/pages/main/grid/grid.component.html +160 -0
- package/src/app/pages/main/grid/grid.component.scss +3 -0
- package/src/app/pages/main/grid/grid.component.ts +98 -0
- package/src/app/pages/main/inspect/inspect.component.html +7 -0
- package/src/app/pages/main/inspect/inspect.component.scss +3 -0
- package/src/app/pages/main/inspect/inspect.component.ts +66 -0
- package/src/app/pages/main/main-routing.module.ts +30 -0
- package/src/app/pages/main/main.component.html +6 -0
- package/src/app/pages/main/main.component.scss +191 -0
- package/src/app/pages/main/main.component.ts +35 -0
- package/src/app/pages/main/main.module.ts +28 -0
- package/src/app/pages/main/preview/preview.component.html +46 -0
- package/src/app/pages/main/preview/preview.component.scss +0 -0
- package/src/app/pages/main/preview/preview.component.ts +239 -0
- package/src/app/pages/main/toolbar/toolbar.component.html +78 -0
- package/src/app/pages/main/toolbar/toolbar.component.scss +3 -0
- package/src/app/pages/main/toolbar/toolbar.component.ts +132 -0
- package/src/app/shared/components/alert/alert.component.html +9 -0
- package/src/app/shared/components/alert/alert.component.scss +0 -0
- package/src/app/shared/components/alert/alert.component.ts +37 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.html +14 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss +0 -0
- package/src/app/shared/components/breadcrumbs/breadcrumbs.component.ts +36 -0
- package/src/app/shared/components/button/button.component.html +3 -0
- package/src/app/shared/components/button/button.component.scss +2 -0
- package/src/app/shared/components/button/button.component.ts +22 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.html +41 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.scss +0 -0
- package/src/app/shared/components/collection/create-collection/create-collection.component.ts +68 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.html +1 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.scss +0 -0
- package/src/app/shared/components/collection/form-collection/form-collection.component.ts +15 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.html +40 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.scss +0 -0
- package/src/app/shared/components/collection/update-collection/update-collection.component.ts +71 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.html +40 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.scss +1 -0
- package/src/app/shared/components/glyph-list/glyph-list.component.ts +165 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.html +23 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.scss +0 -0
- package/src/app/shared/components/glyph-view/glyph-view.component.ts +228 -0
- package/src/app/shared/components/index.ts +16 -0
- package/src/app/shared/components/loading/loading.component.html +1 -0
- package/src/app/shared/components/loading/loading.component.scss +0 -0
- package/src/app/shared/components/loading/loading.component.ts +26 -0
- package/src/app/shared/components/modal/modal.component.html +31 -0
- package/src/app/shared/components/modal/modal.component.scss +0 -0
- package/src/app/shared/components/modal/modal.component.ts +51 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.html +3 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.scss +0 -0
- package/src/app/shared/components/page-not-found/page-not-found.component.ts +12 -0
- package/src/app/shared/components/paginator/paginator.component.html +21 -0
- package/src/app/shared/components/paginator/paginator.component.scss +3 -0
- package/src/app/shared/components/paginator/paginator.component.ts +133 -0
- package/src/app/shared/components/pairing/pairing.component.html +20 -0
- package/src/app/shared/components/pairing/pairing.component.scss +0 -0
- package/src/app/shared/components/pairing/pairing.component.ts +33 -0
- package/src/app/shared/components/search/search.component.html +54 -0
- package/src/app/shared/components/search/search.component.scss +10 -0
- package/src/app/shared/components/search/search.component.ts +77 -0
- package/src/app/shared/components/settings/database/database.component.html +151 -0
- package/src/app/shared/components/settings/database/database.component.scss +0 -0
- package/src/app/shared/components/settings/database/database.component.ts +145 -0
- package/src/app/shared/components/settings/general/general.component.html +170 -0
- package/src/app/shared/components/settings/general/general.component.scss +0 -0
- package/src/app/shared/components/settings/general/general.component.ts +150 -0
- package/src/app/shared/components/settings/logs/logs.component.html +44 -0
- package/src/app/shared/components/settings/logs/logs.component.scss +0 -0
- package/src/app/shared/components/settings/logs/logs.component.ts +37 -0
- package/src/app/shared/components/settings/news/news.component.html +41 -0
- package/src/app/shared/components/settings/news/news.component.scss +0 -0
- package/src/app/shared/components/settings/news/news.component.ts +52 -0
- package/src/app/shared/components/settings/settings.component.html +46 -0
- package/src/app/shared/components/settings/settings.component.scss +0 -0
- package/src/app/shared/components/settings/settings.component.ts +23 -0
- package/src/app/shared/components/settings/system/system.component.html +30 -0
- package/src/app/shared/components/settings/system/system.component.scss +0 -0
- package/src/app/shared/components/settings/system/system.component.ts +43 -0
- package/src/app/shared/components/settings/theme/theme.component.html +22 -0
- package/src/app/shared/components/settings/theme/theme.component.scss +0 -0
- package/src/app/shared/components/settings/theme/theme.component.ts +50 -0
- package/src/app/shared/components/spinner/spinner.component.html +1 -0
- package/src/app/shared/components/spinner/spinner.component.scss +0 -0
- package/src/app/shared/components/spinner/spinner.component.ts +26 -0
- package/src/app/shared/components/store/store.component.html +22 -0
- package/src/app/shared/components/store/store.component.scss +10 -0
- package/src/app/shared/components/store/store.component.ts +58 -0
- package/src/app/shared/components/tables/tables.component.html +47 -0
- package/src/app/shared/components/tables/tables.component.scss +10 -0
- package/src/app/shared/components/tables/tables.component.ts +81 -0
- package/src/app/shared/components/typescale/typescale.component.html +53 -0
- package/src/app/shared/components/typescale/typescale.component.scss +0 -0
- package/src/app/shared/components/typescale/typescale.component.ts +168 -0
- package/src/app/shared/directives/gravatar/gravatar.directive.ts +29 -0
- package/src/app/shared/directives/index.ts +2 -0
- package/src/app/shared/directives/webview/webview.directive.ts +8 -0
- package/src/app/shared/pipes/installable.pipe.ts +10 -0
- package/src/app/shared/pipes/prettybytes.pipe.ts +10 -0
- package/src/app/shared/pipes/safehtml.pipe.ts +10 -0
- package/src/app/shared/shared.module.ts +92 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/fonts/fa/fa-brands-400.eot +0 -0
- package/src/assets/fonts/fa/fa-brands-400.svg +3535 -0
- package/src/assets/fonts/fa/fa-brands-400.ttf +0 -0
- package/src/assets/fonts/fa/fa-brands-400.woff +0 -0
- package/src/assets/fonts/fa/fa-brands-400.woff2 +0 -0
- package/src/assets/fonts/fa/fa-regular-400.eot +0 -0
- package/src/assets/fonts/fa/fa-regular-400.svg +803 -0
- package/src/assets/fonts/fa/fa-regular-400.ttf +0 -0
- package/src/assets/fonts/fa/fa-regular-400.woff +0 -0
- package/src/assets/fonts/fa/fa-regular-400.woff2 +0 -0
- package/src/assets/fonts/fa/fa-solid-900.eot +0 -0
- package/src/assets/fonts/fa/fa-solid-900.svg +4700 -0
- package/src/assets/fonts/fa/fa-solid-900.ttf +0 -0
- package/src/assets/fonts/fa/fa-solid-900.woff +0 -0
- package/src/assets/fonts/fa/fa-solid-900.woff2 +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.eot +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.ijmap +1 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.svg +2373 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.ttf +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.woff +0 -0
- package/src/assets/fonts/md/MaterialIcons-Regular.woff2 +0 -0
- package/src/assets/fonts/md/README.md +9 -0
- package/src/assets/fonts/md/codepoints +932 -0
- package/src/assets/fonts/md/material-icons.css +36 -0
- package/src/assets/fonts/octicon/octicon.eot +0 -0
- package/src/assets/fonts/octicon/octicon.svg +378 -0
- package/src/assets/fonts/octicon/octicon.ttf +0 -0
- package/src/assets/fonts/octicon/octicon.woff +0 -0
- package/src/assets/fonts/octicon/octicon.woff2 +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.svg +607 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Bold-webfont.woff +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.svg +607 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Medium-webfont.woff +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.eot +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.svg +635 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.ttf +0 -0
- package/src/assets/fonts/roboto/Roboto-Regular-webfont.woff +0 -0
- package/src/assets/i18n/en.json +12 -0
- package/src/assets/icons/android-chrome-192x192.png +0 -0
- package/src/assets/icons/android-chrome-512x512.png +0 -0
- package/src/assets/icons/apple-touch-icon.png +0 -0
- package/src/assets/icons/favicon-16x16.png +0 -0
- package/src/assets/icons/favicon-32x32.png +0 -0
- package/src/assets/icons/favicon.ico +0 -0
- package/src/assets/icons/site.webmanifest +1 -0
- package/src/assets/images/electron.bmp +0 -0
- package/src/bin/activator +0 -0
- package/src/bin/activator.exe +0 -0
- package/src/environments/environment.dev.ts +4 -0
- package/src/environments/environment.prod.ts +4 -0
- package/src/environments/environment.ts +4 -0
- package/src/environments/environment.web.prod.ts +4 -0
- package/src/environments/environment.web.ts +4 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +55 -0
- package/src/karma.conf.js +50 -0
- package/src/main.ts +15 -0
- package/src/polyfills-test.ts +1 -0
- package/src/polyfills.ts +53 -0
- package/src/styles/base/loading.scss +87 -0
- package/src/styles/base/reset.scss +408 -0
- package/src/styles/components/alert.scss +54 -0
- package/src/styles/components/buttons.scss +93 -0
- package/src/styles/components/forms.scss +96 -0
- package/src/styles/components/inputs.scss +113 -0
- package/src/styles/components/modal.scss +52 -0
- package/src/styles/components/paginator.scss +108 -0
- package/src/styles/components/scrollbox.scss +71 -0
- package/src/styles/components/spinner.scss +11 -0
- package/src/styles/components/tables.scss +42 -0
- package/src/styles/components/tabs.scss +44 -0
- package/src/styles/components/toolbar.scss +130 -0
- package/src/styles/fonts/md.scss +54 -0
- package/src/styles/fonts/octicons.scss +1351 -0
- package/src/styles/fonts/roboto.scss +32 -0
- package/src/styles/themes/dashboard.scss +294 -0
- package/src/styles/themes/euphoria.scss +283 -0
- package/src/styles/themes/mellow.scss +280 -0
- package/src/styles/themes/midnight.scss +283 -0
- package/src/styles/themes/passion.scss +280 -0
- package/src/styles/themes/swiss.scss +283 -0
- package/src/styles/tools/_functions.scss +5 -0
- package/src/styles/tools/_mixins.scss +159 -0
- package/src/styles/tools/_placeholders.scss +17 -0
- package/src/styles/tools/_variables.scss +67 -0
- package/src/styles.scss +37 -0
- package/src/test.ts +22 -0
- package/src/tsconfig.app.json +20 -0
- package/src/tsconfig.spec.json +23 -0
- package/src/typings.d.ts +9 -0
- package/tailwind.config.js +67 -0
- package/tsconfig.json +42 -0
- package/tsconfig.serve.json +27 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Logger = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
let Logger = class Logger {
|
|
15
|
+
};
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
18
|
+
__metadata("design:type", Number)
|
|
19
|
+
], Logger.prototype, "id", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.Column)('text'),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], Logger.prototype, "message", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({
|
|
26
|
+
type: "tinyint",
|
|
27
|
+
default: 0
|
|
28
|
+
}),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], Logger.prototype, "type", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({
|
|
33
|
+
type: "tinyint",
|
|
34
|
+
default: 0
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], Logger.prototype, "status", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
40
|
+
__metadata("design:type", Date)
|
|
41
|
+
], Logger.prototype, "created", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
44
|
+
__metadata("design:type", Date)
|
|
45
|
+
], Logger.prototype, "updated", void 0);
|
|
46
|
+
Logger = __decorate([
|
|
47
|
+
(0, typeorm_1.Entity)()
|
|
48
|
+
], Logger);
|
|
49
|
+
exports.Logger = Logger;
|
|
50
|
+
//# sourceMappingURL=Logger.schema.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from "typeorm";
|
|
2
|
+
|
|
3
|
+
@Entity()
|
|
4
|
+
export class Logger {
|
|
5
|
+
|
|
6
|
+
@PrimaryGeneratedColumn()
|
|
7
|
+
id: number;
|
|
8
|
+
|
|
9
|
+
@Column('text')
|
|
10
|
+
message: string;
|
|
11
|
+
|
|
12
|
+
@Column({
|
|
13
|
+
type: "tinyint",
|
|
14
|
+
default: 0
|
|
15
|
+
})
|
|
16
|
+
type: number;
|
|
17
|
+
|
|
18
|
+
@Column({
|
|
19
|
+
type: "tinyint",
|
|
20
|
+
default: 0
|
|
21
|
+
})
|
|
22
|
+
status: number;
|
|
23
|
+
|
|
24
|
+
@CreateDateColumn() public created: Date;
|
|
25
|
+
@UpdateDateColumn() public updated: Date;
|
|
26
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Store = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Collection_schema_1 = require("./Collection.schema");
|
|
15
|
+
let Store = class Store {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
19
|
+
__metadata("design:type", Number)
|
|
20
|
+
], Store.prototype, "id", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.Column)("int"),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], Store.prototype, "collection_id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, default: "", nullable: true }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Store.prototype, "file_name", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Store.prototype, "file_path", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: "int", default: 0, nullable: true }),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], Store.prototype, "file_size", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], Store.prototype, "file_size_pretty", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], Store.prototype, "file_type", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: "smallint", default: 0, nullable: true }),
|
|
47
|
+
(0, typeorm_1.Index)(),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], Store.prototype, "installable", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ type: "smallint", default: 0, nullable: true }),
|
|
52
|
+
(0, typeorm_1.Index)(),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], Store.prototype, "activated", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ type: "smallint", default: 0, nullable: true }),
|
|
57
|
+
(0, typeorm_1.Index)(),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], Store.prototype, "temporary", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ type: "smallint", default: 0, nullable: true }),
|
|
62
|
+
(0, typeorm_1.Index)(),
|
|
63
|
+
__metadata("design:type", Number)
|
|
64
|
+
], Store.prototype, "favorite", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ type: "smallint", default: 0, nullable: true }),
|
|
67
|
+
(0, typeorm_1.Index)(),
|
|
68
|
+
__metadata("design:type", Number)
|
|
69
|
+
], Store.prototype, "system", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], Store.prototype, "compatible_full_name", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], Store.prototype, "copyright", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], Store.prototype, "description", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], Store.prototype, "designer", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], Store.prototype, "designer_url", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], Store.prototype, "font_family", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], Store.prototype, "font_subfamily", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], Store.prototype, "full_name", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], Store.prototype, "license", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
108
|
+
__metadata("design:type", String)
|
|
109
|
+
], Store.prototype, "license_url", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
112
|
+
__metadata("design:type", String)
|
|
113
|
+
], Store.prototype, "manufacturer", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
116
|
+
__metadata("design:type", String)
|
|
117
|
+
], Store.prototype, "manufacturer_url", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
120
|
+
__metadata("design:type", String)
|
|
121
|
+
], Store.prototype, "post_script_name", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
124
|
+
__metadata("design:type", String)
|
|
125
|
+
], Store.prototype, "preferred_family", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
128
|
+
__metadata("design:type", String)
|
|
129
|
+
], Store.prototype, "preferred_sub_family", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
132
|
+
__metadata("design:type", String)
|
|
133
|
+
], Store.prototype, "sample_text", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], Store.prototype, "trademark", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
140
|
+
__metadata("design:type", String)
|
|
141
|
+
], Store.prototype, "unique_id", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
144
|
+
__metadata("design:type", String)
|
|
145
|
+
], Store.prototype, "version", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
148
|
+
__metadata("design:type", Date)
|
|
149
|
+
], Store.prototype, "created", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
152
|
+
__metadata("design:type", Date)
|
|
153
|
+
], Store.prototype, "updated", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, typeorm_1.ManyToOne)(() => Collection_schema_1.Collection, (model) => model.stores, {
|
|
156
|
+
onDelete: 'CASCADE'
|
|
157
|
+
}),
|
|
158
|
+
(0, typeorm_1.JoinColumn)({ name: "collection_id" }),
|
|
159
|
+
__metadata("design:type", Collection_schema_1.Collection)
|
|
160
|
+
], Store.prototype, "collection", void 0);
|
|
161
|
+
Store = __decorate([
|
|
162
|
+
(0, typeorm_1.Entity)()
|
|
163
|
+
], Store);
|
|
164
|
+
exports.Store = Store;
|
|
165
|
+
//# sourceMappingURL=Store.schema.js.map
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, Index, ManyToOne, JoinColumn } from "typeorm";
|
|
2
|
+
import { Collection } from "./Collection.schema"
|
|
3
|
+
|
|
4
|
+
export type StoreManyAndCountType = Array<Store[] | number>;
|
|
5
|
+
|
|
6
|
+
@Entity()
|
|
7
|
+
export class Store {
|
|
8
|
+
|
|
9
|
+
@PrimaryGeneratedColumn()
|
|
10
|
+
id: number;
|
|
11
|
+
|
|
12
|
+
@Column("int")
|
|
13
|
+
collection_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: "varchar", length: 255, default: "", nullable: true })
|
|
16
|
+
file_name: string;
|
|
17
|
+
|
|
18
|
+
@Column({ type: "text", nullable: true })
|
|
19
|
+
file_path: string;
|
|
20
|
+
|
|
21
|
+
@Column({ type: "int", default: 0, nullable: true })
|
|
22
|
+
file_size: number;
|
|
23
|
+
|
|
24
|
+
@Column({ type: "text", nullable: true })
|
|
25
|
+
file_size_pretty: string;
|
|
26
|
+
|
|
27
|
+
@Column({ type: "text", nullable: true })
|
|
28
|
+
file_type: string;
|
|
29
|
+
|
|
30
|
+
@Column({ type: "smallint", default: 0, nullable: true })
|
|
31
|
+
@Index()
|
|
32
|
+
installable: number;
|
|
33
|
+
|
|
34
|
+
@Column({ type: "smallint", default: 0, nullable: true })
|
|
35
|
+
@Index()
|
|
36
|
+
activated: number;
|
|
37
|
+
|
|
38
|
+
@Column({ type: "smallint", default: 0, nullable: true })
|
|
39
|
+
@Index()
|
|
40
|
+
temporary: number;
|
|
41
|
+
|
|
42
|
+
@Column({ type: "smallint", default: 0, nullable: true })
|
|
43
|
+
@Index()
|
|
44
|
+
favorite: number;
|
|
45
|
+
|
|
46
|
+
@Column({ type: "smallint", default: 0, nullable: true })
|
|
47
|
+
@Index()
|
|
48
|
+
system: number;
|
|
49
|
+
|
|
50
|
+
@Column({ type: "text", nullable: true })
|
|
51
|
+
compatible_full_name: string;
|
|
52
|
+
|
|
53
|
+
@Column({ type: "text", nullable: true })
|
|
54
|
+
copyright: string;
|
|
55
|
+
|
|
56
|
+
@Column({ type: "text", nullable: true })
|
|
57
|
+
description: string;
|
|
58
|
+
|
|
59
|
+
@Column({ type: "text", nullable: true })
|
|
60
|
+
designer: string;
|
|
61
|
+
|
|
62
|
+
@Column({ type: "text", nullable: true })
|
|
63
|
+
designer_url: string;
|
|
64
|
+
|
|
65
|
+
@Column({ type: "text", nullable: true })
|
|
66
|
+
font_family: string;
|
|
67
|
+
|
|
68
|
+
@Column({ type: "text", nullable: true })
|
|
69
|
+
font_subfamily: string;
|
|
70
|
+
|
|
71
|
+
@Column({ type: "text", nullable: true })
|
|
72
|
+
full_name: string;
|
|
73
|
+
|
|
74
|
+
@Column({ type: "text", nullable: true })
|
|
75
|
+
license: string;
|
|
76
|
+
|
|
77
|
+
@Column({ type: "text", nullable: true })
|
|
78
|
+
license_url: string;
|
|
79
|
+
|
|
80
|
+
@Column({ type: "text", nullable: true })
|
|
81
|
+
manufacturer: string;
|
|
82
|
+
|
|
83
|
+
@Column({ type: "text", nullable: true })
|
|
84
|
+
manufacturer_url: string;
|
|
85
|
+
|
|
86
|
+
@Column({ type: "text", nullable: true })
|
|
87
|
+
post_script_name: string;
|
|
88
|
+
|
|
89
|
+
@Column({ type: "text", nullable: true })
|
|
90
|
+
preferred_family: string;
|
|
91
|
+
|
|
92
|
+
@Column({ type: "text", nullable: true })
|
|
93
|
+
preferred_sub_family: string;
|
|
94
|
+
|
|
95
|
+
@Column({ type: "text", nullable: true })
|
|
96
|
+
sample_text: string;
|
|
97
|
+
|
|
98
|
+
@Column({ type: "text", nullable: true })
|
|
99
|
+
trademark: string;
|
|
100
|
+
|
|
101
|
+
@Column({ type: "text", nullable: true })
|
|
102
|
+
unique_id: string;
|
|
103
|
+
|
|
104
|
+
@Column({ type: "text", nullable: true })
|
|
105
|
+
version: string;
|
|
106
|
+
|
|
107
|
+
@CreateDateColumn() public created: Date;
|
|
108
|
+
@UpdateDateColumn() public updated: Date;
|
|
109
|
+
|
|
110
|
+
@ManyToOne(() => Collection, (model) => model.stores, {
|
|
111
|
+
onDelete: 'CASCADE'
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
@JoinColumn({ name: "collection_id" })
|
|
115
|
+
collection: Collection;
|
|
116
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Collection.schema"), exports);
|
|
18
|
+
__exportStar(require("./Logger.schema"), exports);
|
|
19
|
+
__exportStar(require("./Store.schema"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CollectionRepository = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const entity_1 = require("../entity");
|
|
15
|
+
exports.CollectionRepository = {
|
|
16
|
+
fetchCollectionsWithCounts(args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const db = this.createQueryBuilder("collection");
|
|
19
|
+
db.where("collection.is_system = 0");
|
|
20
|
+
db.leftJoinAndSelect("collection.stores", "store");
|
|
21
|
+
// db.leftJoin("collection.stores", "store")
|
|
22
|
+
db.loadRelationCountAndMap('store.storeCount', 'collection.stores'); // correct
|
|
23
|
+
db.loadRelationCountAndMap('store.installableCount', 'collection.stores', "store", (qb) => qb.andWhere("store.installable = :placeholder", {
|
|
24
|
+
placeholder: true,
|
|
25
|
+
}));
|
|
26
|
+
db.loadRelationCountAndMap('store.activatedCount', 'collection.stores', "store", (qb) => qb.andWhere("store.activated = :placeholder", {
|
|
27
|
+
placeholder: true,
|
|
28
|
+
}));
|
|
29
|
+
db.loadRelationCountAndMap('store.temporaryCount', 'collection.stores', "store", (qb) => qb.andWhere("store.temporary = :placeholder", {
|
|
30
|
+
placeholder: true,
|
|
31
|
+
}));
|
|
32
|
+
db.loadRelationCountAndMap('store.favoriteCount', 'collection.stores', "store", (qb) => qb.andWhere("store.favorite = :placeholder", {
|
|
33
|
+
placeholder: true,
|
|
34
|
+
}));
|
|
35
|
+
db.orderBy(`LOWER(collection.title)`, 'ASC');
|
|
36
|
+
return yield db.getMany();
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
deleteCollection(collectionId) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const row = yield this.findOne({ where: { id: collectionId } });
|
|
42
|
+
// Item cannot be found.
|
|
43
|
+
if (!row)
|
|
44
|
+
return;
|
|
45
|
+
const children = yield this.fetchChildren(row, false, true);
|
|
46
|
+
// const parents = await this.fetchParents(row);
|
|
47
|
+
// Item has children cannot be deleted.
|
|
48
|
+
if (children.length)
|
|
49
|
+
return;
|
|
50
|
+
// Delete row.
|
|
51
|
+
yield this.createQueryBuilder().delete().where("id = :id", { id: collectionId }).execute();
|
|
52
|
+
// Shift right node.
|
|
53
|
+
yield this.createQueryBuilder().update(entity_1.Collection)
|
|
54
|
+
.set({ right_id: () => "right_id - 2" })
|
|
55
|
+
.where({ left_id: (0, typeorm_1.LessThan)(row.right_id), right_id: (0, typeorm_1.MoreThan)(row.right_id) })
|
|
56
|
+
.execute();
|
|
57
|
+
// Shift left + right nodes.
|
|
58
|
+
yield this.createQueryBuilder().update(entity_1.Collection)
|
|
59
|
+
.set({ left_id: () => "left_id - 2", right_id: () => "right_id - 2" })
|
|
60
|
+
.where({ left_id: (0, typeorm_1.MoreThan)(row.right_id) })
|
|
61
|
+
.execute();
|
|
62
|
+
return children;
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
updateCollectionCount(collectionId, total) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return this.createQueryBuilder().update(entity_1.Collection)
|
|
68
|
+
.set({ count: total })
|
|
69
|
+
.where("id = :id", { id: collectionId })
|
|
70
|
+
.execute();
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
updateCollectionCounts(items) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
return items.forEach((item) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
return yield this.createQueryBuilder()
|
|
77
|
+
.update(entity_1.Collection)
|
|
78
|
+
.set({ count: item.total })
|
|
79
|
+
.where("id = :id", { id: item.collection_id })
|
|
80
|
+
.execute();
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
updateCollection(collectionId, data) {
|
|
85
|
+
return this.createQueryBuilder().update(entity_1.Collection)
|
|
86
|
+
.set(data)
|
|
87
|
+
.where("id = :id", { id: collectionId })
|
|
88
|
+
.execute();
|
|
89
|
+
},
|
|
90
|
+
updateCollectionIds(ids, options) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return yield this.createQueryBuilder()
|
|
93
|
+
.update(entity_1.Collection)
|
|
94
|
+
.set(options)
|
|
95
|
+
.where("collection.id IN (:...ids)", { ids })
|
|
96
|
+
.execute();
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
resetEnabled() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
return this.createQueryBuilder().update(entity_1.Collection)
|
|
102
|
+
.set({ enabled: 0 })
|
|
103
|
+
.execute();
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
createCollection(args) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
return (args === null || args === void 0 ? void 0 : args.parentId) ? yield this.createChild(args.parentId, args.title) : yield this.createParent(args.title);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
fetchParents(row, target, entities) {
|
|
112
|
+
let conditionA = (target) ? (0, typeorm_1.MoreThanOrEqual)(row.right_id) : (0, typeorm_1.MoreThan)(row.right_id);
|
|
113
|
+
let conditionB = (target) ? (0, typeorm_1.LessThanOrEqual)(row.left_id) : (0, typeorm_1.LessThan)(row.left_id);
|
|
114
|
+
let columns = (entities) ? ["collection.*"] : ["collection.id", "id"];
|
|
115
|
+
return this.createQueryBuilder()
|
|
116
|
+
.select(columns)
|
|
117
|
+
.where({ right_id: conditionA, left_id: conditionB })
|
|
118
|
+
.getRawMany();
|
|
119
|
+
},
|
|
120
|
+
fetchChildren(row, target, entities) {
|
|
121
|
+
let conditionA = (target) ? (0, typeorm_1.LessThanOrEqual)(row.right_id) : (0, typeorm_1.LessThan)(row.right_id);
|
|
122
|
+
let conditionB = (target) ? (0, typeorm_1.MoreThanOrEqual)(row.left_id) : (0, typeorm_1.MoreThan)(row.left_id);
|
|
123
|
+
let columns = (entities) ? ["collection.*"] : ["collection.id", "id"];
|
|
124
|
+
return this.createQueryBuilder()
|
|
125
|
+
.select(columns)
|
|
126
|
+
.where({ right_id: conditionA, left_id: conditionB })
|
|
127
|
+
.getRawMany();
|
|
128
|
+
},
|
|
129
|
+
createParent(title) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const data = yield this.createQueryBuilder()
|
|
132
|
+
.select("MAX(collection.right_id)", "right_id")
|
|
133
|
+
.addSelect("MAX(collection.orderby)", "orderby")
|
|
134
|
+
.getRawOne();
|
|
135
|
+
return yield this.createQueryBuilder().insert().into(entity_1.Collection).values({
|
|
136
|
+
title: title,
|
|
137
|
+
parent_id: 0,
|
|
138
|
+
left_id: data.right_id + 1,
|
|
139
|
+
right_id: data.right_id + 2,
|
|
140
|
+
orderby: data.orderby + 1
|
|
141
|
+
}).execute();
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
createChild(parentId, title) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const row = yield this.findOne({ where: { id: parentId } });
|
|
147
|
+
this.createQueryBuilder().update(entity_1.Collection)
|
|
148
|
+
.set({ left_id: () => "left_id + 2", right_id: () => "right_id + 2" })
|
|
149
|
+
.where({ left_id: (0, typeorm_1.MoreThan)(row.right_id) })
|
|
150
|
+
.execute();
|
|
151
|
+
this.createQueryBuilder().update(entity_1.Collection)
|
|
152
|
+
.set({ right_id: () => "right_id + 2" })
|
|
153
|
+
.where({ left_id: (0, typeorm_1.LessThanOrEqual)(row.left_id), right_id: (0, typeorm_1.MoreThanOrEqual)(row.left_id) })
|
|
154
|
+
.execute();
|
|
155
|
+
return yield this.createQueryBuilder().insert().into(entity_1.Collection).values({
|
|
156
|
+
title: title,
|
|
157
|
+
parent_id: parentId,
|
|
158
|
+
left_id: row.right_id,
|
|
159
|
+
right_id: row.right_id + 1,
|
|
160
|
+
orderby: row.orderby + 1
|
|
161
|
+
}).execute();
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
createSystemCollection() {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const data = yield this.createQueryBuilder()
|
|
167
|
+
.select("MAX(collection.right_id)", "right_id")
|
|
168
|
+
.addSelect("MAX(collection.orderby)", "orderby")
|
|
169
|
+
.getRawOne();
|
|
170
|
+
return yield this.createQueryBuilder().insert().into(entity_1.Collection).values({
|
|
171
|
+
title: 'System Fonts',
|
|
172
|
+
parent_id: 0,
|
|
173
|
+
is_system: 1,
|
|
174
|
+
left_id: data.right_id + 1,
|
|
175
|
+
right_id: data.right_id + 2,
|
|
176
|
+
orderby: data.orderby + 1
|
|
177
|
+
}).execute();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=Collection.repository.js.map
|