Create Teks collection
This commit is contained in:
@@ -32,8 +32,8 @@
|
|||||||
"component": "url.liens"
|
"component": "url.liens"
|
||||||
},
|
},
|
||||||
"awtis": {
|
"awtis": {
|
||||||
"collection": "awtis",
|
"via": "miziks",
|
||||||
"via": "miziks"
|
"collection": "awtis"
|
||||||
},
|
},
|
||||||
"kouteyAchtey": {
|
"kouteyAchtey": {
|
||||||
"type": "component",
|
"type": "component",
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/teks",
|
||||||
|
"handler": "teks.find",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/teks/count",
|
||||||
|
"handler": "teks.count",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/teks/:id",
|
||||||
|
"handler": "teks.findOne",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/teks",
|
||||||
|
"handler": "teks.create",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/teks/:id",
|
||||||
|
"handler": "teks.update",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/teks/:id",
|
||||||
|
"handler": "teks.delete",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
|
||||||
|
* to customize this controller
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {};
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const slugify = require('slugify')
|
||||||
|
|
||||||
|
const jwennAwtisEpiId = async data => {
|
||||||
|
const awtis = await strapi.query('awtis').find({_id: data})
|
||||||
|
return awtis.map(a => a.alias).join('-')
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
lifecycles: {
|
||||||
|
beforeCreate: async data => {
|
||||||
|
if (data.tit) {
|
||||||
|
const awtis = await jwennAwtisEpiId(data.awtis)
|
||||||
|
data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeUpdate: async (params, data) => {
|
||||||
|
if (data.tit) {
|
||||||
|
const awtis = await jwennAwtisEpiId(data.awtis)
|
||||||
|
data.slug = slugify(`${awtis}-${data.tit}`, {lower: true, remove: /[*#+~.()'"!:@]/g})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"kind": "collectionType",
|
||||||
|
"collectionName": "teks",
|
||||||
|
"info": {
|
||||||
|
"name": "Teks",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"increments": true,
|
||||||
|
"timestamps": true,
|
||||||
|
"draftAndPublish": true
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"tit": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"transkripsyon": {
|
||||||
|
"type": "richtext"
|
||||||
|
},
|
||||||
|
"tradiksyon": {
|
||||||
|
"type": "component",
|
||||||
|
"repeatable": false,
|
||||||
|
"component": "trad.traductions"
|
||||||
|
},
|
||||||
|
"lanne": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"lyen": {
|
||||||
|
"type": "component",
|
||||||
|
"repeatable": false,
|
||||||
|
"component": "url.liens"
|
||||||
|
},
|
||||||
|
"awtis": {
|
||||||
|
"via": "teks",
|
||||||
|
"collection": "awtis",
|
||||||
|
"dominant": true
|
||||||
|
},
|
||||||
|
"kouteyAchtey": {
|
||||||
|
"type": "component",
|
||||||
|
"repeatable": false,
|
||||||
|
"component": "store.store"
|
||||||
|
},
|
||||||
|
"slug": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"kouveti": {
|
||||||
|
"model": "file",
|
||||||
|
"via": "related",
|
||||||
|
"allowedTypes": [
|
||||||
|
"images"
|
||||||
|
],
|
||||||
|
"plugin": "upload",
|
||||||
|
"required": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/services.html#core-services)
|
||||||
|
* to customize this service
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {};
|
||||||
Reference in New Issue
Block a user