🎨 Add Relation and Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9888

This commit is contained in:
Daniel 2023-12-23 19:57:50 +08:00
parent 204398fa52
commit dffcc2865b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -785,17 +785,16 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
}
destAdded := false
for _, keyValues := range destAv.KeyValues {
if keyValues.Key.ID == operation.BackRelationKeyID {
keyValues.Key.Relation = &av.Relation{
AvID: operation.AvID,
IsTwoWay: operation.IsTwoWay,
BackKeyID: operation.KeyID,
}
destAdded = true
break
backRelKey, _ := destAv.GetKey(operation.BackRelationKeyID)
if nil != backRelKey {
backRelKey.Relation = &av.Relation{
AvID: operation.AvID,
IsTwoWay: operation.IsTwoWay,
BackKeyID: operation.KeyID,
}
destAdded = true
}
if !destAdded {
destAv.KeyValues = append(destAv.KeyValues, &av.KeyValues{
Key: &av.Key{
@ -813,6 +812,7 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
}
if !isSameAv {
err = av.SaveAttributeView(destAv)
util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": destAv.ID})
}
return
}