我想要一个模型来代表我的 loopback 应用中的个人资料。但是,在环回中找到的内置用户模型只具有以下属性
扩展built-in User model
以插入更多属性的最佳方式是什么,例如phone number
,profile picture
和likes
?
答案 0 :(得分:2)
答案 1 :(得分:1)
创建一个新模型common / models / user.json
{
"name": "user",
"base": "User",
"idInjection": true,
"properties": {
"firstName"{
"type":"string",
"required":true
}
}
"restrictResetPasswordTokenScope": true,
"emailVerificationRequired": true,
"validations": [],
"relations": {},
"acls": [
{
"principalType": "ROLE",
"principalId": "$everyone",
"accessType": "READ",
"permission": "ALLOW"
}
],
"methods": []
}
将此添加到model-config.json
"user":
"dataSource": "yourDataSource"
}
希望这适合你