mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refactor report mutation
This commit is contained in:
parent
bcd60c364d
commit
d2442b73c9
@ -13,6 +13,12 @@ export default {
|
||||
MATCH (submitter:User {id: $submitterId})
|
||||
MATCH (resource {id: $resourceId})
|
||||
WHERE resource:User OR resource:Comment OR resource:Post
|
||||
//CREATE (resource)<-[report:REPORTED {createdAt: $createdAt, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription, closed: false}]-(submitter)
|
||||
MATCH (resource)<-[:FLAGGED]-(case:Case {closed: false})
|
||||
MERGE (resource)<-[:FLAGGED]-(case:Case {closed: false})
|
||||
ON CREATE SET case.id = randomUUID(), case.updatedAt = toString(datetime()), case.createdAt = case.updatedAt, case.disable = true, case.closed = false
|
||||
//WITH submitter, resource
|
||||
CREATE (case)<-[report:REPORTED {createdAt: $createdAt, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription}]-(submitter)
|
||||
CREATE (resource)<-[report:REPORTED {createdAt: $createdAt, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription, closed: false}]-(submitter)
|
||||
RETURN report, submitter, resource, labels(resource)[0] as type
|
||||
`,
|
||||
|
||||
@ -29,10 +29,10 @@ WITH moderator, disabledResource, case
|
||||
//, review
|
||||
//OPTIONAL MATCH (noReporterDisabledResource:User)-[:REPORTED]->(disabledResource)
|
||||
//WHERE noReporterDisabledResource IS NULL
|
||||
OPTIONAL MATCH (:User)-[notExistingReport:REPORTED]->(disabledResource)
|
||||
WHERE notExistingReport IS NULL
|
||||
//MATCH (noReporterDisabledResource:User)
|
||||
//WHERE NOT (noReporterDisabledResource:User)-[:REPORTED]->(disabledResource)
|
||||
//OPTIONAL MATCH (:User)-[notExistingReport:REPORTED]->(disabledResource)
|
||||
//WHERE notExistingReport IS NULL
|
||||
OPTIONAL MATCH (noReporterDisabledResource:User)-[notExistingReport:REPORTED]->(disabledResource)
|
||||
WHERE NOT (noReporterDisabledResource)-[notExistingReport]->(disabledResource)
|
||||
CREATE (moderator)-[addModeratorReport:REPORTED]->(case)
|
||||
SET addModeratorReport.createdAt = toString(datetime()), addModeratorReport.reasonCategory = 'other', addModeratorReport.reasonDescription = 'Old DISABLED relation had no now mandatory report !!! Created automatically to ensure database consistency! Creation date is when the database manipulation happened.'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user