在 sails.js 上显示具有 3 个状态的好友列表
Display a list of friends with 3 states on sails.js
我刚用sails.js,不错
我有问题,请帮助我。
我有 2 个集合,它是一对多创建的,我想显示定义了 3 个状态的朋友列表。
用户:
attributes: {
username: {
type: 'string',
required: true
},
firstname: {
type: 'string',
required: true
},
lastname: {
type: 'string',
required: true
},
email: {
type: 'string',
email: 'true',
required: true,
unique: true
},
buddy: {
collection: "Buddy",
via: "buddyOf"
}
}
好友:
attributes: {
user_id: {
type: 'string'
},
// 0: no friends
// 1: waiting accept
// 2: Cancel friend
statusBuddy: {
type: 'integer'
},
buddyOf: {
model: 'User'
}
}
我想搜索用户显示 3 个按钮状态:
没有好友,等待接受,取消好友
没有尝试过此代码,但也许没有 2 个模型也可以吗?
identity: 'user',
isFriendedBy: {
collection: 'user',
via: 'friendsWith'
},
friendsWith: {
model: 'user'
},
friendshipStatus: 'integer'
我刚用sails.js,不错 我有问题,请帮助我。 我有 2 个集合,它是一对多创建的,我想显示定义了 3 个状态的朋友列表。 用户:
attributes: {
username: {
type: 'string',
required: true
},
firstname: {
type: 'string',
required: true
},
lastname: {
type: 'string',
required: true
},
email: {
type: 'string',
email: 'true',
required: true,
unique: true
},
buddy: {
collection: "Buddy",
via: "buddyOf"
}
}
好友:
attributes: {
user_id: {
type: 'string'
},
// 0: no friends
// 1: waiting accept
// 2: Cancel friend
statusBuddy: {
type: 'integer'
},
buddyOf: {
model: 'User'
}
}
我想搜索用户显示 3 个按钮状态: 没有好友,等待接受,取消好友
没有尝试过此代码,但也许没有 2 个模型也可以吗?
identity: 'user',
isFriendedBy: {
collection: 'user',
via: 'friendsWith'
},
friendsWith: {
model: 'user'
},
friendshipStatus: 'integer'