mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Change models
This commit is contained in:
parent
80a774a9f7
commit
b7b6bef5f3
@ -16,38 +16,79 @@
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
"required": true,
|
||||
"unique": true
|
||||
},
|
||||
"shortdescription": {
|
||||
"type": "text"
|
||||
"content": {
|
||||
"type": "richtext",
|
||||
"default": "content"
|
||||
},
|
||||
"published": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
"type": "boolean"
|
||||
},
|
||||
"json": {
|
||||
"type": "json"
|
||||
},
|
||||
"cover": {
|
||||
"number": {
|
||||
"type": "integer"
|
||||
},
|
||||
"big_number": {
|
||||
"type": "biginteger"
|
||||
},
|
||||
"float_number": {
|
||||
"type": "float"
|
||||
},
|
||||
"decimal_number": {
|
||||
"type": "decimal"
|
||||
},
|
||||
"date": {
|
||||
"type": "date"
|
||||
},
|
||||
"enum": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
"morning,",
|
||||
"noon"
|
||||
]
|
||||
},
|
||||
"bool": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"pic": {
|
||||
"model": "file",
|
||||
"via": "related",
|
||||
"plugin": "upload"
|
||||
},
|
||||
"preview": {
|
||||
"model": "file",
|
||||
"pictures": {
|
||||
"collection": "file",
|
||||
"via": "related",
|
||||
"plugin": "upload"
|
||||
},
|
||||
"content": {
|
||||
"type": "richtext"
|
||||
"mainTag": {
|
||||
"model": "tag"
|
||||
},
|
||||
"tags": {
|
||||
"linkedTags": {
|
||||
"collection": "tag"
|
||||
},
|
||||
"manyTags": {
|
||||
"collection": "tag",
|
||||
"via": "articles"
|
||||
"via": "linkedArticles",
|
||||
"dominant": true
|
||||
},
|
||||
"recipe": {
|
||||
"model": "recipe",
|
||||
"via": "articles"
|
||||
"fb_cta": {
|
||||
"type": "group",
|
||||
"group": "facebook_cta"
|
||||
},
|
||||
"mainIngredient": {
|
||||
"type": "group",
|
||||
"group": "ingredients"
|
||||
},
|
||||
"ingredients": {
|
||||
"type": "group",
|
||||
"group": "ingredients",
|
||||
"repeatable": true,
|
||||
"min": 1,
|
||||
"max": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
{
|
||||
"routes": [
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/recipes",
|
||||
"handler": "Recipe.find",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/recipes/count",
|
||||
"handler": "Recipe.count",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/recipes/:id",
|
||||
"handler": "Recipe.findOne",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"path": "/recipes",
|
||||
"handler": "Recipe.create",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "PUT",
|
||||
"path": "/recipes/:id",
|
||||
"handler": "Recipe.update",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"path": "/recipes/:id",
|
||||
"handler": "Recipe.delete",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/guides/controllers.html#core-controllers)
|
||||
* to customize this controller
|
||||
*/
|
||||
|
||||
module.exports = {};
|
||||
@ -1,44 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Lifecycle callbacks for the `Recipe` model.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
// Before saving a value.
|
||||
// Fired before an `insert` or `update` query.
|
||||
// beforeSave: async (model, attrs, options) => {},
|
||||
// After saving a value.
|
||||
// Fired after an `insert` or `update` query.
|
||||
// afterSave: async (model, response, options) => {},
|
||||
// Before fetching a value.
|
||||
// Fired before a `fetch` operation.
|
||||
// beforeFetch: async (model, columns, options) => {},
|
||||
// After fetching a value.
|
||||
// Fired after a `fetch` operation.
|
||||
// afterFetch: async (model, response, options) => {},
|
||||
// Before fetching all values.
|
||||
// Fired before a `fetchAll` operation.
|
||||
// beforeFetchAll: async (model, columns, options) => {},
|
||||
// After fetching all values.
|
||||
// Fired after a `fetchAll` operation.
|
||||
// afterFetchAll: async (model, response, options) => {},
|
||||
// Before creating a value.
|
||||
// Fired before an `insert` query.
|
||||
// beforeCreate: async (model, attrs, options) => {},
|
||||
// After creating a value.
|
||||
// Fired after an `insert` query.
|
||||
// afterCreate: async (model, attrs, options) => {},
|
||||
// Before updating a value.
|
||||
// Fired before an `update` query.
|
||||
// beforeUpdate: async (model, attrs, options) => {},
|
||||
// After updating a value.
|
||||
// Fired after an `update` query.
|
||||
// afterUpdate: async (model, attrs, options) => {},
|
||||
// Before destroying a value.
|
||||
// Fired before a `delete` query.
|
||||
// beforeDestroy: async (model, attrs, options) => {},
|
||||
// After destroying a value.
|
||||
// Fired after a `delete` query.
|
||||
// afterDestroy: async (model, attrs, options) => {}
|
||||
};
|
||||
@ -1,44 +0,0 @@
|
||||
{
|
||||
"connection": "default",
|
||||
"collectionName": "recipes",
|
||||
"info": {
|
||||
"name": "recipe",
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
"increments": true,
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"comment": ""
|
||||
},
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"ingredients": {
|
||||
"group": "ingredient",
|
||||
"required": true,
|
||||
"repeatable": true,
|
||||
"type": "group"
|
||||
},
|
||||
"tools": {
|
||||
"group": "ingredient",
|
||||
"required": true,
|
||||
"repeatable": true,
|
||||
"type": "group"
|
||||
},
|
||||
"mainIngredient": {
|
||||
"group": "ingredient",
|
||||
"type": "group"
|
||||
},
|
||||
"articles": {
|
||||
"collection": "article",
|
||||
"via": "recipe"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/guides/services.html#core-services)
|
||||
* to customize this service
|
||||
*/
|
||||
|
||||
module.exports = {};
|
||||
@ -7,17 +7,18 @@
|
||||
},
|
||||
"options": {
|
||||
"increments": true,
|
||||
"timestamps": true,
|
||||
"comment": ""
|
||||
"timestamps": false
|
||||
},
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"articles": {
|
||||
"linkedArticles": {
|
||||
"collection": "article",
|
||||
"dominant": true,
|
||||
"via": "tags"
|
||||
"via": "manyTags"
|
||||
},
|
||||
"date": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
examples/getstarted/groups/facebook_cta.json
Normal file
24
examples/getstarted/groups/facebook_cta.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"info": {
|
||||
"name": "Facebook CTA",
|
||||
"description": "test"
|
||||
},
|
||||
"connection": "default",
|
||||
"collectionName": "cta_facebook_aa",
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"wysiwyg": {
|
||||
"required": true,
|
||||
"maxLength": 5,
|
||||
"type": "richtext"
|
||||
},
|
||||
"newwysiwyg": {
|
||||
"type": "richtext"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
{
|
||||
"info": {
|
||||
"name": "ingredient",
|
||||
"description": ""
|
||||
},
|
||||
"connection": "default",
|
||||
"collectionName": "groups_ingredients",
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pictures": {
|
||||
"collection": "file",
|
||||
"via": "related",
|
||||
"plugin": "upload",
|
||||
"required": false
|
||||
},
|
||||
"price": {
|
||||
"type": "decimal"
|
||||
},
|
||||
"tags": {
|
||||
"collection": "tag"
|
||||
}
|
||||
}
|
||||
}
|
||||
34
examples/getstarted/groups/ingredients.json
Normal file
34
examples/getstarted/groups/ingredients.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"info": {
|
||||
"name": "Ingredients",
|
||||
"description": ""
|
||||
},
|
||||
"connection": "default",
|
||||
"collectionName": "group_ingredients",
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"quantity": {
|
||||
"type": "float",
|
||||
"required": true
|
||||
},
|
||||
"enum": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
"morning",
|
||||
"noon"
|
||||
]
|
||||
},
|
||||
"pic": {
|
||||
"model": "file",
|
||||
"via": "related",
|
||||
"plugin": "upload",
|
||||
"required": false
|
||||
},
|
||||
"article": {
|
||||
"model": "article"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
{
|
||||
"info": {
|
||||
"name": "tool",
|
||||
"description": ""
|
||||
},
|
||||
"connection": "default",
|
||||
"collectionName": "groups_tools",
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user