mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
count clicks on posts setup
This commit is contained in:
parent
dabc36d1b3
commit
7bbdd5852f
@ -15,6 +15,7 @@ import hashtags from './hashtags/hashtagsMiddleware'
|
|||||||
import email from './email/emailMiddleware'
|
import email from './email/emailMiddleware'
|
||||||
import sentry from './sentryMiddleware'
|
import sentry from './sentryMiddleware'
|
||||||
import languages from './languages/languages'
|
import languages from './languages/languages'
|
||||||
|
import userInteractions from './userInteractions'
|
||||||
|
|
||||||
export default (schema) => {
|
export default (schema) => {
|
||||||
const middlewares = {
|
const middlewares = {
|
||||||
@ -32,6 +33,7 @@ export default (schema) => {
|
|||||||
includedFields,
|
includedFields,
|
||||||
orderBy,
|
orderBy,
|
||||||
languages,
|
languages,
|
||||||
|
userInteractions,
|
||||||
}
|
}
|
||||||
|
|
||||||
let order = [
|
let order = [
|
||||||
@ -40,6 +42,7 @@ export default (schema) => {
|
|||||||
'xss',
|
'xss',
|
||||||
// 'activityPub', disabled temporarily
|
// 'activityPub', disabled temporarily
|
||||||
'validation',
|
'validation',
|
||||||
|
'userInteractions',
|
||||||
'sluggify',
|
'sluggify',
|
||||||
'languages',
|
'languages',
|
||||||
'excerpt',
|
'excerpt',
|
||||||
|
|||||||
14
backend/src/middleware/userInteractions.js
Normal file
14
backend/src/middleware/userInteractions.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
const userClickedPost = async (resolve, root, args, context, info) => {
|
||||||
|
if (args.id) {
|
||||||
|
console.log('post clicked--', args.id)
|
||||||
|
}
|
||||||
|
return resolve(root, args, context, info)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
Query: {
|
||||||
|
Post: userClickedPost,
|
||||||
|
},
|
||||||
|
}
|
||||||
@ -337,6 +337,7 @@ export default {
|
|||||||
shoutedCount:
|
shoutedCount:
|
||||||
'<-[:SHOUTED]-(related:User) WHERE NOT related.deleted = true AND NOT related.disabled = true',
|
'<-[:SHOUTED]-(related:User) WHERE NOT related.deleted = true AND NOT related.disabled = true',
|
||||||
emotionsCount: '<-[related:EMOTED]-(:User)',
|
emotionsCount: '<-[related:EMOTED]-(:User)',
|
||||||
|
clickedCount: '<-[related:CLICKED]-(:User)',
|
||||||
},
|
},
|
||||||
boolean: {
|
boolean: {
|
||||||
shoutedByCurrentUser:
|
shoutedByCurrentUser:
|
||||||
|
|||||||
@ -156,6 +156,10 @@ type Post {
|
|||||||
statement: "MATCH (this)<-[:SHOUTED]-(u:User {id: $cypherParams.currentUserId}) RETURN COUNT(u) >= 1"
|
statement: "MATCH (this)<-[:SHOUTED]-(u:User {id: $cypherParams.currentUserId}) RETURN COUNT(u) >= 1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
clickedCount: Int!
|
||||||
|
@cypher(
|
||||||
|
statement: "MATCH (this)<-[:CLICKED]-(r:User) WHERE NOT r.deleted = true AND NOT r.disabled = true RETURN COUNT(DISTINCT r)"
|
||||||
|
)
|
||||||
emotions: [EMOTED]
|
emotions: [EMOTED]
|
||||||
emotionsCount: Int!
|
emotionsCount: Int!
|
||||||
@cypher(statement: "MATCH (this)<-[emoted:EMOTED]-(:User) RETURN COUNT(DISTINCT emoted)")
|
@cypher(statement: "MATCH (this)<-[emoted:EMOTED]-(:User) RETURN COUNT(DISTINCT emoted)")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user