graphql-engine/server/testcases/author_article_category.json
2018-06-28 00:32:00 +05:30

199 lines
4.3 KiB
JSON

{
"description": "author article category schema",
"depends": [],
"items": [
{
"name": "create author table",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"name": "author",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "varchar",
"name": "email"
},
{
"type": "varchar",
"name": "name"
},
{
"type": "integer",
"name": "auth_id"
}
]
}
}
},
{
"name": "create category table",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"__type": "create_table",
"name": "category",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "text",
"name": "description"
},
{
"type": "varchar",
"name": "name"
}
]
}
}
},
{
"name": "create article table",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_table",
"body": {
"primary_key": [
"id"
],
"__type": "create_table",
"name": "article",
"columns": [
{
"type": "serial",
"name": "id"
},
{
"type": "numeric",
"name": "rating"
},
{
"type": "text",
"name": "title"
},
{
"type": "text",
"name": "content"
},
{
"type": "integer",
"references": {
"column": "id",
"table": "author"
},
"name": "author_id"
},
{
"type": "integer",
"references": {
"column": "id",
"table": "category"
},
"name": "category_id"
},
{
"type": "boolean",
"name": "is_published"
}
]
}
}
},
{
"name": "create author->article",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_object_relationship",
"body": {
"using": "author_id",
"name": "author",
"table": "article"
}
}
},
{
"name": "create article->category",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_object_relationship",
"body": {
"using": "category_id",
"name": "category",
"table": "article"
}
}
},
{
"name": "create author->articles",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_array_relationship",
"body": {
"using": {
"column": "author_id",
"table": "article"
},
"name": "articles",
"table": "author"
}
}
},
{
"name": "create category->articles",
"url": "/api/1/query",
"role": "admin",
"status_code": 200,
"method": "POST",
"user_id": "1",
"request": {
"kind": "create_array_relationship",
"body": {
"using": {
"column": "category_id",
"table": "article"
},
"name": "articles",
"table": "category"
}
}
}
]
}