mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
Merge branch 'develop' into features/media-lib
This commit is contained in:
commit
ed2b973b99
@ -162,6 +162,38 @@ Here is the list of endpoints generated for each of your **Content Types**.
|
||||
|
||||
:::
|
||||
|
||||
::: tab Contact
|
||||
|
||||
`Contact` **Content Type**
|
||||
|
||||
<div id="endpoint-table">
|
||||
|
||||
| Method | Path | Description |
|
||||
| :----- | :--------- | :------------------------- |
|
||||
| GET | `/contact` | Get the contact content |
|
||||
| PUT | `/contact` | Update the contact content |
|
||||
| DELETE | `/contact` | Delete the contact content |
|
||||
|
||||
</div>
|
||||
|
||||
:::
|
||||
|
||||
::: tab About
|
||||
|
||||
`About` **Content Type**
|
||||
|
||||
<div id="endpoint-table">
|
||||
|
||||
| Method | Path | Description |
|
||||
| :----- | :------- | :----------------------- |
|
||||
| GET | `/about` | Get the about content |
|
||||
| PUT | `/about` | Update the about content |
|
||||
| DELETE | `/about` | Delete the about content |
|
||||
|
||||
</div>
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
|
||||
### Collection Types
|
||||
|
||||
@ -15,7 +15,7 @@ It's the origin purpose of the project.
|
||||
|
||||
### Custom content structure
|
||||
|
||||
With the admin panel of Strapi, You can generate the admin panel in just a few clicks, and get your whole CMS setup in a few minutes.
|
||||
You can generate the admin panel in a few clicks and get your whole CMS setup in a few minutes.
|
||||
|
||||
### Manage content
|
||||
|
||||
|
||||
@ -27,7 +27,11 @@ To create a project head over to the Strapi [listing on the marketplace](https:/
|
||||
|
||||
### Step 3: Visit your app
|
||||
|
||||
Please note that it may take anywhere from 30 seconds to a few minutes for the droplet to startup, when it does you should see it in your [droplets list](https://cloud.digitalocean.com/droplets). After the droplet has started, it will take a few more minutes to finish the Strapi installation.
|
||||
Please note that it may take anywhere from 30 seconds to a few minutes for the droplet to startup, when it does you should see it in your [droplets list](https://cloud.digitalocean.com/droplets).
|
||||
|
||||
::: warning
|
||||
After the droplet has started, it will take a few more minutes to finish the Strapi installation.
|
||||
:::
|
||||
|
||||
From here you will see the public ipv4 address that you can use to visit your Strapi application, just open that in a browser and it should ask you to create your first administrator!
|
||||
|
||||
@ -107,7 +111,7 @@ Please note that with this application it is intially created and ran in the `de
|
||||
|
||||
## Using the Service Account
|
||||
|
||||
By default the Strapi application will be running under a "service account", this is an account that is extremely limited into what it can do and access. The purpose of using a service account is to project your system from security threats.
|
||||
By default the Strapi application will be running under a "service account", this is an account that is extremely limited into what it can do and access. The purpose of using a service account is to help protect your system from security threats.
|
||||
|
||||
### Accessing the service account
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ By default, the [Shadow CRUD](#shadow-crud) feature is enabled and the GraphQL i
|
||||
|
||||
Security limits on maximum number of items in your response by default is limited to 100, however you can change this on the following config option `amountLimit`. This should only be changed after careful consideration of the drawbacks of a large query which can cause what would basically be a DDoS (Distributed Denial of Service). And may cause abnormal load on your Strapi server, as well as your database server.
|
||||
|
||||
You can also enable the Apollo server tracing feature, which is supported by the playground to track the response time of each part of your query. To enable this feature just change/add the `"tracing": true` option in the GraphQL settings file. You can read more about the tracing feature from Apollo [here](https://www.apollographql.com/docs/engine/features/query-tracing.html).
|
||||
You can also enable the Apollo server tracing feature, which is supported by the playground to track the response time of each part of your query. To enable this feature just change/add the `"tracing": true` option in the GraphQL settings file. You can read more about the tracing feature from Apollo [here](https://www.apollographql.com/docs/apollo-server/federation/metrics/).
|
||||
|
||||
You can edit these configurations by creating following file.
|
||||
|
||||
|
||||
@ -20,9 +20,8 @@ const populateFetch = (definition, options) => {
|
||||
} else if (_.isEmpty(options.withRelated)) {
|
||||
options.withRelated = populateComponents(definition);
|
||||
} else {
|
||||
options.withRelated = formatPopulateOptions(
|
||||
definition,
|
||||
options.withRelated
|
||||
options.withRelated = formatPopulateOptions(definition, options.withRelated).concat(
|
||||
populateComponents(definition)
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -173,9 +172,7 @@ const formatPopulateOptions = (definition, withRelated) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const assoc = tmpModel.associations.find(
|
||||
association => association.alias === part
|
||||
);
|
||||
const assoc = tmpModel.associations.find(association => association.alias === part);
|
||||
|
||||
if (!assoc) return acc;
|
||||
|
||||
|
||||
@ -52,11 +52,7 @@ const Wrapper = styled.tr`
|
||||
}
|
||||
}
|
||||
&.relation-row {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(28, 93, 231, 0.05),
|
||||
rgba(239, 243, 253, 0)
|
||||
);
|
||||
background: linear-gradient(135deg, rgba(28, 93, 231, 0.05), rgba(239, 243, 253, 0));
|
||||
}
|
||||
&.clickable {
|
||||
&:hover {
|
||||
|
||||
@ -33,7 +33,11 @@ const diffResolvers = (object, base) => {
|
||||
|
||||
Object.keys(object).forEach(type => {
|
||||
Object.keys(object[type]).forEach(resolver => {
|
||||
if (!_.has(base, [type, resolver])) {
|
||||
if(type === 'Query' || type === 'Mutation') {
|
||||
if (!_.has(base, [type, resolver])) {
|
||||
_.set(newObj, [type, resolver], _.get(object, [type, resolver]));
|
||||
}
|
||||
} else {
|
||||
_.set(newObj, [type, resolver], _.get(object, [type, resolver]));
|
||||
}
|
||||
});
|
||||
|
||||
@ -9,7 +9,25 @@ let graphqlQuery;
|
||||
let modelsUtils;
|
||||
|
||||
// utils
|
||||
const selectFields = doc => _.pick(doc, ['id', 'name']);
|
||||
const selectFields = doc => _.pick(doc, ['id', 'name', 'color']);
|
||||
|
||||
const rgbColorComponent = {
|
||||
attributes: {
|
||||
name: {
|
||||
type: 'text',
|
||||
},
|
||||
red: {
|
||||
type: 'integer',
|
||||
},
|
||||
green: {
|
||||
type: 'integer',
|
||||
},
|
||||
blue: {
|
||||
type: 'integer',
|
||||
},
|
||||
},
|
||||
name: 'rgbColor',
|
||||
};
|
||||
|
||||
const documentModel = {
|
||||
attributes: {
|
||||
@ -37,6 +55,11 @@ const labelModel = {
|
||||
target: 'application::document.document',
|
||||
targetAttribute: 'labels',
|
||||
},
|
||||
color: {
|
||||
type: 'component',
|
||||
component: 'default.rgb-color',
|
||||
repeatable: false,
|
||||
},
|
||||
},
|
||||
connection: 'default',
|
||||
name: 'label',
|
||||
@ -94,6 +117,7 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
|
||||
modelsUtils = createModelsUtils({ rq });
|
||||
|
||||
await modelsUtils.createComponent(rgbColorComponent);
|
||||
await modelsUtils.createContentTypes([documentModel, labelModel, carModel, personModel]);
|
||||
}, 60000);
|
||||
|
||||
@ -106,7 +130,11 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
people: [],
|
||||
cars: [],
|
||||
};
|
||||
const labelsPayload = [{ name: 'label 1' }, { name: 'label 2' }];
|
||||
const labelsPayload = [
|
||||
{ name: 'label 1', color: null },
|
||||
{ name: 'label 2', color: null },
|
||||
{ name: 'labelWithColor', color: { name: 'tomato', red: 255, green: 99, blue: 71 } },
|
||||
];
|
||||
const documentsPayload = [{ name: 'document 1' }, { name: 'document 2' }];
|
||||
|
||||
test.each(labelsPayload)('Create label %o', async label => {
|
||||
@ -116,6 +144,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
createLabel(input: $input) {
|
||||
label {
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,10 +161,8 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
},
|
||||
});
|
||||
|
||||
const { body } = res;
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(body).toEqual({
|
||||
expect(res.body).toEqual({
|
||||
data: {
|
||||
createLabel: {
|
||||
label,
|
||||
@ -146,6 +178,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
@ -161,7 +199,7 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
});
|
||||
|
||||
// assign for later use
|
||||
data.labels = res.body.data.labels;
|
||||
data.labels = data.labels.concat(res.body.data.labels);
|
||||
});
|
||||
|
||||
test.each(documentsPayload)('Create document linked to every labels %o', async document => {
|
||||
@ -174,6 +212,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,6 +259,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,6 +296,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
documents {
|
||||
id
|
||||
name
|
||||
@ -283,6 +339,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,6 +371,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -348,6 +416,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
label {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -382,6 +456,12 @@ describe('Test Graphql Relations API End to End', () => {
|
||||
labels {
|
||||
id
|
||||
name
|
||||
color {
|
||||
name
|
||||
red
|
||||
green
|
||||
blue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user