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,190 @@
|
|
|
1
|
+
import { LessThanOrEqual, MoreThanOrEqual, MoreThan, LessThan } from "typeorm";
|
|
2
|
+
import { Collection } from "../entity"
|
|
3
|
+
|
|
4
|
+
export const CollectionRepository = {
|
|
5
|
+
|
|
6
|
+
async fetchCollectionsWithCounts(args: any): Promise<Collection[]> {
|
|
7
|
+
const db = this.createQueryBuilder("collection");
|
|
8
|
+
|
|
9
|
+
db.where("collection.is_system = 0");
|
|
10
|
+
|
|
11
|
+
db.leftJoinAndSelect("collection.stores", "store");
|
|
12
|
+
// db.leftJoin("collection.stores", "store")
|
|
13
|
+
|
|
14
|
+
db.loadRelationCountAndMap('store.storeCount', 'collection.stores'); // correct
|
|
15
|
+
|
|
16
|
+
db.loadRelationCountAndMap('store.installableCount', 'collection.stores', "store", (qb: any) =>
|
|
17
|
+
qb.andWhere("store.installable = :placeholder", {
|
|
18
|
+
placeholder: true,
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
db.loadRelationCountAndMap('store.activatedCount', 'collection.stores', "store", (qb: any) =>
|
|
23
|
+
qb.andWhere("store.activated = :placeholder", {
|
|
24
|
+
placeholder: true,
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
db.loadRelationCountAndMap('store.temporaryCount', 'collection.stores', "store", (qb: any) =>
|
|
29
|
+
qb.andWhere("store.temporary = :placeholder", {
|
|
30
|
+
placeholder: true,
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
db.loadRelationCountAndMap('store.favoriteCount', 'collection.stores', "store", (qb: any) =>
|
|
35
|
+
qb.andWhere("store.favorite = :placeholder", {
|
|
36
|
+
placeholder: true,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
db.orderBy(`LOWER(collection.title)`, 'ASC');
|
|
41
|
+
|
|
42
|
+
return await db.getMany();
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
async deleteCollection(collectionId: number) {
|
|
46
|
+
|
|
47
|
+
const row = await this.findOne({ where: { id: collectionId } });
|
|
48
|
+
|
|
49
|
+
// Item cannot be found.
|
|
50
|
+
if (!row) return;
|
|
51
|
+
|
|
52
|
+
const children = await this.fetchChildren(row, false, true);
|
|
53
|
+
// const parents = await this.fetchParents(row);
|
|
54
|
+
|
|
55
|
+
// Item has children cannot be deleted.
|
|
56
|
+
if (children.length) return;
|
|
57
|
+
|
|
58
|
+
// Delete row.
|
|
59
|
+
await this.createQueryBuilder().delete().where("id = :id", { id: collectionId }).execute();
|
|
60
|
+
|
|
61
|
+
// Shift right node.
|
|
62
|
+
await this.createQueryBuilder().update(Collection)
|
|
63
|
+
.set({ right_id: () => "right_id - 2" })
|
|
64
|
+
.where({ left_id: LessThan(row.right_id), right_id: MoreThan(row.right_id) })
|
|
65
|
+
.execute();
|
|
66
|
+
|
|
67
|
+
// Shift left + right nodes.
|
|
68
|
+
await this.createQueryBuilder().update(Collection)
|
|
69
|
+
.set({ left_id: () => "left_id - 2", right_id: () => "right_id - 2" })
|
|
70
|
+
.where({ left_id: MoreThan(row.right_id) })
|
|
71
|
+
.execute();
|
|
72
|
+
|
|
73
|
+
return children;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
async updateCollectionCount(collectionId: number, total: number) {
|
|
77
|
+
return this.createQueryBuilder().update(Collection)
|
|
78
|
+
.set({ count: total })
|
|
79
|
+
.where("id = :id", { id: collectionId })
|
|
80
|
+
.execute();
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
async updateCollectionCounts(items: any[]) {
|
|
84
|
+
return items.forEach(async item => {
|
|
85
|
+
return await this.createQueryBuilder()
|
|
86
|
+
.update(Collection)
|
|
87
|
+
.set({ count: item.total })
|
|
88
|
+
.where("id = :id", { id: item.collection_id })
|
|
89
|
+
.execute();
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
updateCollection(collectionId: number, data: any) {
|
|
94
|
+
return this.createQueryBuilder().update(Collection)
|
|
95
|
+
.set(data)
|
|
96
|
+
.where("id = :id", { id: collectionId })
|
|
97
|
+
.execute();
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
async updateCollectionIds(ids: any[], options: any) {
|
|
101
|
+
return await this.createQueryBuilder()
|
|
102
|
+
.update(Collection)
|
|
103
|
+
.set(options)
|
|
104
|
+
.where("collection.id IN (:...ids)", { ids })
|
|
105
|
+
.execute();
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
async resetEnabled() {
|
|
109
|
+
return this.createQueryBuilder().update(Collection)
|
|
110
|
+
.set({ enabled: 0 })
|
|
111
|
+
.execute();
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
async createCollection(args: any) {
|
|
115
|
+
return (args?.parentId) ? await this.createChild(args.parentId, args.title) : await this.createParent(args.title);
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
fetchParents(row: Collection, target?: boolean, entities?: boolean) {
|
|
119
|
+
let conditionA = (target) ? MoreThanOrEqual(row.right_id) : MoreThan(row.right_id);
|
|
120
|
+
let conditionB = (target) ? LessThanOrEqual(row.left_id) : LessThan(row.left_id);
|
|
121
|
+
let columns = (entities) ? ["collection.*"] : ["collection.id", "id"];
|
|
122
|
+
return this.createQueryBuilder()
|
|
123
|
+
.select(columns)
|
|
124
|
+
.where({ right_id: conditionA, left_id: conditionB })
|
|
125
|
+
.getRawMany();
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
fetchChildren(row: Collection, target?: boolean, entities?: boolean) {
|
|
129
|
+
let conditionA = (target) ? LessThanOrEqual(row.right_id) : LessThan(row.right_id);
|
|
130
|
+
let conditionB = (target) ? MoreThanOrEqual(row.left_id) : MoreThan(row.left_id);
|
|
131
|
+
let columns = (entities) ? ["collection.*"] : ["collection.id", "id"];
|
|
132
|
+
return this.createQueryBuilder()
|
|
133
|
+
.select(columns)
|
|
134
|
+
.where({ right_id: conditionA, left_id: conditionB })
|
|
135
|
+
.getRawMany();
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
async createParent(title: string) {
|
|
139
|
+
const data = await this.createQueryBuilder()
|
|
140
|
+
.select("MAX(collection.right_id)", "right_id")
|
|
141
|
+
.addSelect("MAX(collection.orderby)", "orderby")
|
|
142
|
+
.getRawOne();
|
|
143
|
+
|
|
144
|
+
return await this.createQueryBuilder().insert().into(Collection).values({
|
|
145
|
+
title: title,
|
|
146
|
+
parent_id: 0,
|
|
147
|
+
left_id: data.right_id + 1,
|
|
148
|
+
right_id: data.right_id + 2,
|
|
149
|
+
orderby: data.orderby + 1
|
|
150
|
+
}).execute();
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
async createChild(parentId: number, title: string) {
|
|
154
|
+
const row = await this.findOne({ where: { id: parentId } });
|
|
155
|
+
|
|
156
|
+
this.createQueryBuilder().update(Collection)
|
|
157
|
+
.set({ left_id: () => "left_id + 2", right_id: () => "right_id + 2" })
|
|
158
|
+
.where({ left_id: MoreThan(row.right_id) })
|
|
159
|
+
.execute();
|
|
160
|
+
|
|
161
|
+
this.createQueryBuilder().update(Collection)
|
|
162
|
+
.set({ right_id: () => "right_id + 2" })
|
|
163
|
+
.where({ left_id: LessThanOrEqual(row.left_id), right_id: MoreThanOrEqual(row.left_id) })
|
|
164
|
+
.execute();
|
|
165
|
+
|
|
166
|
+
return await this.createQueryBuilder().insert().into(Collection).values({
|
|
167
|
+
title: title,
|
|
168
|
+
parent_id: parentId,
|
|
169
|
+
left_id: row.right_id,
|
|
170
|
+
right_id: row.right_id + 1,
|
|
171
|
+
orderby: row.orderby + 1
|
|
172
|
+
}).execute();
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
async createSystemCollection() {
|
|
176
|
+
const data = await this.createQueryBuilder()
|
|
177
|
+
.select("MAX(collection.right_id)", "right_id")
|
|
178
|
+
.addSelect("MAX(collection.orderby)", "orderby")
|
|
179
|
+
.getRawOne();
|
|
180
|
+
|
|
181
|
+
return await this.createQueryBuilder().insert().into(Collection).values({
|
|
182
|
+
title: 'System Fonts',
|
|
183
|
+
parent_id: 0,
|
|
184
|
+
is_system: 1,
|
|
185
|
+
left_id: data.right_id + 1,
|
|
186
|
+
right_id: data.right_id + 2,
|
|
187
|
+
orderby: data.orderby + 1
|
|
188
|
+
}).execute();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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.LoggerRepository = void 0;
|
|
13
|
+
const entity_1 = require("../entity");
|
|
14
|
+
exports.LoggerRepository = {
|
|
15
|
+
saveData(data) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return yield this.createQueryBuilder()
|
|
18
|
+
.insert()
|
|
19
|
+
.into(entity_1.Logger)
|
|
20
|
+
.values(data)
|
|
21
|
+
.execute();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Logger.repository.js.map
|
|
@@ -0,0 +1,328 @@
|
|
|
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.StoreRepository = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const entity_1 = require("../entity");
|
|
15
|
+
const config_1 = require("../../config");
|
|
16
|
+
exports.StoreRepository = {
|
|
17
|
+
search(options) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const db = this.createQueryBuilder();
|
|
20
|
+
if (options.where && options.where.length) {
|
|
21
|
+
const where = options.where;
|
|
22
|
+
const builder = [];
|
|
23
|
+
let isAndWhere = false;
|
|
24
|
+
const hasSearchTerm = where.some((item) => item.key === 'term');
|
|
25
|
+
if (hasSearchTerm) {
|
|
26
|
+
const searchTerm = where.find((item) => item.key === 'term');
|
|
27
|
+
config_1.searchDbColumns.forEach((item) => {
|
|
28
|
+
builder.push({
|
|
29
|
+
key: item,
|
|
30
|
+
type: 'like',
|
|
31
|
+
value: searchTerm.value.toLowerCase()
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const hasFileTypes = where.some((item) => item.key === 'file_type');
|
|
36
|
+
if (hasFileTypes) {
|
|
37
|
+
const fileTypes = where.find((item) => item.key === 'file_type');
|
|
38
|
+
if (fileTypes && fileTypes.value.length) {
|
|
39
|
+
isAndWhere = true;
|
|
40
|
+
db.where(`${fileTypes.key} IN (:...mimes)`, { mimes: fileTypes.value });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (isAndWhere) {
|
|
44
|
+
db.andWhere(new typeorm_1.Brackets((qb) => {
|
|
45
|
+
builder.forEach((item, i) => {
|
|
46
|
+
const column = item.key;
|
|
47
|
+
const value = item.value;
|
|
48
|
+
if (i === 0) {
|
|
49
|
+
qb.where(`LOWER(${column}) LIKE :placeholder`, { placeholder: `%${value}%` });
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
qb.orWhere(`LOWER(${column}) LIKE :placeholder`, { placeholder: `%${value}%` });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
builder.forEach((item, i) => {
|
|
59
|
+
const column = item.key;
|
|
60
|
+
const value = item.value;
|
|
61
|
+
if (i === 0) {
|
|
62
|
+
db.where(`LOWER(${column}) LIKE :placeholder`, { placeholder: `%${value}%` });
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
db.orWhere(`LOWER(${column}) LIKE :placeholder`, { placeholder: `%${value}%` });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (options.take) {
|
|
71
|
+
db.limit(options.take);
|
|
72
|
+
}
|
|
73
|
+
if (options.skip) {
|
|
74
|
+
db.offset(options.skip);
|
|
75
|
+
}
|
|
76
|
+
if (options.order && options.order.column) {
|
|
77
|
+
const direction = (options.order.direction === 'DESC') ? 'DESC' : 'ASC';
|
|
78
|
+
db.orderBy(`store.${options.order.column}`, direction);
|
|
79
|
+
}
|
|
80
|
+
// console.log(db.printSql());
|
|
81
|
+
// console.log(db.getSql());
|
|
82
|
+
// console.log(db.getQuery());
|
|
83
|
+
return yield db.getManyAndCount();
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
fetch(options) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const db = this.createQueryBuilder();
|
|
89
|
+
if (options.ids && options.ids.length) {
|
|
90
|
+
db.where("store.collection_id IN (:...ids)", { ids: options.ids });
|
|
91
|
+
}
|
|
92
|
+
else if (options.where && options.where.length) {
|
|
93
|
+
options.where.forEach((item, i) => {
|
|
94
|
+
let column = item.key;
|
|
95
|
+
let value = item.value;
|
|
96
|
+
if (i === 0) {
|
|
97
|
+
db.where(`${column} = :placeholder`, { placeholder: value });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
db.andWhere(`${column} = :placeholder`, { placeholder: value });
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (options.take) {
|
|
105
|
+
db.limit(options.take);
|
|
106
|
+
}
|
|
107
|
+
if (options.skip) {
|
|
108
|
+
db.offset(options.skip);
|
|
109
|
+
}
|
|
110
|
+
if (options.order && options.order.column) {
|
|
111
|
+
const direction = (options.order.direction === 'DESC') ? 'DESC' : 'ASC';
|
|
112
|
+
db.orderBy(`store.${options.order.column}`, direction);
|
|
113
|
+
}
|
|
114
|
+
// console.log(db.printSql());
|
|
115
|
+
// console.log(db.getSql());
|
|
116
|
+
// console.log(db.getQuery());
|
|
117
|
+
return yield db.getManyAndCount();
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
update(id, data) {
|
|
121
|
+
return this.createQueryBuilder().update(entity_1.Store)
|
|
122
|
+
.set(data)
|
|
123
|
+
.where("id = :id", { id: id })
|
|
124
|
+
.execute();
|
|
125
|
+
},
|
|
126
|
+
activateByIds(ids, activated) {
|
|
127
|
+
return this.createQueryBuilder().update(entity_1.Store)
|
|
128
|
+
.set({ activated: activated })
|
|
129
|
+
.where("id IN (:...ids)", { ids: ids })
|
|
130
|
+
.execute();
|
|
131
|
+
},
|
|
132
|
+
temporaryByIds(ids, activated) {
|
|
133
|
+
return this.createQueryBuilder().update(entity_1.Store)
|
|
134
|
+
.set({ temporary: activated })
|
|
135
|
+
.where("id IN (:...ids)", { ids: ids })
|
|
136
|
+
.execute();
|
|
137
|
+
},
|
|
138
|
+
activateCollection(collectionId, activated) {
|
|
139
|
+
return this.createQueryBuilder().update(entity_1.Store)
|
|
140
|
+
.set({ activated: activated })
|
|
141
|
+
.where("collection_id = :id", { id: collectionId })
|
|
142
|
+
.execute();
|
|
143
|
+
},
|
|
144
|
+
temporaryCollection(collectionId, activated) {
|
|
145
|
+
return this.createQueryBuilder().update(entity_1.Store)
|
|
146
|
+
.set({ temporary: activated })
|
|
147
|
+
.where("collection_id = :id", { id: collectionId })
|
|
148
|
+
.execute();
|
|
149
|
+
},
|
|
150
|
+
resetTemporaryFonts(uptime) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const rows = yield this.createQueryBuilder().where("store.temporary = 1").getMany();
|
|
153
|
+
const now = new Date().getTime();
|
|
154
|
+
rows.forEach((row) => {
|
|
155
|
+
let updated = new Date(row.updated).getTime() + (1000 * uptime);
|
|
156
|
+
if (updated < now) {
|
|
157
|
+
this.createQueryBuilder().update(entity_1.Store).set({ temporary: 0 }).where("id = :id", { id: row.id }).execute();
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return rows;
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
deleteCollection(collectionId) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
return yield this.createQueryBuilder().delete().where("collection_id = :id", { id: collectionId }).execute();
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
resetSystem() {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
return yield this.createQueryBuilder().delete().where("store.system = 1").execute();
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
resetFavorites() {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
return yield this.createQueryBuilder().update(entity_1.Store).set({ favorite: 0 }).where("store.favorite = 1").execute();
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
resetActivated() {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
return yield this.createQueryBuilder().update(entity_1.Store).set({ activated: 0 }).where("store.activated = 1").execute();
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
syncActivated() {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
const results = yield this.createQueryBuilder("store").select(['store.file_name']).where("store.system = 1").getMany();
|
|
186
|
+
const fileNames = results.map((item) => item.file_name);
|
|
187
|
+
return yield this.createQueryBuilder()
|
|
188
|
+
.update(entity_1.Store)
|
|
189
|
+
.set({ activated: 1 })
|
|
190
|
+
.where("store.system = 0")
|
|
191
|
+
.andWhere("store.file_name IN (:...names)", { names: fileNames })
|
|
192
|
+
//.getQuery();
|
|
193
|
+
.execute();
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
fetchCollectionItems(collectionId) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
return yield this.createQueryBuilder()
|
|
199
|
+
.select("store.id", "id")
|
|
200
|
+
.where({ collection_id: (0, typeorm_1.Equal)(collectionId) })
|
|
201
|
+
.getRawMany();
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
fetchCollectionCount(id) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
return yield this.createQueryBuilder()
|
|
207
|
+
.select("COUNT(*)", "total")
|
|
208
|
+
.where("store.collection_id = :id", { id: id })
|
|
209
|
+
.getRawOne();
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
fetchCollectionsCount() {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
return yield this.createQueryBuilder()
|
|
215
|
+
.select("store.collection_id", "collection_id")
|
|
216
|
+
.addSelect("COUNT(*)", "total")
|
|
217
|
+
.groupBy("store.collection_id")
|
|
218
|
+
.getRawMany();
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
create(item) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
let data = {};
|
|
224
|
+
data.collection_id = item.collection_id;
|
|
225
|
+
data.file_name = (item.file_name) ? item.file_name : "";
|
|
226
|
+
data.file_path = (item.file_path) ? item.file_path : "";
|
|
227
|
+
data.file_size = (item.file_size) ? item.file_size : 0;
|
|
228
|
+
data.file_size_pretty = (item.file_size_pretty) ? item.file_size_pretty : "";
|
|
229
|
+
data.file_type = (item.file_type) ? item.file_type : "";
|
|
230
|
+
data.installable = (item.installable) ? item.installable : 0;
|
|
231
|
+
data.activated = (item.activated) ? item.activated : 0;
|
|
232
|
+
data.temporary = (item.temporary) ? item.temporary : 0;
|
|
233
|
+
data.favorite = (item.favorite) ? item.favorite : 0;
|
|
234
|
+
data.system = (item.system) ? item.system : 0;
|
|
235
|
+
if (item.compatible_full_name && item.compatible_full_name !== '') {
|
|
236
|
+
data.compatible_full_name = item.compatible_full_name;
|
|
237
|
+
}
|
|
238
|
+
if (item.copyright && item.copyright !== '') {
|
|
239
|
+
data.copyright = item.copyright;
|
|
240
|
+
}
|
|
241
|
+
if (item.description && item.description !== '') {
|
|
242
|
+
data.description = item.description;
|
|
243
|
+
}
|
|
244
|
+
if (item.designer && item.designer !== '') {
|
|
245
|
+
data.designer = item.designer;
|
|
246
|
+
}
|
|
247
|
+
if (item.designer_url && item.designer_url !== '') {
|
|
248
|
+
data.designer_url = item.designer_url;
|
|
249
|
+
}
|
|
250
|
+
if (item.font_family && item.font_family !== '') {
|
|
251
|
+
data.font_family = item.font_family;
|
|
252
|
+
}
|
|
253
|
+
if (item.font_subfamily && item.font_subfamily !== '') {
|
|
254
|
+
data.font_subfamily = item.font_subfamily;
|
|
255
|
+
}
|
|
256
|
+
if (item.full_name && item.full_name !== '') {
|
|
257
|
+
data.full_name = item.full_name;
|
|
258
|
+
}
|
|
259
|
+
if (item.license && item.license !== '') {
|
|
260
|
+
data.license = item.license;
|
|
261
|
+
}
|
|
262
|
+
if (item.license_url && item.license_url !== '') {
|
|
263
|
+
data.license_url = item.license_url;
|
|
264
|
+
}
|
|
265
|
+
if (item.manufacturer && item.manufacturer !== '') {
|
|
266
|
+
data.manufacturer = item.manufacturer;
|
|
267
|
+
}
|
|
268
|
+
if (item.manufacturer_url && item.manufacturer_url !== '') {
|
|
269
|
+
data.manufacturer_url = item.manufacturer_url;
|
|
270
|
+
}
|
|
271
|
+
if (item.post_script_name && item.post_script_name !== '') {
|
|
272
|
+
data.post_script_name = item.post_script_name;
|
|
273
|
+
}
|
|
274
|
+
if (item.preferred_family && item.preferred_family !== '') {
|
|
275
|
+
data.preferred_family = item.preferred_family;
|
|
276
|
+
}
|
|
277
|
+
if (item.preferred_sub_family && item.preferred_sub_family !== '') {
|
|
278
|
+
data.preferred_sub_family = item.preferred_sub_family;
|
|
279
|
+
}
|
|
280
|
+
if (item.sample_text && item.sample_text !== '') {
|
|
281
|
+
data.sample_text = item.sample_text;
|
|
282
|
+
}
|
|
283
|
+
if (item.trademark && item.trademark !== '') {
|
|
284
|
+
data.trademark = item.trademark;
|
|
285
|
+
}
|
|
286
|
+
if (item.unique_id && item.unique_id !== '') {
|
|
287
|
+
data.unique_id = item.unique_id;
|
|
288
|
+
}
|
|
289
|
+
if (item.version && item.version !== '') {
|
|
290
|
+
data.version = item.version;
|
|
291
|
+
}
|
|
292
|
+
//@todo Log errors in log table.
|
|
293
|
+
return yield this.createQueryBuilder().insert().into(entity_1.Store).values(data).execute().catch((err) => console.log('insert-error', err));
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
fetchSystemStats() {
|
|
297
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
const rowCount = yield this.createQueryBuilder()
|
|
299
|
+
.select("COUNT(*)", "total")
|
|
300
|
+
.getRawOne();
|
|
301
|
+
const activatedCount = yield this.createQueryBuilder()
|
|
302
|
+
.select("COUNT(*)", "total")
|
|
303
|
+
.where("store.activated = 1")
|
|
304
|
+
.andWhere("store.system = 0")
|
|
305
|
+
.getRawOne();
|
|
306
|
+
const favoriteCount = yield this.createQueryBuilder()
|
|
307
|
+
.select("COUNT(*)", "total")
|
|
308
|
+
.where("store.favorite = 1")
|
|
309
|
+
.getRawOne();
|
|
310
|
+
const systemCount = yield this.createQueryBuilder()
|
|
311
|
+
.select("COUNT(*)", "total")
|
|
312
|
+
.where("store.system = 1")
|
|
313
|
+
.getRawOne();
|
|
314
|
+
const temporaryCount = yield this.createQueryBuilder()
|
|
315
|
+
.select("COUNT(*)", "total")
|
|
316
|
+
.where("store.temporary = 1")
|
|
317
|
+
.getRawOne();
|
|
318
|
+
return {
|
|
319
|
+
rowCount: rowCount.total,
|
|
320
|
+
activatedCount: activatedCount.total,
|
|
321
|
+
favoriteCount: favoriteCount.total,
|
|
322
|
+
systemCount: systemCount.total,
|
|
323
|
+
temporaryCount: temporaryCount.total
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=Store.repository.js.map
|