如何将Unique键作为loopback模型中3列的组合 模型结构就像
"properties": {
"year": {
"type": "number",
"required": true
},
"user_id": {
"type": "number",
"required": true
},
"leave_type_id": {
"type": "number",
"required": true
},
"total_days": {
"type": "number",
"required": true
}
},
对我来说,年份,User_id,leave_type_id组合将是一个唯一的密钥。我怎么能在环回模型定义中提到
答案 0 :(得分:4)
在字段上定义多个id
属性。
...
"user_id": {
"id": 1, //add this
"type": "number",
"required": true
},
"leave_type_id": {
"id": 2, //add this
"type": "number",
"required": true
},
...