Force draft when submitting awtis & teks
This commit is contained in:
@@ -1,8 +1,26 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const {default: createStrapi} = require('strapi');
|
||||||
|
const {parseMultipartData, sanitizeEntity} = require('strapi-utils')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
|
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
|
||||||
* to customize this controller
|
* to customize this controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {};
|
module.exports = {
|
||||||
|
async create(ctx) {
|
||||||
|
let entity
|
||||||
|
if (ctx.is('multipart')) {
|
||||||
|
let {data} = parseMultipartData(ctx)
|
||||||
|
data.published_at = null
|
||||||
|
entity = await createStrapi.services.awtis.create(data)
|
||||||
|
} else {
|
||||||
|
let {body} = ctx.request
|
||||||
|
body.published_at = null
|
||||||
|
entity = await strapi.services.awtis.create(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
return sanitizeEntity(entity, {model: strapi.models.awtis})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,26 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const {default: createStrapi} = require('strapi');
|
||||||
|
const {parseMultipartData, sanitizeEntity} = require('strapi-utils')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
|
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
|
||||||
* to customize this controller
|
* to customize this controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {};
|
module.exports = {
|
||||||
|
async create(ctx) {
|
||||||
|
let entity
|
||||||
|
if (ctx.is('multipart')) {
|
||||||
|
let {data} = parseMultipartData(ctx)
|
||||||
|
data.published_at = null
|
||||||
|
entity = await createStrapi.services.teks.create(data)
|
||||||
|
} else {
|
||||||
|
let {body} = ctx.request
|
||||||
|
body.published_at = null
|
||||||
|
entity = await strapi.services.teks.create(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
return sanitizeEntity(entity, {model: strapi.models.teks})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user