Implement enum for report reason categories after Matts suggestion

This commit is contained in:
Wolfgang Huß 2019-10-14 15:53:36 +02:00
parent 19facb22a9
commit 6365d3df54
3 changed files with 16 additions and 4 deletions

View File

@ -1,6 +1,6 @@
export default {
Mutation: {
report: async (_parent, params, { driver, _req, user }, _resolveInfo) => {
report: async (_parent, params, { driver, user }, _resolveInfo) => {
const { resourceId, reasonCategory, reasonDescription } = params
const session = driver.session()
@ -85,7 +85,7 @@ export default {
},
},
Query: {
reports: async (_parent, _params, { driver, _req, _user }, _resolveInfo) => {
reports: async (_parent, _params, { driver }, _resolveInfo) => {
const session = driver.session()
const res = await session.run(
`
@ -113,7 +113,6 @@ export default {
const responseEle = {
...report.properties,
resource: resource.properties,
resourceId: resource.properties.id,
post: null,
comment: null,

View File

@ -1,6 +1,6 @@
type REPORTED {
createdAt: String
reasonCategory: String
reasonCategory: ReasonCategory
reasonDescription: String
submitter: User
@cypher(statement: "MATCH (resource)<-[:REPORTED]-(user:User) RETURN user")
@ -16,6 +16,18 @@ type REPORTED {
comment: Comment
}
# list see "reportReasonCategoriesDatabaseList" in shared file "shared/moderation/report.js"
enum ReasonCategory {
other
discrimination-etc
pornographic-content-links
glorific-trivia-of-cruel-inhuman-acts
doxing
intentional-intimidation-stalking-persecution
advert-products-services-commercial
criminal-behavior-violation-german-law
}
# not yet supported
# union ReportReource = User | Post | Comment

View File

@ -1,4 +1,5 @@
export const reportReasonCategoriesDatabaseList = () => {
// list see "ReasonCategory" in backend GraphQL schema file "REPORTED.gql"
return [
'other', // element # zero, because it is the nutral one
'discrimination-etc',