mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
posts and comments created by the factory set the observe relation (#8344)
This commit is contained in:
parent
f782032563
commit
fe7bab4675
@ -175,6 +175,7 @@ Factory.define('post')
|
|||||||
])
|
])
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
post.relateTo(author, 'author'),
|
post.relateTo(author, 'author'),
|
||||||
|
post.relateTo(author, 'observes'),
|
||||||
// Promise.all(categories.map((c) => c.relateTo(post, 'post'))),
|
// Promise.all(categories.map((c) => c.relateTo(post, 'post'))),
|
||||||
Promise.all(tags.map((t) => t.relateTo(post, 'post'))),
|
Promise.all(tags.map((t) => t.relateTo(post, 'post'))),
|
||||||
])
|
])
|
||||||
@ -210,7 +211,11 @@ Factory.define('comment')
|
|||||||
options.author,
|
options.author,
|
||||||
options.post,
|
options.post,
|
||||||
])
|
])
|
||||||
await Promise.all([comment.relateTo(author, 'author'), comment.relateTo(post, 'post')])
|
await Promise.all([
|
||||||
|
comment.relateTo(author, 'author'),
|
||||||
|
comment.relateTo(post, 'post'),
|
||||||
|
post.relateTo(author, 'observes'),
|
||||||
|
])
|
||||||
return comment
|
return comment
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -58,4 +58,15 @@ export default {
|
|||||||
},
|
},
|
||||||
pinned: { type: 'boolean', default: null, valid: [null, true] },
|
pinned: { type: 'boolean', default: null, valid: [null, true] },
|
||||||
postType: { type: 'string', default: 'Article', valid: ['Article', 'Event'] },
|
postType: { type: 'string', default: 'Article', valid: ['Article', 'Event'] },
|
||||||
|
observes: {
|
||||||
|
type: 'relationship',
|
||||||
|
relationship: 'OBSERVES',
|
||||||
|
target: 'User',
|
||||||
|
direction: 'in',
|
||||||
|
properties: {
|
||||||
|
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
|
||||||
|
updatedAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
|
||||||
|
active: { type: 'boolean', default: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,4 +163,15 @@ export default {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
allow: [null],
|
allow: [null],
|
||||||
},
|
},
|
||||||
|
observes: {
|
||||||
|
type: 'relationship',
|
||||||
|
relationship: 'OBSERVES',
|
||||||
|
target: 'Post',
|
||||||
|
direction: 'out',
|
||||||
|
properties: {
|
||||||
|
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
|
||||||
|
updatedAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
|
||||||
|
active: { type: 'boolean', default: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user