mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 14:44:31 +00:00
Update snapshots
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
193bd5af0e
commit
3cb66f6566
@ -99,20 +99,29 @@ module.exports = {
|
||||
|
||||
const { model } = ctx.params;
|
||||
|
||||
if (ctx.is('multipart')) {
|
||||
const { data, files } = parseMultipartBody(ctx);
|
||||
ctx.body = await contentManagerService.create(data, {
|
||||
files,
|
||||
model,
|
||||
});
|
||||
} else {
|
||||
// Create an entry using `queries` system
|
||||
ctx.body = await contentManagerService.create(ctx.request.body, {
|
||||
model,
|
||||
});
|
||||
}
|
||||
try {
|
||||
if (ctx.is('multipart')) {
|
||||
const { data, files } = parseMultipartBody(ctx);
|
||||
ctx.body = await contentManagerService.create(data, {
|
||||
files,
|
||||
model,
|
||||
});
|
||||
} else {
|
||||
// Create an entry using `queries` system
|
||||
ctx.body = await contentManagerService.create(ctx.request.body, {
|
||||
model,
|
||||
});
|
||||
}
|
||||
|
||||
strapi.emit('didCreateFirstContentTypeEntry', ctx.params);
|
||||
strapi.emit('didCreateFirstContentTypeEntry', ctx.params);
|
||||
} catch (error) {
|
||||
strapi.log.error(error);
|
||||
ctx.badRequest(null, [
|
||||
{
|
||||
messages: [{ id: error.message, message: error.message, field: error.field }],
|
||||
},
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -123,17 +132,26 @@ module.exports = {
|
||||
|
||||
const contentManagerService = strapi.plugins['content-manager'].services.contentmanager;
|
||||
|
||||
if (ctx.is('multipart')) {
|
||||
const { data, files } = parseMultipartBody(ctx);
|
||||
ctx.body = await contentManagerService.edit({ id }, data, {
|
||||
files,
|
||||
model,
|
||||
});
|
||||
} else {
|
||||
// Return the last one which is the current model.
|
||||
ctx.body = await contentManagerService.edit({ id }, ctx.request.body, {
|
||||
model,
|
||||
});
|
||||
try {
|
||||
if (ctx.is('multipart')) {
|
||||
const { data, files } = parseMultipartBody(ctx);
|
||||
ctx.body = await contentManagerService.edit({ id }, data, {
|
||||
files,
|
||||
model,
|
||||
});
|
||||
} else {
|
||||
// Return the last one which is the current model.
|
||||
ctx.body = await contentManagerService.edit({ id }, ctx.request.body, {
|
||||
model,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
strapi.log.error(error);
|
||||
ctx.badRequest(null, [
|
||||
{
|
||||
messages: [{ id: error.message, message: error.message, field: error.field }],
|
||||
},
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
exports[`Content types service format ContentType Returns consistent schemas 1`] = `
|
||||
Object {
|
||||
"apiID": "my-name",
|
||||
"plugin": "some-plugin",
|
||||
"schema": Object {
|
||||
"attributes": Object {
|
||||
|
||||
@ -7,6 +7,7 @@ describe('Content types service', () => {
|
||||
kind: 'singleType',
|
||||
plugin: 'some-plugin',
|
||||
connection: 'default',
|
||||
modelName: 'my-name',
|
||||
collectionName: 'tests',
|
||||
info: {
|
||||
name: 'My name',
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
exports[`Content Type Builder - Content types Collection Types Get collection type returns full schema and informations 1`] = `
|
||||
Object {
|
||||
"data": Object {
|
||||
"apiID": "test-collection-type",
|
||||
"schema": Object {
|
||||
"attributes": Object {
|
||||
"title": Object {
|
||||
@ -23,6 +24,7 @@ Object {
|
||||
exports[`Content Type Builder - Content types Single Types Get single type returns full schema and informations 1`] = `
|
||||
Object {
|
||||
"data": Object {
|
||||
"apiID": "test-single-type",
|
||||
"schema": Object {
|
||||
"attributes": Object {
|
||||
"title": Object {
|
||||
|
||||
@ -2400,7 +2400,7 @@
|
||||
resolved "https://registry.yarnpkg.com/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.2.tgz#8013f2af54a2b7d735f71560ff360d3a8176a87b"
|
||||
integrity sha512-vTCdPp/T/Q3oSqwHmZ5Kpa9oI7iLtGl3RQaA/NyLHikvcrPxACkkKVr/XzkSPJWXHRhKGzVvb0urJsbMlRxi1Q==
|
||||
|
||||
"@sindresorhus/slugify@^0.9.1":
|
||||
"@sindresorhus/slugify@0.9.1":
|
||||
version "0.9.1"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/slugify/-/slugify-0.9.1.tgz#892ad24d70b442c0a14fe519cb4019d59bc5069f"
|
||||
integrity sha512-b6heYM9dzZD13t2GOiEQTDE0qX+I1GyOotMwKh9VQqzuNiVdPVT8dM43fe9HNb/3ul+Qwd5oKSEDrDIfhq3bnQ==
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user