[READ-ONLY] Mirror of https://github.com/danielroe/flowers.
1import e from '../../dbschema/edgeql-js'
2
3export default defineEventHandler(async event => {
4 const client = useEdgeDb(event)
5
6 const query = e.select(e.Comment, (comment) => ({
7 text: comment.text,
8 id: true,
9 isCurrent: e.op(comment.author, '=', e.global.current_user),
10 filter: e.op(
11 e.op(comment.public, '=', true),
12 'or',
13 e.op(comment.author, '=', e.global.current_user)
14 )
15 }))
16
17 const comments = await query.run(client)
18 return comments
19})