API 应用程序的结构

API Structure for an application

我需要一些帮助来构建类似 https://pokeapi.co/ 的东西。

我尝试制作以下结构时遇到问题:

"forms": [
        {
            "url": "https://pokeapi.co/api/v2/pokemon-form/1/",
            "name": "bulbasaur"
        }
    ],
"stats": [
    {
        "stat": {
            "url": "https://pokeapi.co/api/v2/stat/6/",
            "name": "speed"
        },
        "effort": 0,
        "base_stat": 45
    },
]

当我有一个关系字段如表单时,Directus 工作正常(为表单创建一个新的关系字段,获取 Bulbasaur,完成)

我会构建 monsterstat table,我需要为关系字段 stat 赋值(在这种情况下,speed) 共 45.

我尝试 fiddle 使用 Directus,但没有成功。

嗨,安德烈——这似乎更像是一个数据库架构问题。但这是我会使用的模式:

  • 怪物
    • id
    • 姓名
    • stats (别名:Many-to-Many接口关系)
  • monster_stats(结table为many-to-many)

    • id
    • monster_id
    • stat_id
  • 统计数据

    • id
    • 名字
    • 努力
    • base_stat