diff --git a/apps/backend/src/main.ts b/apps/backend/src/main.ts index 9eaa95a11..90dae4c7a 100644 --- a/apps/backend/src/main.ts +++ b/apps/backend/src/main.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import { INestApplication } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { nestjsMainApp } from 'vitnode-backend'; @@ -8,20 +7,7 @@ import { AppModule } from './app.module'; async function bootstrap() { const app: INestApplication = await NestFactory.create(AppModule); - nestjsMainApp(app, { - cors: { - origin: [ - process.env.NEXT_PUBLIC_FRONTEND_URL - ? process.env.NEXT_PUBLIC_FRONTEND_URL - : 'http://localhost:3000', - ], - }, - }); - - const port = Number(process.env.PORT) || 8080; - await app.listen(port, '', () => { - console.log(`Application is running on: http://localhost:${port}/graphql`); - }); + void nestjsMainApp(app, {}); } void bootstrap(); diff --git a/apps/docs/content/docs/dev/codegen.mdx b/apps/docs/content/docs/dev/codegen.mdx index dd23ce007..077b87a04 100644 --- a/apps/docs/content/docs/dev/codegen.mdx +++ b/apps/docs/content/docs/dev/codegen.mdx @@ -55,7 +55,9 @@ query Test_example_query($cursor: Int, $first: Int) { ## Generate Types -To generate types for your GraphQL schema, run the following command: +VitNode has build-in `codegen` script in `backend`. That mean when you make changes in `backend` code, the VitNode will automatically generate the types for you. + +To generate types manualy for your GraphQL schema, run the following command: import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; diff --git a/apps/frontend/src/graphql/types.ts b/apps/frontend/src/graphql/types.ts new file mode 100644 index 000000000..5b8cd9ab3 --- /dev/null +++ b/apps/frontend/src/graphql/types.ts @@ -0,0 +1,1343 @@ +export type Maybe = T; +export type InputMaybe = T; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string; } + String: { input: string; output: string; } + Boolean: { input: boolean; output: boolean; } + Int: { input: number; output: number; } + Float: { input: number; output: number; } + DateTime: { input: Date; output: Date; } + Upload: { input: File; output: File; } +}; + +export const AllowTypeFilesEnum = { + all: 'all', + images: 'images', + images_videos: 'images_videos', + none: 'none' +} as const; + +export type AllowTypeFilesEnum = typeof AllowTypeFilesEnum[keyof typeof AllowTypeFilesEnum]; +export type AuthorizationAdminSessionsObj = { + __typename?: 'AuthorizationAdminSessionsObj'; + user?: Maybe; + version: Scalars['String']['output']; +}; + +export type AuthorizationCoreMiddleware = { + __typename?: 'AuthorizationCoreMiddleware'; + force_login: Scalars['Boolean']['output']; + lock_register: Scalars['Boolean']['output']; +}; + +export type AuthorizationCoreSessionsObj = { + __typename?: 'AuthorizationCoreSessionsObj'; + files: FilesAuthorizationCoreSessions; + plugin_default: Scalars['String']['output']; + user?: Maybe; +}; + +export type AuthorizationCurrentUserObj = { + __typename?: 'AuthorizationCurrentUserObj'; + avatar?: Maybe; + avatar_color: Scalars['String']['output']; + email: Scalars['String']['output']; + group: GroupUser; + id: Scalars['Int']['output']; + is_admin: Scalars['Boolean']['output']; + is_mod: Scalars['Boolean']['output']; + language: Scalars['String']['output']; + name: Scalars['String']['output']; + name_seo: Scalars['String']['output']; + newsletter: Scalars['Boolean']['output']; +}; + +export type AvatarUser = { + __typename?: 'AvatarUser'; + dir_folder: Scalars['String']['output']; + file_name: Scalars['String']['output']; + id: Scalars['Int']['output']; +}; + +export type CaptchaSecurityCoreMiddleware = { + __typename?: 'CaptchaSecurityCoreMiddleware'; + site_key: Scalars['String']['output']; + type: CaptchaTypeEnum | `${CaptchaTypeEnum}`; +}; + +export const CaptchaTypeEnum = { + cloudflare_turnstile: 'cloudflare_turnstile', + none: 'none', + recaptcha_v2_checkbox: 'recaptcha_v2_checkbox', + recaptcha_v2_invisible: 'recaptcha_v2_invisible', + recaptcha_v3: 'recaptcha_v3' +} as const; + +export type CaptchaTypeEnum = typeof CaptchaTypeEnum[keyof typeof CaptchaTypeEnum]; +export type ColorsEditAdminThemeEditor = { + accent: ThemeVariableInput; + accent_foreground: ThemeVariableInput; + background: ThemeVariableInput; + border: ThemeVariableInput; + card: ThemeVariableInput; + cover: ThemeVariableInput; + cover_foreground: ThemeVariableInput; + destructive: ThemeVariableInput; + destructive_foreground: ThemeVariableInput; + muted: ThemeVariableInput; + muted_foreground: ThemeVariableInput; + primary: ThemeVariableInput; + primary_foreground: ThemeVariableInput; + secondary: ThemeVariableInput; + secondary_foreground: ThemeVariableInput; +}; + +export type ColorsShowCoreThemeEditor = { + __typename?: 'ColorsShowCoreThemeEditor'; + accent: ThemeVariable; + accent_foreground: ThemeVariable; + background: ThemeVariable; + border: ThemeVariable; + card: ThemeVariable; + cover: ThemeVariable; + cover_foreground: ThemeVariable; + destructive: ThemeVariable; + destructive_foreground: ThemeVariable; + muted: ThemeVariable; + muted_foreground: ThemeVariable; + primary: ThemeVariable; + primary_foreground: ThemeVariable; + secondary: ThemeVariable; + secondary_foreground: ThemeVariable; +}; + +export type ContentCreateAdminGroups = { + files_allow_upload: Scalars['Boolean']['input']; + files_max_storage_for_submit: Scalars['Int']['input']; + files_total_max_storage: Scalars['Int']['input']; +}; + +export type ContentShowAdminGroups = { + __typename?: 'ContentShowAdminGroups'; + files_allow_upload: Scalars['Boolean']['output']; + files_max_storage_for_submit: Scalars['Int']['output']; + files_total_max_storage: Scalars['Int']['output']; +}; + +export type EditAdminMembersObj = { + __typename?: 'EditAdminMembersObj'; + birthday?: Maybe; + email: Scalars['String']['output']; + first_name?: Maybe; + id: Scalars['Int']['output']; + last_name?: Maybe; + name: Scalars['String']['output']; + newsletter: Scalars['Boolean']['output']; +}; + +export type EditAdminSettingsObj = { + __typename?: 'EditAdminSettingsObj'; + site_copyright: Array; + site_description: Array; + site_name: Scalars['String']['output']; +}; + +export type EditorShowCoreMiddleware = { + __typename?: 'EditorShowCoreMiddleware'; + files: FilesEditorShowCoreMiddleware; + sticky: Scalars['Boolean']['output']; +}; + +export const EmailProvider = { + none: 'none', + resend: 'resend', + smtp: 'smtp' +} as const; + +export type EmailProvider = typeof EmailProvider[keyof typeof EmailProvider]; +export type FilesAdminPluginsObj = { + __typename?: 'FilesAdminPluginsObj'; + admin_pages: Scalars['Int']['output']; + admin_templates: Scalars['Int']['output']; + databases: Scalars['Int']['output']; + default_page: Scalars['Boolean']['output']; + pages: Scalars['Int']['output']; + templates: Scalars['Int']['output']; +}; + +export type FilesAuthorizationCoreSessions = { + __typename?: 'FilesAuthorizationCoreSessions'; + allow_upload: Scalars['Boolean']['output']; + max_storage_for_submit: Scalars['Int']['output']; + space_used: Scalars['Float']['output']; + total_max_storage: Scalars['Int']['output']; +}; + +export type FilesEditAdminEditorStyles = { + allow_type: AllowTypeFilesEnum | `${AllowTypeFilesEnum}`; +}; + +export type FilesEditorShowCoreMiddleware = { + __typename?: 'FilesEditorShowCoreMiddleware'; + allow_type: AllowTypeFilesEnum | `${AllowTypeFilesEnum}`; +}; + +export type GroupUser = { + __typename?: 'GroupUser'; + color?: Maybe; + id: Scalars['Int']['output']; + name: Array; +}; + +export type HslColor = { + __typename?: 'HslColor'; + h: Scalars['Int']['output']; + l: Scalars['Int']['output']; + s: Scalars['Int']['output']; +}; + +export type HslColorInput = { + h: Scalars['Int']['input']; + l: Scalars['Int']['input']; + s: Scalars['Int']['input']; +}; + +export type LanguagesCoreMiddleware = { + __typename?: 'LanguagesCoreMiddleware'; + code: Scalars['String']['output']; + default: Scalars['Boolean']['output']; + enabled: Scalars['Boolean']['output']; +}; + +export const LayoutAdminInstallEnum = { + account: 'ACCOUNT', + database: 'DATABASE', + finish: 'FINISH' +} as const; + +export type LayoutAdminInstallEnum = typeof LayoutAdminInstallEnum[keyof typeof LayoutAdminInstallEnum]; +export type LayoutAdminInstallObj = { + __typename?: 'LayoutAdminInstallObj'; + status: LayoutAdminInstallEnum | `${LayoutAdminInstallEnum}`; +}; + +export type LogoShowCoreThemeEditor = { + __typename?: 'LogoShowCoreThemeEditor'; + dark?: Maybe; + light?: Maybe; + mobile_dark?: Maybe; + mobile_light?: Maybe; + mobile_width: Scalars['Float']['output']; + text: Scalars['String']['output']; + width: Scalars['Float']['output']; +}; + +export type LogosEditAdminThemeEditor = { + dark?: InputMaybe; + light?: InputMaybe; + mobile_dark?: InputMaybe; + mobile_light?: InputMaybe; + mobile_width: Scalars['Float']['input']; + text: Scalars['String']['input']; + width: Scalars['Float']['input']; +}; + +export type Mutation = { + __typename?: 'Mutation'; + admin__core_authorization_settings__edit: ShowAdminAuthorizationSettingsObj; + admin__core_email_settings__edit: ShowAdminEmailSettingsServiceObj; + admin__core_email_settings__test: Scalars['String']['output']; + admin__core_files__delete: Scalars['String']['output']; + admin__core_groups__create: ShowAdminGroups; + admin__core_groups__delete: Scalars['String']['output']; + admin__core_groups__edit: ShowAdminGroups; + admin__core_languages__create: ShowCoreLanguages; + admin__core_languages__delete: Scalars['String']['output']; + admin__core_languages__download: Scalars['String']['output']; + admin__core_languages__edit: ShowCoreLanguages; + admin__core_main_settings__edit: EditAdminSettingsObj; + admin__core_manifest_metadata__edit: ShowAdminManifestMetadataObj; + admin__core_members__create: SignUpCoreSessionsObj; + admin__core_members__edit: EditAdminMembersObj; + admin__core_nav_styles__change_position: Scalars['String']['output']; + admin__core_plugins__create: ShowAdminPlugins; + admin__core_plugins__delete: Scalars['String']['output']; + admin__core_plugins__download: Scalars['String']['output']; + admin__core_plugins__edit: ShowAdminPlugins; + admin__core_plugins__nav__change_position: Scalars['String']['output']; + admin__core_plugins__nav__create: ShowAdminNavPluginsObj; + admin__core_plugins__nav__delete: Scalars['String']['output']; + admin__core_plugins__nav__edit: ShowAdminNavPluginsObj; + admin__core_plugins__upload: ShowAdminPlugins; + admin__core_security__captcha__edit: ShowAdminCaptchaSecurityObj; + admin__core_staff_administrators__create: ShowAdminStaffAdministrators; + admin__core_staff_administrators__delete: Scalars['String']['output']; + admin__core_staff_moderators__create: ShowAdminStaffModerators; + admin__core_staff_moderators__delete: Scalars['String']['output']; + admin__core_styles__editor__edit: EditorShowCoreMiddleware; + admin__core_styles__nav__create: ShowCoreNav; + admin__core_styles__nav__delete: Scalars['String']['output']; + admin__core_styles__nav__edit: ShowCoreNav; + admin__core_terms_settings__create: ShowCoreTerms; + admin__core_terms_settings__delete: Scalars['String']['output']; + admin__core_terms_settings__edit: ShowCoreTerms; + admin__core_theme_editor__edit: Scalars['String']['output']; + admin__install__create_database: Scalars['String']['output']; + admin_sessions__sign_out: Scalars['String']['output']; + core_editor_files__delete: Scalars['String']['output']; + core_editor_files__upload: ShowCoreFiles; + core_members__avatar__delete: Scalars['String']['output']; + core_members__avatar__upload: UploadAvatarCoreMembersObj; + core_members__change_password: Scalars['String']['output']; + core_members__delete: Scalars['String']['output']; + core_members__reset_password__create_key: Scalars['String']['output']; + core_sessions__sign_in: Scalars['String']['output']; + core_sessions__sign_out: Scalars['String']['output']; + core_sessions__sign_up: SignUpCoreSessionsObj; +}; + + +export type MutationAdmin__Core_Authorization_Settings__EditArgs = { + force_login: Scalars['Boolean']['input']; + lock_register: Scalars['Boolean']['input']; +}; + + +export type MutationAdmin__Core_Email_Settings__EditArgs = { + color_primary: Scalars['String']['input']; + color_primary_foreground: Scalars['String']['input']; + logo?: InputMaybe; + provider: EmailProvider; + resend_key?: InputMaybe; + smtp?: InputMaybe; +}; + + +export type MutationAdmin__Core_Email_Settings__TestArgs = { + from: Scalars['String']['input']; + message: Scalars['String']['input']; + preview_text?: InputMaybe; + subject: Scalars['String']['input']; + to: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Files__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Groups__CreateArgs = { + color?: InputMaybe; + content: ContentCreateAdminGroups; + name: Array; +}; + + +export type MutationAdmin__Core_Groups__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Groups__EditArgs = { + color?: InputMaybe; + content: ContentCreateAdminGroups; + id: Scalars['Int']['input']; + name: Array; +}; + + +export type MutationAdmin__Core_Languages__CreateArgs = { + allow_in_input: Scalars['Boolean']['input']; + code: Scalars['String']['input']; + locale: Scalars['String']['input']; + name: Scalars['String']['input']; + time_24: Scalars['Boolean']['input']; + timezone: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Languages__DeleteArgs = { + code: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Languages__DownloadArgs = { + code: Scalars['String']['input']; + plugins: Array; +}; + + +export type MutationAdmin__Core_Languages__EditArgs = { + allow_in_input: Scalars['Boolean']['input']; + default: Scalars['Boolean']['input']; + enabled: Scalars['Boolean']['input']; + id: Scalars['Int']['input']; + locale: Scalars['String']['input']; + name: Scalars['String']['input']; + time_24: Scalars['Boolean']['input']; + timezone: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Main_Settings__EditArgs = { + site_copyright: Array; + site_description: Array; + site_name: Scalars['String']['input']; + site_short_name: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Manifest_Metadata__EditArgs = { + background_color: Scalars['String']['input']; + display: Scalars['String']['input']; + start_url: Scalars['String']['input']; + theme_color: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Members__CreateArgs = { + email: Scalars['String']['input']; + name: Scalars['String']['input']; + password: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Members__EditArgs = { + birthday?: InputMaybe; + email: Scalars['String']['input']; + first_name?: InputMaybe; + id: Scalars['Int']['input']; + last_name?: InputMaybe; + name: Scalars['String']['input']; + newsletter: Scalars['Boolean']['input']; +}; + + +export type MutationAdmin__Core_Nav_Styles__Change_PositionArgs = { + id: Scalars['Int']['input']; + index_to_move: Scalars['Int']['input']; + parent_id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Plugins__CreateArgs = { + author: Scalars['String']['input']; + author_url?: InputMaybe; + code: Scalars['String']['input']; + description?: InputMaybe; + name: Scalars['String']['input']; + support_url: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__DeleteArgs = { + code: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__DownloadArgs = { + code: Scalars['String']['input']; + version?: InputMaybe; + version_code?: InputMaybe; +}; + + +export type MutationAdmin__Core_Plugins__EditArgs = { + author: Scalars['String']['input']; + author_url?: InputMaybe; + code: Scalars['String']['input']; + default?: InputMaybe; + description?: InputMaybe; + enabled?: InputMaybe; + name: Scalars['String']['input']; + support_url: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__Nav__Change_PositionArgs = { + code: Scalars['String']['input']; + index_to_move: Scalars['Int']['input']; + parent_code?: InputMaybe; + plugin_code: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__Nav__CreateArgs = { + code: Scalars['String']['input']; + href: Scalars['String']['input']; + icon?: InputMaybe; + keywords: Array; + parent_code?: InputMaybe; + plugin_code: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__Nav__DeleteArgs = { + code: Scalars['String']['input']; + parent_code?: InputMaybe; + plugin_code: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__Nav__EditArgs = { + code: Scalars['String']['input']; + href: Scalars['String']['input']; + icon?: InputMaybe; + keywords: Array; + parent_code?: InputMaybe; + plugin_code: Scalars['String']['input']; + previous_code: Scalars['String']['input']; +}; + + +export type MutationAdmin__Core_Plugins__UploadArgs = { + code?: InputMaybe; + file: Scalars['Upload']['input']; +}; + + +export type MutationAdmin__Core_Security__Captcha__EditArgs = { + secret_key: Scalars['String']['input']; + site_key: Scalars['String']['input']; + type: CaptchaTypeEnum; +}; + + +export type MutationAdmin__Core_Staff_Administrators__CreateArgs = { + group_id?: InputMaybe; + unrestricted: Scalars['Boolean']['input']; + user_id?: InputMaybe; +}; + + +export type MutationAdmin__Core_Staff_Administrators__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Staff_Moderators__CreateArgs = { + group_id?: InputMaybe; + unrestricted: Scalars['Boolean']['input']; + user_id?: InputMaybe; +}; + + +export type MutationAdmin__Core_Staff_Moderators__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Styles__Editor__EditArgs = { + files: FilesEditAdminEditorStyles; + sticky: Scalars['Boolean']['input']; +}; + + +export type MutationAdmin__Core_Styles__Nav__CreateArgs = { + description: Array; + external: Scalars['Boolean']['input']; + href: Scalars['String']['input']; + icon?: InputMaybe; + name: Array; +}; + + +export type MutationAdmin__Core_Styles__Nav__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Styles__Nav__EditArgs = { + description: Array; + external: Scalars['Boolean']['input']; + href: Scalars['String']['input']; + icon?: InputMaybe; + id: Scalars['Int']['input']; + name: Array; +}; + + +export type MutationAdmin__Core_Terms_Settings__CreateArgs = { + code: Scalars['String']['input']; + content: Array; + href?: InputMaybe; + title: Array; +}; + + +export type MutationAdmin__Core_Terms_Settings__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationAdmin__Core_Terms_Settings__EditArgs = { + code: Scalars['String']['input']; + content: Array; + href?: InputMaybe; + id: Scalars['Float']['input']; + title: Array; +}; + + +export type MutationAdmin__Core_Theme_Editor__EditArgs = { + colors?: InputMaybe; + logos: LogosEditAdminThemeEditor; +}; + + +export type MutationCore_Editor_Files__DeleteArgs = { + id: Scalars['Int']['input']; + security_key?: InputMaybe; +}; + + +export type MutationCore_Editor_Files__UploadArgs = { + file: Scalars['Upload']['input']; + folder: Scalars['String']['input']; + plugin: Scalars['String']['input']; +}; + + +export type MutationCore_Members__Avatar__UploadArgs = { + file: Scalars['Upload']['input']; +}; + + +export type MutationCore_Members__Change_PasswordArgs = { + hashKey: Scalars['String']['input']; + password: Scalars['String']['input']; +}; + + +export type MutationCore_Members__DeleteArgs = { + id: Scalars['Int']['input']; +}; + + +export type MutationCore_Members__Reset_Password__Create_KeyArgs = { + email: Scalars['String']['input']; +}; + + +export type MutationCore_Sessions__Sign_InArgs = { + admin?: InputMaybe; + email: Scalars['String']['input']; + password: Scalars['String']['input']; + remember?: InputMaybe; +}; + + +export type MutationCore_Sessions__Sign_UpArgs = { + email: Scalars['String']['input']; + name: Scalars['String']['input']; + newsletter?: InputMaybe; + password: Scalars['String']['input']; +}; + +export type NavSearchAdminSessions = { + __typename?: 'NavSearchAdminSessions'; + code: Scalars['String']['output']; + code_plugin: Scalars['String']['output']; + href: Scalars['String']['output']; + icon?: Maybe; + keywords: Array; + parent_nav_code?: Maybe; +}; + +export type PageInfo = { + __typename?: 'PageInfo'; + count: Scalars['Float']['output']; + endCursor?: Maybe; + hasNextPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output']; + startCursor?: Maybe; + totalCount: Scalars['Float']['output']; +}; + +export type Query = { + __typename?: 'Query'; + admin__core_authorization_settings__show: ShowAdminAuthorizationSettingsObj; + admin__core_email_settings__show: ShowAdminEmailSettingsServiceObj; + admin__core_files__show: ShowAdminFilesObj; + admin__core_groups__show: ShowAdminGroupsObj; + admin__core_manifest_metadata__show: ShowAdminManifestMetadataObj; + admin__core_members__show: ShowAdminMembersObj; + admin__core_members__stats_sign_up: Array; + admin__core_plugins__files: FilesAdminPluginsObj; + admin__core_plugins__nav__show: Array; + admin__core_plugins__show: ShowAdminPluginsObj; + admin__core_security__captcha__show: ShowAdminCaptchaSecurityObj; + admin__core_staff_administrators__show: ShowAdminStaffAdministratorsObj; + admin__core_staff_moderators__show: ShowAdminStaffModeratorsObj; + admin__install__layout: LayoutAdminInstallObj; + admin__nav__show: Array; + admin__sessions__authorization: AuthorizationAdminSessionsObj; + admin__sessions__search: SearchAdminSessionsObj; + core_files__show: ShowCoreFilesObj; + core_languages__show: ShowCoreLanguagesObj; + core_members__show: ShowCoreMembersObj; + core_middleware__show: ShowCoreMiddlewareObj; + core_nav__show: ShowCoreNavObj; + core_plugins__show: Array; + core_sessions__authorization: AuthorizationCoreSessionsObj; + core_sessions__devices__show: Array; + core_settings__show: ShowSettingsObj; + core_terms__show: ShowCoreTermsObj; + core_theme_editor__show: ShowCoreThemeEditorObj; +}; + + +export type QueryAdmin__Core_Files__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryAdmin__Core_Groups__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryAdmin__Core_Members__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + groups?: InputMaybe>; + last?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryAdmin__Core_Plugins__FilesArgs = { + code: Scalars['String']['input']; +}; + + +export type QueryAdmin__Core_Plugins__Nav__ShowArgs = { + plugin_code: Scalars['String']['input']; +}; + + +export type QueryAdmin__Core_Plugins__ShowArgs = { + code?: InputMaybe; + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryAdmin__Core_Staff_Administrators__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryAdmin__Core_Staff_Moderators__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryAdmin__Sessions__SearchArgs = { + search: Scalars['String']['input']; +}; + + +export type QueryCore_Files__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryCore_Languages__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryCore_Members__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + name_seo?: InputMaybe; + search?: InputMaybe; + sortBy?: InputMaybe; +}; + + +export type QueryCore_Nav__ShowArgs = { + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; +}; + + +export type QueryCore_Terms__ShowArgs = { + code?: InputMaybe; + cursor?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; +}; + +export type SmtpEditAdminEmailSettingsService = { + host: Scalars['String']['input']; + password: Scalars['String']['input']; + port: Scalars['Int']['input']; + secure: Scalars['Boolean']['input']; + user: Scalars['String']['input']; +}; + +export type SearchAdminSessionsObj = { + __typename?: 'SearchAdminSessionsObj'; + nav: Array; +}; + +export type SecurityCoreMiddleware = { + __typename?: 'SecurityCoreMiddleware'; + captcha: CaptchaSecurityCoreMiddleware; +}; + +export type ShowAdminAuthorizationSettingsObj = { + __typename?: 'ShowAdminAuthorizationSettingsObj'; + force_login: Scalars['Boolean']['output']; + lock_register: Scalars['Boolean']['output']; +}; + +export type ShowAdminCaptchaSecurityObj = { + __typename?: 'ShowAdminCaptchaSecurityObj'; + secret_key: Scalars['String']['output']; + site_key: Scalars['String']['output']; + type: CaptchaTypeEnum | `${CaptchaTypeEnum}`; +}; + +export type ShowAdminEmailSettingsServiceObj = { + __typename?: 'ShowAdminEmailSettingsServiceObj'; + color_primary: Scalars['String']['output']; + logo?: Maybe; + provider: EmailProvider | `${EmailProvider}`; + smtp_host?: Maybe; + smtp_port?: Maybe; + smtp_secure?: Maybe; + smtp_user?: Maybe; +}; + +export type ShowAdminFiles = { + __typename?: 'ShowAdminFiles'; + count_uses: Scalars['Int']['output']; + created: Scalars['DateTime']['output']; + dir_folder: Scalars['String']['output']; + extension: Scalars['String']['output']; + file_alt?: Maybe; + file_name: Scalars['String']['output']; + file_name_original: Scalars['String']['output']; + file_size: Scalars['Int']['output']; + height?: Maybe; + id: Scalars['Int']['output']; + mimetype: Scalars['String']['output']; + security_key?: Maybe; + user?: Maybe; + width?: Maybe; +}; + +export type ShowAdminFilesObj = { + __typename?: 'ShowAdminFilesObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowAdminGroups = { + __typename?: 'ShowAdminGroups'; + color?: Maybe; + content: ContentShowAdminGroups; + created: Scalars['DateTime']['output']; + default: Scalars['Boolean']['output']; + guest: Scalars['Boolean']['output']; + id: Scalars['Int']['output']; + name: Array; + protected: Scalars['Boolean']['output']; + root: Scalars['Boolean']['output']; + updated: Scalars['DateTime']['output']; + users_count: Scalars['Int']['output']; +}; + +export type ShowAdminGroupsObj = { + __typename?: 'ShowAdminGroupsObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowAdminGroupsSortByArgs = { + column: ShowAdminGroupsSortingColumnEnum | `${ShowAdminGroupsSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowAdminGroupsSortingColumnEnum = { + created: 'created', + updated: 'updated' +} as const; + +export type ShowAdminGroupsSortingColumnEnum = typeof ShowAdminGroupsSortingColumnEnum[keyof typeof ShowAdminGroupsSortingColumnEnum]; +export type ShowAdminManifestMetadataObj = { + __typename?: 'ShowAdminManifestMetadataObj'; + background_color: Scalars['String']['output']; + display: Scalars['String']['output']; + id: Scalars['String']['output']; + lang: Scalars['String']['output']; + start_url: Scalars['String']['output']; + theme_color: Scalars['String']['output']; +}; + +export type ShowAdminMembers = { + __typename?: 'ShowAdminMembers'; + avatar?: Maybe; + avatar_color: Scalars['String']['output']; + email: Scalars['String']['output']; + group: GroupUser; + id: Scalars['Int']['output']; + joined: Scalars['DateTime']['output']; + language: Scalars['String']['output']; + name: Scalars['String']['output']; + name_seo: Scalars['String']['output']; + newsletter: Scalars['Boolean']['output']; + posts: Scalars['Int']['output']; +}; + +export type ShowAdminMembersObj = { + __typename?: 'ShowAdminMembersObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowAdminMembersSortByArgs = { + column: ShowAdminMembersSortingColumnEnum | `${ShowAdminMembersSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowAdminMembersSortingColumnEnum = { + first_name: 'first_name', + followers: 'followers', + joined: 'joined', + last_name: 'last_name', + name: 'name', + posts: 'posts', + reactions: 'reactions' +} as const; + +export type ShowAdminMembersSortingColumnEnum = typeof ShowAdminMembersSortingColumnEnum[keyof typeof ShowAdminMembersSortingColumnEnum]; +export type ShowAdminNavObj = { + __typename?: 'ShowAdminNavObj'; + code: Scalars['String']['output']; + nav: Array; +}; + +export type ShowAdminNavPlugins = { + __typename?: 'ShowAdminNavPlugins'; + code: Scalars['String']['output']; + href: Scalars['String']['output']; + icon?: Maybe; + keywords: Array; +}; + +export type ShowAdminNavPluginsObj = { + __typename?: 'ShowAdminNavPluginsObj'; + children?: Maybe>; + code: Scalars['String']['output']; + href: Scalars['String']['output']; + icon?: Maybe; + keywords: Array; +}; + +export type ShowAdminPlugins = { + __typename?: 'ShowAdminPlugins'; + allow_default: Scalars['Boolean']['output']; + author: Scalars['String']['output']; + author_url?: Maybe; + code: Scalars['String']['output']; + created: Scalars['DateTime']['output']; + default: Scalars['Boolean']['output']; + description?: Maybe; + enabled: Scalars['Boolean']['output']; + id: Scalars['Int']['output']; + name: Scalars['String']['output']; + support_url: Scalars['String']['output']; + updated: Scalars['DateTime']['output']; + version: Scalars['String']['output']; + version_code: Scalars['Int']['output']; +}; + +export type ShowAdminPluginsObj = { + __typename?: 'ShowAdminPluginsObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowAdminPluginsSortByArgs = { + column: ShowAdminPluginsSortingColumnEnum | `${ShowAdminPluginsSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowAdminPluginsSortingColumnEnum = { + created: 'created', + updated: 'updated' +} as const; + +export type ShowAdminPluginsSortingColumnEnum = typeof ShowAdminPluginsSortingColumnEnum[keyof typeof ShowAdminPluginsSortingColumnEnum]; +export type ShowAdminStaffAdministrators = { + __typename?: 'ShowAdminStaffAdministrators'; + created: Scalars['DateTime']['output']; + id: Scalars['Int']['output']; + protected: Scalars['Boolean']['output']; + unrestricted: Scalars['Boolean']['output']; + updated: Scalars['DateTime']['output']; + user_or_group: UserOrGroupCoreStaffUnion; +}; + +export type ShowAdminStaffAdministratorsObj = { + __typename?: 'ShowAdminStaffAdministratorsObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowAdminStaffAdministratorsSortByArgs = { + column: ShowAdminStaffAdministratorsSortingColumnEnum | `${ShowAdminStaffAdministratorsSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowAdminStaffAdministratorsSortingColumnEnum = { + updated: 'updated' +} as const; + +export type ShowAdminStaffAdministratorsSortingColumnEnum = typeof ShowAdminStaffAdministratorsSortingColumnEnum[keyof typeof ShowAdminStaffAdministratorsSortingColumnEnum]; +export type ShowAdminStaffModerators = { + __typename?: 'ShowAdminStaffModerators'; + created: Scalars['DateTime']['output']; + id: Scalars['Int']['output']; + protected: Scalars['Boolean']['output']; + unrestricted: Scalars['Boolean']['output']; + updated: Scalars['DateTime']['output']; + user_or_group: UserOrGroupCoreStaffUnion; +}; + +export type ShowAdminStaffModeratorsObj = { + __typename?: 'ShowAdminStaffModeratorsObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowAdminStaffModeratorsSortByArgs = { + column: ShowAdminStaffModeratorsSortingColumnEnum | `${ShowAdminStaffModeratorsSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowAdminStaffModeratorsSortingColumnEnum = { + updated: 'updated' +} as const; + +export type ShowAdminStaffModeratorsSortingColumnEnum = typeof ShowAdminStaffModeratorsSortingColumnEnum[keyof typeof ShowAdminStaffModeratorsSortingColumnEnum]; +export type ShowCoreFiles = { + __typename?: 'ShowCoreFiles'; + count_uses: Scalars['Int']['output']; + created: Scalars['DateTime']['output']; + dir_folder: Scalars['String']['output']; + extension: Scalars['String']['output']; + file_alt?: Maybe; + file_name: Scalars['String']['output']; + file_name_original: Scalars['String']['output']; + file_size: Scalars['Int']['output']; + height?: Maybe; + id: Scalars['Int']['output']; + mimetype: Scalars['String']['output']; + security_key?: Maybe; + width?: Maybe; +}; + +export type ShowCoreFilesObj = { + __typename?: 'ShowCoreFilesObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowCoreFilesSortByArgs = { + column: ShowCoreFilesSortingColumnEnum | `${ShowCoreFilesSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowCoreFilesSortingColumnEnum = { + created: 'created', + file_size: 'file_size' +} as const; + +export type ShowCoreFilesSortingColumnEnum = typeof ShowCoreFilesSortingColumnEnum[keyof typeof ShowCoreFilesSortingColumnEnum]; +export type ShowCoreLanguages = { + __typename?: 'ShowCoreLanguages'; + allow_in_input: Scalars['Boolean']['output']; + code: Scalars['String']['output']; + created: Scalars['DateTime']['output']; + default: Scalars['Boolean']['output']; + enabled: Scalars['Boolean']['output']; + id: Scalars['Int']['output']; + locale: Scalars['String']['output']; + name: Scalars['String']['output']; + protected: Scalars['Boolean']['output']; + time_24: Scalars['Boolean']['output']; + timezone: Scalars['String']['output']; + updated: Scalars['DateTime']['output']; +}; + +export type ShowCoreLanguagesObj = { + __typename?: 'ShowCoreLanguagesObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowCoreLanguagesSortByArgs = { + column: ShowCoreLanguagesSortingColumnEnum | `${ShowCoreLanguagesSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowCoreLanguagesSortingColumnEnum = { + created: 'created', + updated: 'updated' +} as const; + +export type ShowCoreLanguagesSortingColumnEnum = typeof ShowCoreLanguagesSortingColumnEnum[keyof typeof ShowCoreLanguagesSortingColumnEnum]; +export type ShowCoreMembers = { + __typename?: 'ShowCoreMembers'; + avatar?: Maybe; + avatar_color: Scalars['String']['output']; + group: GroupUser; + id: Scalars['Int']['output']; + joined: Scalars['DateTime']['output']; + language: Scalars['String']['output']; + name: Scalars['String']['output']; + name_seo: Scalars['String']['output']; + posts: Scalars['Int']['output']; +}; + +export type ShowCoreMembersObj = { + __typename?: 'ShowCoreMembersObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowCoreMembersSortByArgs = { + column: ShowCoreMembersSortingColumnEnum | `${ShowCoreMembersSortingColumnEnum}`; + direction: SortDirectionEnum | `${SortDirectionEnum}`; +}; + +export const ShowCoreMembersSortingColumnEnum = { + first_name: 'first_name', + followers: 'followers', + joined: 'joined', + last_name: 'last_name', + name: 'name', + posts: 'posts', + reactions: 'reactions' +} as const; + +export type ShowCoreMembersSortingColumnEnum = typeof ShowCoreMembersSortingColumnEnum[keyof typeof ShowCoreMembersSortingColumnEnum]; +export type ShowCoreMiddlewareObj = { + __typename?: 'ShowCoreMiddlewareObj'; + authorization: AuthorizationCoreMiddleware; + editor: EditorShowCoreMiddleware; + languages: Array; + plugins: Array; + security: SecurityCoreMiddleware; +}; + +export type ShowCoreNav = { + __typename?: 'ShowCoreNav'; + children: Array; + description: Array; + external: Scalars['Boolean']['output']; + href: Scalars['String']['output']; + icon?: Maybe; + id: Scalars['Int']['output']; + name: Array; + position: Scalars['Int']['output']; +}; + +export type ShowCoreNavItem = { + __typename?: 'ShowCoreNavItem'; + description: Array; + external: Scalars['Boolean']['output']; + href: Scalars['String']['output']; + icon?: Maybe; + id: Scalars['Int']['output']; + name: Array; + position: Scalars['Int']['output']; +}; + +export type ShowCoreNavObj = { + __typename?: 'ShowCoreNavObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowCorePluginsObj = { + __typename?: 'ShowCorePluginsObj'; + allow_default: Scalars['Boolean']['output']; + code: Scalars['String']['output']; +}; + +export type ShowCoreSessionDevicesObj = { + __typename?: 'ShowCoreSessionDevicesObj'; + created: Scalars['DateTime']['output']; + expires: Scalars['DateTime']['output']; + id: Scalars['Int']['output']; + ip_address: Scalars['String']['output']; + last_seen: Scalars['DateTime']['output']; + login_token: Scalars['String']['output']; + uagent_browser: Scalars['String']['output']; + uagent_os: Scalars['String']['output']; + uagent_version: Scalars['String']['output']; +}; + +export type ShowCoreTerms = { + __typename?: 'ShowCoreTerms'; + code: Scalars['String']['output']; + content: Array; + created: Scalars['DateTime']['output']; + href?: Maybe; + id: Scalars['Float']['output']; + title: Array; + updated: Scalars['DateTime']['output']; +}; + +export type ShowCoreTermsObj = { + __typename?: 'ShowCoreTermsObj'; + edges: Array; + pageInfo: PageInfo; +}; + +export type ShowCoreThemeEditorObj = { + __typename?: 'ShowCoreThemeEditorObj'; + colors?: Maybe; + logos: LogoShowCoreThemeEditor; +}; + +export type ShowSettingsObj = { + __typename?: 'ShowSettingsObj'; + site_copyright: Array; + site_description: Array; + site_name: Scalars['String']['output']; + site_short_name: Scalars['String']['output']; +}; + +export type SignUpCoreSessionsObj = { + __typename?: 'SignUpCoreSessionsObj'; + email: Scalars['String']['output']; + group_id: Scalars['Int']['output']; + name: Scalars['String']['output']; + newsletter?: Maybe; +}; + +export type SignUpStatsAdminMembers = { + __typename?: 'SignUpStatsAdminMembers'; + joined_date: Scalars['String']['output']; + users_joined: Scalars['Int']['output']; +}; + +export const SortDirectionEnum = { + asc: 'asc', + desc: 'desc' +} as const; + +export type SortDirectionEnum = typeof SortDirectionEnum[keyof typeof SortDirectionEnum]; +export type StaffGroupUser = { + __typename?: 'StaffGroupUser'; + color?: Maybe; + group_name: Array; + id: Scalars['Int']['output']; +}; + +export type TextLanguage = { + __typename?: 'TextLanguage'; + language_code: Scalars['String']['output']; + value: Scalars['String']['output']; +}; + +export type TextLanguageInput = { + language_code: Scalars['String']['input']; + value: Scalars['String']['input']; +}; + +export type ThemeVariable = { + __typename?: 'ThemeVariable'; + dark: HslColor; + light: HslColor; +}; + +export type ThemeVariableInput = { + dark: HslColorInput; + light: HslColorInput; +}; + +export type UploadAvatarCoreMembersObj = { + __typename?: 'UploadAvatarCoreMembersObj'; + dir_folder: Scalars['String']['output']; + extension: Scalars['String']['output']; + file_name: Scalars['String']['output']; + file_name_original: Scalars['String']['output']; + file_size: Scalars['Int']['output']; + height?: Maybe; + id: Scalars['Int']['output']; + mimetype: Scalars['String']['output']; + width?: Maybe; +}; + +export type UploadCoreFilesObj = { + __typename?: 'UploadCoreFilesObj'; + dir_folder: Scalars['String']['output']; + extension: Scalars['String']['output']; + file_name: Scalars['String']['output']; + file_name_original: Scalars['String']['output']; + file_size: Scalars['Int']['output']; + height?: Maybe; + mimetype: Scalars['String']['output']; + width?: Maybe; +}; + +export type UploadWithKeepCoreFilesArgs = { + file?: InputMaybe; + keep?: InputMaybe; +}; + +export type User = { + __typename?: 'User'; + avatar?: Maybe; + avatar_color: Scalars['String']['output']; + group: GroupUser; + id: Scalars['Int']['output']; + language: Scalars['String']['output']; + name: Scalars['String']['output']; + name_seo: Scalars['String']['output']; +}; + +export type UserOrGroupCoreStaffUnion = StaffGroupUser | User; diff --git a/packages/backend/src/main.ts b/packages/backend/src/main.ts index 3aaf2f331..f6a705499 100644 --- a/packages/backend/src/main.ts +++ b/packages/backend/src/main.ts @@ -1,8 +1,10 @@ +/* eslint-disable no-console */ import { INestApplication, ValidationPipe } from '@nestjs/common'; import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface'; import cookieParser from 'cookie-parser'; import helmet from 'helmet'; +import { execShellCommand } from './functions'; import { graphqlUploadExpress, ProcessRequestOptions, @@ -17,7 +19,7 @@ interface Args { graphqlUpload?: ProcessRequestOptions; } -export const nestjsMainApp = (app: INestApplication, options?: Args) => { +export const nestjsMainApp = async (app: INestApplication, options?: Args) => { app.use(cookieParser()); app.use( helmet({ @@ -30,6 +32,9 @@ export const nestjsMainApp = (app: INestApplication, options?: Args) => { ...options?.cors, credentials: true, origin: [ + process.env.NEXT_PUBLIC_FRONTEND_URL + ? process.env.NEXT_PUBLIC_FRONTEND_URL + : 'http://localhost:3000', 'https://sandbox.embed.apollographql.com', ...(options?.cors?.origin ?? []), ], @@ -48,4 +53,26 @@ export const nestjsMainApp = (app: INestApplication, options?: Args) => { ...options?.graphqlUpload, }), ); + + const port = Number(process.env.PORT) || 8080; + const hostname = process.env.HOSTNAME ?? 'localhost'; + await app.listen(port, hostname, async () => { + const initConsole = '\x1b[34m[VitNode]\x1b[0m'; + + try { + console.log( + initConsole, + 'GraphQL API is generating, please wait for a moment...', + ); + + await execShellCommand('npm run codegen'); + } catch (error) { + console.error(initConsole, error); + } + + console.log( + initConsole, + `Application is running on: http://${hostname}:${port}/graphql`, + ); + }); }; diff --git a/packages/create-vitnode-app/templates/basic/apps/backend/src/main.ts b/packages/create-vitnode-app/templates/basic/apps/backend/src/main.ts index 9eaa95a11..90dae4c7a 100644 --- a/packages/create-vitnode-app/templates/basic/apps/backend/src/main.ts +++ b/packages/create-vitnode-app/templates/basic/apps/backend/src/main.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import { INestApplication } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { nestjsMainApp } from 'vitnode-backend'; @@ -8,20 +7,7 @@ import { AppModule } from './app.module'; async function bootstrap() { const app: INestApplication = await NestFactory.create(AppModule); - nestjsMainApp(app, { - cors: { - origin: [ - process.env.NEXT_PUBLIC_FRONTEND_URL - ? process.env.NEXT_PUBLIC_FRONTEND_URL - : 'http://localhost:3000', - ], - }, - }); - - const port = Number(process.env.PORT) || 8080; - await app.listen(port, '', () => { - console.log(`Application is running on: http://localhost:${port}/graphql`); - }); + void nestjsMainApp(app, {}); } void bootstrap(); diff --git a/packages/eslint-config-typescript-vitnode/eslint.frontend.mjs b/packages/eslint-config-typescript-vitnode/eslint.frontend.mjs index b5b164bc4..6d2d61fce 100644 --- a/packages/eslint-config-typescript-vitnode/eslint.frontend.mjs +++ b/packages/eslint-config-typescript-vitnode/eslint.frontend.mjs @@ -22,6 +22,11 @@ export default [ }, }, { - ignores: ['tailwind.config.ts', 'postcss.config.mjs'], + ignores: [ + 'tailwind.config.ts', + 'postcss.config.mjs', + 'graphql', + 'src/graphql/types.ts', + ], }, ]; diff --git a/packages/eslint-config-typescript-vitnode/eslint.react.mjs b/packages/eslint-config-typescript-vitnode/eslint.react.mjs index b959129dd..1769ee3bf 100644 --- a/packages/eslint-config-typescript-vitnode/eslint.react.mjs +++ b/packages/eslint-config-typescript-vitnode/eslint.react.mjs @@ -22,13 +22,6 @@ export default [ }, }, { - ignores: [ - '.next', - 'global.d.ts', - '/graphql', - '/src/graphql', - 'plugins/**/*/graphql', - 'next.config.ts', - ], + ignores: ['.next', 'global.d.ts', 'next.config.ts'], }, ]; diff --git a/packages/frontend/src/components/data-table/toolbar/search.tsx b/packages/frontend/src/components/data-table/toolbar/search.tsx index b7ab196ae..99f85e86a 100644 --- a/packages/frontend/src/components/data-table/toolbar/search.tsx +++ b/packages/frontend/src/components/data-table/toolbar/search.tsx @@ -41,7 +41,7 @@ export const SearchToolbarDataTable = ({ return ( { const value = e.target.value; setValue(value); diff --git a/packages/frontend/src/views/admin/layout/admin-layout.tsx b/packages/frontend/src/views/admin/layout/admin-layout.tsx index af0bfc61d..87fede11b 100644 --- a/packages/frontend/src/views/admin/layout/admin-layout.tsx +++ b/packages/frontend/src/views/admin/layout/admin-layout.tsx @@ -1,5 +1,6 @@ import { getGlobalData } from '@/graphql/get-global-data'; import { getSessionAdminData } from '@/graphql/get-session-admin'; +import { redirect } from '@/navigation'; import { Metadata } from 'next'; import { getTranslations } from 'next-intl/server'; @@ -26,15 +27,23 @@ export const AdminLayout = async ({ }: { children: React.ReactNode; }) => { - const data = await getSessionAdminData(); + try { + const data = await getSessionAdminData(); - return ( - - - -
-
{children}
-
-
- ); + return ( + + + +
+
{children}
+
+
+ ); + } catch (err) { + if (err instanceof Error && err.message === 'ACCESS_DENIED') { + redirect('/admin'); + } + + throw err; + } }; diff --git a/packages/frontend/src/views/admin/views/theme_editor/theme-editor-view.tsx b/packages/frontend/src/views/admin/views/theme_editor/theme-editor-view.tsx index fc2d028dd..1bd69a92d 100644 --- a/packages/frontend/src/views/admin/views/theme_editor/theme-editor-view.tsx +++ b/packages/frontend/src/views/admin/views/theme_editor/theme-editor-view.tsx @@ -31,11 +31,22 @@ export const generateMetadataThemeEditor = async (): Promise => { }; export const ThemeEditorView = async () => { - const [data, session] = await Promise.all([getData(), getSessionAdminData()]); - - if (!session.admin__sessions__authorization.user) { - redirect('/admin'); + try { + const [data, session] = await Promise.all([ + getData(), + getSessionAdminData(), + ]); + + if (!session.admin__sessions__authorization.user) { + redirect('/admin'); + } + + return ; + } catch (err) { + if (err instanceof Error && err.message === 'ACCESS_DENIED') { + redirect('/admin'); + } + + throw err; } - - return ; };