看看schema visualizer:
的数据
这是我的请求:
const { data } = await supabase.from('teams').select(`
*,
members:profiles (
*,
roles (
name
),
members(
isTeamLeader
)
)
`)
字符串
我得到的响应是一个具有以下结构的对象数组:
{
"id": "team_id",
"created_at": "timestamp",
"name": "team_name",
"members": [
{
"first_name": "profile_first_name",
"last_name": "profile_last_name",
"user_id": "user_id",
"created_at": "timestamp",
"id": "profile_id",
"avatar_id": null,
"bio": "profile_bio",
"roles": [
{
"name": "role_name"
}
],
"members": [
{
"isTeamLeader": true
}
]
}
]
}
型
我想得到其他响应结构。特别是:
{
"id": "team_id",
"created_at": "timestamp",
"name": "team_name",
"members": [
{
"first_name": "profile_first_name",
"last_name": "profile_last_name",
"user_id": "user_id",
"created_at": "timestamp",
"id": "profile_id",
"avatar_id": null,
"bio": "profile_bio",
"role_name": "role_name",
"isTeamLeader": true
}
]
}
型
我该如何改变我的请求以实现这一目标?
1条答案
按热度按时间oyxsuwqo1#
supabase-js
使用PostgREST。根据PostgREST文档,您可以使用省略号...
spread operator扩展嵌入的资源:字符串