mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Get frontend runnig with new CaseFolder structure first try
This commit is contained in:
parent
0fdd46b656
commit
6d9e6e7f0a
@ -30,11 +30,11 @@ export default {
|
|||||||
// Wolle console.log('params: ', params)
|
// Wolle console.log('params: ', params)
|
||||||
const { resourceId } = params
|
const { resourceId } = params
|
||||||
// Wolle console.log('resourceId: ', resourceId)
|
// Wolle console.log('resourceId: ', resourceId)
|
||||||
let { disable, closed } = params
|
const { disable, closed } = params
|
||||||
// Wolle console.log('disable: ', disable)
|
// Wolle console.log('disable: ', disable)
|
||||||
const { user: moderator, driver } = context
|
const { user: moderator, driver } = context
|
||||||
|
|
||||||
let createdRelationshipWithNestedAttributes = null // return value
|
let createdRelationshipWithNestedAttributes = null // return value
|
||||||
|
|
||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
try {
|
try {
|
||||||
@ -113,8 +113,7 @@ export default {
|
|||||||
// cypherClosed +
|
// cypherClosed +
|
||||||
// `RETURN decision, resource, moderator, labels(resource)[0] AS type
|
// `RETURN decision, resource, moderator, labels(resource)[0] AS type
|
||||||
// `
|
// `
|
||||||
const cypher =
|
const cypher = `
|
||||||
`
|
|
||||||
// Wolle only review on reported resources
|
// Wolle only review on reported resources
|
||||||
|
|
||||||
MATCH (moderator:User {id: $moderatorId})
|
MATCH (moderator:User {id: $moderatorId})
|
||||||
@ -158,8 +157,7 @@ export default {
|
|||||||
// }))
|
// }))
|
||||||
// })
|
// })
|
||||||
const mutateDecisionWriteTxResultPromise = session.writeTransaction(async txc => {
|
const mutateDecisionWriteTxResultPromise = session.writeTransaction(async txc => {
|
||||||
const mutateDecisionTransactionResponse = await txc.run(
|
const mutateDecisionTransactionResponse = await txc.run(cypher, {
|
||||||
cypher, {
|
|
||||||
resourceId,
|
resourceId,
|
||||||
moderatorId: moderator.id,
|
moderatorId: moderator.id,
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
|
|||||||
@ -182,7 +182,9 @@ describe('moderate resources', () => {
|
|||||||
}
|
}
|
||||||
const before = { data: { Comment: [{ id: 'comment-id', reviewedByModerator: null }] } }
|
const before = { data: { Comment: [{ id: 'comment-id', reviewedByModerator: null }] } }
|
||||||
const expected = {
|
const expected = {
|
||||||
data: { Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }] },
|
data: {
|
||||||
|
Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
await expect(
|
await expect(
|
||||||
query({ query: commentQuery, variables: resourceVariables }),
|
query({ query: commentQuery, variables: resourceVariables }),
|
||||||
@ -389,7 +391,9 @@ describe('moderate resources', () => {
|
|||||||
|
|
||||||
it('changes .reviewedByModerator', async () => {
|
it('changes .reviewedByModerator', async () => {
|
||||||
const expected = {
|
const expected = {
|
||||||
data: { Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }] },
|
data: {
|
||||||
|
Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export default {
|
|||||||
WITH submitter, resource, caseFolder
|
WITH submitter, resource, caseFolder
|
||||||
CREATE (caseFolder)<-[report:REPORTED {createdAt: $createdAt, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription}]-(submitter)
|
CREATE (caseFolder)<-[report:REPORTED {createdAt: $createdAt, reasonCategory: $reasonCategory, reasonDescription: $reasonDescription}]-(submitter)
|
||||||
|
|
||||||
RETURN submitter, report, caseFolder {.id}, resource, labels(resource)[0] AS type
|
RETURN submitter, report, caseFolder, resource, labels(resource)[0] AS type
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
resourceId,
|
resourceId,
|
||||||
@ -44,7 +44,10 @@ export default {
|
|||||||
const { submitter, report, caseFolder, resource, type } = txResult[0]
|
const { submitter, report, caseFolder, resource, type } = txResult[0]
|
||||||
createdRelationshipWithNestedAttributes = {
|
createdRelationshipWithNestedAttributes = {
|
||||||
...report.properties,
|
...report.properties,
|
||||||
caseFolderId: caseFolder.id,
|
caseFolderId: caseFolder.properties.id,
|
||||||
|
caseFolderUpdatedAt: caseFolder.properties.updatedAt,
|
||||||
|
caseFolderDisable: caseFolder.properties.disable,
|
||||||
|
caseFolderClosed: caseFolder.properties.closed,
|
||||||
post: null,
|
post: null,
|
||||||
comment: null,
|
comment: null,
|
||||||
user: null,
|
user: null,
|
||||||
@ -106,14 +109,14 @@ export default {
|
|||||||
|
|
||||||
response = []
|
response = []
|
||||||
dbResponse.forEach(ele => {
|
dbResponse.forEach(ele => {
|
||||||
const { report, submitter, caseFolder, resource, type, decision, decisionPending } = ele
|
const { report, submitter, caseFolder, resource, type } = ele
|
||||||
|
|
||||||
const responseEle = {
|
const responseEle = {
|
||||||
...report.properties,
|
...report.properties,
|
||||||
caseFolderId: caseFolder.id,
|
caseFolderId: caseFolder.properties.id,
|
||||||
caseFolderUpdatedAt: caseFolder.updatedAt,
|
caseFolderUpdatedAt: caseFolder.properties.updatedAt,
|
||||||
caseFolderDisable: caseFolder.disable,
|
caseFolderDisable: caseFolder.properties.disable,
|
||||||
caseFolderClosed: caseFolder.closed,
|
caseFolderClosed: caseFolder.properties.closed,
|
||||||
post: null,
|
post: null,
|
||||||
comment: null,
|
comment: null,
|
||||||
user: null,
|
user: null,
|
||||||
@ -151,6 +154,6 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
REPORTED: {
|
REPORTED: {
|
||||||
// Wolle ...undefinedToNullResolver(['decisionUuid', 'decisionAt', 'decisionDisable']),
|
// Wolle ...undefinedToNullResolver(['caseFolderId', 'caseFolderDisable', 'caseFolderUpdatedAt', 'caseFolderClosed']),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user