Loopbackjs 如何验证环回中的[';uuid';,';uuid';]数组,以及每个uuid必须是使用Postgres数据库的另一个模型id的引用?
我有这样的环回模型:Loopbackjs 如何验证环回中的[';uuid';,';uuid';]数组,以及每个uuid必须是使用Postgres数据库的另一个模型id的引用?,loopbackjs,loopback,loopback4,Loopbackjs,Loopback,Loopback4,我有这样的环回模型: Model A { Properties { "name": { "type": "string", "length": 255 }, "B_ids": [ "string" ] } } -----------------------------------------------------------
Model A
{
Properties
{
"name": {
"type": "string",
"length": 255
},
"B_ids": [
"string"
]
}
}
-------------------------------------------------------------------------------------------------------
Model B
{
Properties
{
"name": {
"type": "string",
"length": 255
},
"id": {
"type": "string",
"id": true,
"required": true,
"defaultFn": "uuidv4",
"postgresql": {
"dataType": "uuid"
}
}
}
}
这里我需要验证所请求的B_id数组数据。与此类似,数组中的所有项都应该是UUID
{"name":"Jone",
"B_ids":["5a555db7-cc68-4e0d-8db5-f2cecbd63e6b","7i894db7-0c68-4o0d-t6b5-f2cecbd6u569v"]
}
每个项目都必须出现在#模型B的表格中。
我已经花了很多时间寻找解决方案,但没有为我工作。请帮助我了解如何在环回中实现这一点