mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Update to return resource instead of to
- more verbose makes it easier to understand
This commit is contained in:
parent
e6fdb70a07
commit
21be2c08ba
@ -2,7 +2,7 @@ const transformReturnType = record => {
|
|||||||
return {
|
return {
|
||||||
...record.get('review').properties,
|
...record.get('review').properties,
|
||||||
report: record.get('report').properties,
|
report: record.get('report').properties,
|
||||||
to: {
|
resource: {
|
||||||
__typename: record.get('type'),
|
__typename: record.get('type'),
|
||||||
...record.get('resource').properties,
|
...record.get('resource').properties,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const reviewMutation = gql`
|
|||||||
review(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
review(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
to {
|
resource {
|
||||||
__typename
|
__typename
|
||||||
... on User {
|
... on User {
|
||||||
id
|
id
|
||||||
@ -149,7 +149,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Post', id: 'should-i-be-disabled', disabled: false },
|
resource: { __typename: 'Post', id: 'should-i-be-disabled', disabled: false },
|
||||||
report: { id: expect.any(String), closed: true },
|
report: { id: expect.any(String), closed: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -231,7 +231,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'Comment', id: 'comment-id' } } },
|
data: { review: { resource: { __typename: 'Comment', id: 'comment-id' } } },
|
||||||
errors: undefined,
|
errors: undefined,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -242,7 +242,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Comment', id: 'comment-id' },
|
resource: { __typename: 'Comment', id: 'comment-id' },
|
||||||
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -253,7 +253,9 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'Comment', id: 'comment-id', disabled: true } } },
|
data: {
|
||||||
|
review: { resource: { __typename: 'Comment', id: 'comment-id', disabled: true } },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -267,7 +269,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Comment', id: 'comment-id' },
|
resource: { __typename: 'Comment', id: 'comment-id' },
|
||||||
report: { id: expect.any(String), closed: true },
|
report: { id: expect.any(String), closed: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -301,7 +303,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Post', id: 'post-id' },
|
resource: { __typename: 'Post', id: 'post-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -313,7 +315,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Post', id: 'post-id' },
|
resource: { __typename: 'Post', id: 'post-id' },
|
||||||
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -324,7 +326,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'Post', id: 'post-id', disabled: true } } },
|
data: { review: { resource: { __typename: 'Post', id: 'post-id', disabled: true } } },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -338,7 +340,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Post', id: 'post-id' },
|
resource: { __typename: 'Post', id: 'post-id' },
|
||||||
report: { id: expect.any(String), closed: true },
|
report: { id: expect.any(String), closed: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -370,7 +372,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'User', id: 'user-id' } } },
|
data: { review: { resource: { __typename: 'User', id: 'user-id' } } },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -380,7 +382,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'User', id: 'user-id' },
|
resource: { __typename: 'User', id: 'user-id' },
|
||||||
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -391,7 +393,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
mutate({ mutation: reviewMutation, variables: disableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'User', id: 'user-id', disabled: true } } },
|
data: { review: { resource: { __typename: 'User', id: 'user-id', disabled: true } } },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -405,7 +407,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'User', id: 'user-id' },
|
resource: { __typename: 'User', id: 'user-id' },
|
||||||
report: { id: expect.any(String), closed: true },
|
report: { id: expect.any(String), closed: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -503,7 +505,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'Comment', id: 'comment-id' } } },
|
data: { review: { resource: { __typename: 'Comment', id: 'comment-id' } } },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -513,7 +515,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Comment', id: 'comment-id' },
|
resource: { __typename: 'Comment', id: 'comment-id' },
|
||||||
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -525,7 +527,7 @@ describe('moderate resources', () => {
|
|||||||
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: { to: { __typename: 'Comment', id: 'comment-id', disabled: false } },
|
review: { resource: { __typename: 'Comment', id: 'comment-id', disabled: false } },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -563,7 +565,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'Post', id: 'post-id' } } },
|
data: { review: { resource: { __typename: 'Post', id: 'post-id' } } },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -573,7 +575,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'Post', id: 'post-id' },
|
resource: { __typename: 'Post', id: 'post-id' },
|
||||||
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -584,7 +586,9 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'Post', id: 'post-id', disabled: false } } },
|
data: {
|
||||||
|
review: { resource: { __typename: 'Post', id: 'post-id', disabled: false } },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -620,7 +624,7 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'User', id: 'user-id' } } },
|
data: { review: { resource: { __typename: 'User', id: 'user-id' } } },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -630,7 +634,7 @@ describe('moderate resources', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
review: {
|
review: {
|
||||||
to: { __typename: 'User', id: 'user-id' },
|
resource: { __typename: 'User', id: 'user-id' },
|
||||||
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
report: { id: expect.any(String), reviewedByModerator: { id: 'moderator-id' } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -641,7 +645,9 @@ describe('moderate resources', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
mutate({ mutation: reviewMutation, variables: enableVariables }),
|
||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: { review: { to: { __typename: 'User', id: 'user-id', disabled: false } } },
|
data: {
|
||||||
|
review: { resource: { __typename: 'User', id: 'user-id', disabled: false } },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const transformReturnType = record => {
|
const transformReturnType = record => {
|
||||||
return {
|
return {
|
||||||
...record.get('report').properties,
|
...record.get('report').properties,
|
||||||
to: {
|
resource: {
|
||||||
__typename: record.get('type'),
|
__typename: record.get('type'),
|
||||||
...record.get('resource').properties,
|
...record.get('resource').properties,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -23,7 +23,7 @@ describe('file a report on a resource', () => {
|
|||||||
updatedAt
|
updatedAt
|
||||||
disable
|
disable
|
||||||
closed
|
closed
|
||||||
to {
|
resource {
|
||||||
__typename
|
__typename
|
||||||
... on User {
|
... on User {
|
||||||
name
|
name
|
||||||
@ -164,7 +164,7 @@ describe('file a report on a resource', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
fileReport: {
|
fileReport: {
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'User',
|
__typename: 'User',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -182,7 +182,7 @@ describe('file a report on a resource', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
fileReport: {
|
fileReport: {
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'User',
|
__typename: 'User',
|
||||||
name: 'abusive-user',
|
name: 'abusive-user',
|
||||||
},
|
},
|
||||||
@ -346,7 +346,7 @@ describe('file a report on a resource', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
fileReport: {
|
fileReport: {
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'Post',
|
__typename: 'Post',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -367,7 +367,7 @@ describe('file a report on a resource', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
fileReport: {
|
fileReport: {
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'Post',
|
__typename: 'Post',
|
||||||
title: 'This is a post that is going to be reported',
|
title: 'This is a post that is going to be reported',
|
||||||
},
|
},
|
||||||
@ -408,7 +408,7 @@ describe('file a report on a resource', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
fileReport: {
|
fileReport: {
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'Comment',
|
__typename: 'Comment',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -429,7 +429,7 @@ describe('file a report on a resource', () => {
|
|||||||
).resolves.toMatchObject({
|
).resolves.toMatchObject({
|
||||||
data: {
|
data: {
|
||||||
fileReport: {
|
fileReport: {
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'Comment',
|
__typename: 'Comment',
|
||||||
content: 'Post comment to be reported.',
|
content: 'Post comment to be reported.',
|
||||||
},
|
},
|
||||||
@ -475,7 +475,7 @@ describe('file a report on a resource', () => {
|
|||||||
updatedAt
|
updatedAt
|
||||||
disable
|
disable
|
||||||
closed
|
closed
|
||||||
to {
|
resource {
|
||||||
__typename
|
__typename
|
||||||
... on User {
|
... on User {
|
||||||
id
|
id
|
||||||
@ -610,7 +610,7 @@ describe('file a report on a resource', () => {
|
|||||||
updatedAt: expect.any(String),
|
updatedAt: expect.any(String),
|
||||||
disable: false,
|
disable: false,
|
||||||
closed: false,
|
closed: false,
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'User',
|
__typename: 'User',
|
||||||
id: 'abusive-user-1',
|
id: 'abusive-user-1',
|
||||||
},
|
},
|
||||||
@ -631,7 +631,7 @@ describe('file a report on a resource', () => {
|
|||||||
updatedAt: expect.any(String),
|
updatedAt: expect.any(String),
|
||||||
disable: false,
|
disable: false,
|
||||||
closed: false,
|
closed: false,
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'Post',
|
__typename: 'Post',
|
||||||
id: 'abusive-post-1',
|
id: 'abusive-post-1',
|
||||||
},
|
},
|
||||||
@ -652,7 +652,7 @@ describe('file a report on a resource', () => {
|
|||||||
updatedAt: expect.any(String),
|
updatedAt: expect.any(String),
|
||||||
disable: false,
|
disable: false,
|
||||||
closed: false,
|
closed: false,
|
||||||
to: {
|
resource: {
|
||||||
__typename: 'Comment',
|
__typename: 'Comment',
|
||||||
id: 'abusive-comment-1',
|
id: 'abusive-comment-1',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,9 +17,6 @@ enum ReasonCategory {
|
|||||||
criminal_behavior_violation_german_law
|
criminal_behavior_violation_german_law
|
||||||
}
|
}
|
||||||
|
|
||||||
# not yet supported
|
|
||||||
# union ReportResource = User | Post | Comment
|
|
||||||
|
|
||||||
enum ReportOrdering {
|
enum ReportOrdering {
|
||||||
createdAt_asc
|
createdAt_asc
|
||||||
createdAt_desc
|
createdAt_desc
|
||||||
|
|||||||
@ -7,7 +7,7 @@ type REVIEWED {
|
|||||||
# @cypher(statement: "MATCH (report:Report)<-[this:REVIEWED]-(:User) RETURN report")
|
# @cypher(statement: "MATCH (report:Report)<-[this:REVIEWED]-(:User) RETURN report")
|
||||||
moderator: User
|
moderator: User
|
||||||
type: String
|
type: String
|
||||||
to: ReviewedResource
|
resource: ReviewedResource
|
||||||
}
|
}
|
||||||
union ReviewedResource = User | Post | Comment
|
union ReviewedResource = User | Post | Comment
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ type Report {
|
|||||||
disable: Boolean!
|
disable: Boolean!
|
||||||
closed: Boolean!
|
closed: Boolean!
|
||||||
reportsFiled: [FILED]
|
reportsFiled: [FILED]
|
||||||
to: ReportedResource
|
resource: ReportedResource
|
||||||
type: String
|
type: String
|
||||||
reviewedByModerator: User
|
reviewedByModerator: User
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export const reportListQuery = () => {
|
|||||||
updatedAt
|
updatedAt
|
||||||
disable
|
disable
|
||||||
closed
|
closed
|
||||||
to {
|
resource {
|
||||||
__typename
|
__typename
|
||||||
... on User {
|
... on User {
|
||||||
id
|
id
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user