Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
126 lines
3.4 KiB
Plaintext
126 lines
3.4 KiB
Plaintext
---
|
||
title: 文件夹架构
|
||
info: 详细了解我们的服务器文件夹架构
|
||
---
|
||
|
||
后端目录结构如下:
|
||
|
||
```
|
||
server
|
||
└───ability
|
||
└───constants
|
||
└───core
|
||
└───database
|
||
└───decorators
|
||
└───filters
|
||
└───guards
|
||
└───health
|
||
└───integrations
|
||
└───metadata
|
||
└───workspace
|
||
└───utils
|
||
```
|
||
|
||
## 能力
|
||
|
||
定义权限并为每个实体提供处理程序。
|
||
|
||
## 装饰器
|
||
|
||
为增强功能在NestJS中定义自定义装饰器。
|
||
|
||
有关更多详细信息,请参阅[自定义装饰器](https://docs.nestjs.com/custom-decorators)。
|
||
|
||
## 过滤器
|
||
|
||
包含异常过滤器,以处理可能在GraphQL端点中出现的异常。
|
||
|
||
## 守卫
|
||
|
||
有关更多详细信息,请参见[守卫](https://docs.nestjs.com/guards)。
|
||
|
||
## 健康
|
||
|
||
包含一个公开可用的REST API(healthz),返回JSON以确认数据库是否按预期工作。
|
||
|
||
## 元数据
|
||
|
||
定义自定义对象并提供GraphQL API(graphql/metadata)。
|
||
|
||
## 工作区
|
||
|
||
生成并提供基于元数据的自定义GraphQL架构。
|
||
|
||
### 工作空间目录结构
|
||
|
||
```
|
||
workspace
|
||
|
||
└───workspace-schema-builder
|
||
└───factories
|
||
└───graphql-types
|
||
└───database
|
||
└───interfaces
|
||
└───object-definitions
|
||
└───services
|
||
└───storage
|
||
└───utils
|
||
└───workspace-resolver-builder
|
||
└───factories
|
||
└───interfaces
|
||
└───workspace-query-builder
|
||
└───factories
|
||
└───interfaces
|
||
└───workspace-query-runner
|
||
└───interfaces
|
||
└───utils
|
||
└───workspace-datasource
|
||
└───workspace-manager
|
||
└───workspace-migration-runner
|
||
└───utils
|
||
└───workspace.module.ts
|
||
└───workspace.factory.spec.ts
|
||
└───workspace.factory.ts
|
||
```
|
||
|
||
工作空间目录的根目录包含`workspace.factory.ts`,其中包含`createGraphQLSchema`函数。 此函数通过使用元数据为各个工作空间定制架构来生成工作空间特定的架构。 通过分离架构和解析程序的构建,我们使用`makeExecutableSchema`函数,该函数结合这些离散元素。
|
||
|
||
这个策略不仅仅是关于组织,它还有助于优化,比如缓存生成的类型定义以提高性能和可扩展性。
|
||
|
||
### 工作空间架构生成器
|
||
|
||
生成GraphQL架构,并包括:
|
||
|
||
#### 工厂:
|
||
|
||
专门的构造函数用于生成与GraphQL相关的结构。
|
||
|
||
* type.factory使用`TypeMapperService`将字段元数据翻译为GraphQL类型。
|
||
* type-definition.factory创建从`objectMetadata`派生的GraphQL输入或输出对象。
|
||
|
||
#### GraphQL类型
|
||
|
||
包括枚举、输入、对象和标量,并作为架构构建的基石。
|
||
|
||
#### 接口和对象定义
|
||
|
||
包含GraphQL实体的蓝图,包括诸如`MONEY`或`URL`之类的预定义和自定义类型。
|
||
|
||
#### 服务
|
||
|
||
包含负责将FieldMetadataType与其适当GraphQL标量或查询修饰符相关联的服务。
|
||
|
||
#### 存储
|
||
|
||
包含`TypeDefinitionsStorage`类,其中包含可重用的类型定义,防止重复GraphQL类型。
|
||
|
||
### 工作空间解析器生成器
|
||
|
||
创建用于查询和修改GraphQL架构的解析器函数。
|
||
|
||
此目录中的每个工厂负责生成不同类型的解析器,如`FindManyResolverFactory`,旨在跨各种表灵活应用。
|
||
|
||
### 工作空间查询运行器
|
||
|
||
在数据库上运行生成的查询并解析结果。
|