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)
|
||||
const { resourceId } = params
|
||||
// Wolle console.log('resourceId: ', resourceId)
|
||||
let { disable, closed } = params
|
||||
const { disable, closed } = params
|
||||
// Wolle console.log('disable: ', disable)
|
||||
const { user: moderator, driver } = context
|
||||
|
||||
let createdRelationshipWithNestedAttributes = null // return value
|
||||
let createdRelationshipWithNestedAttributes = null // return value
|
||||
|
||||
const session = driver.session()
|
||||
try {
|
||||
@ -113,8 +113,7 @@ export default {
|
||||
// cypherClosed +
|
||||
// `RETURN decision, resource, moderator, labels(resource)[0] AS type
|
||||
// `
|
||||
const cypher =
|
||||
`
|
||||
const cypher = `
|
||||
// Wolle only review on reported resources
|
||||
|
||||
MATCH (moderator:User {id: $moderatorId})
|
||||
@ -158,8 +157,7 @@ export default {
|
||||
// }))
|
||||
// })
|
||||
const mutateDecisionWriteTxResultPromise = session.writeTransaction(async txc => {
|
||||
const mutateDecisionTransactionResponse = await txc.run(
|
||||
cypher, {
|
||||
const mutateDecisionTransactionResponse = await txc.run(cypher, {
|
||||
resourceId,
|
||||
moderatorId: moderator.id,
|
||||
createdAt: new Date().toISOString(),
|
||||
|
||||
@ -182,7 +182,9 @@ describe('moderate resources', () => {
|
||||
}
|
||||
const before = { data: { Comment: [{ id: 'comment-id', reviewedByModerator: null }] } }
|
||||
const expected = {
|
||||
data: { Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }] },
|
||||
data: {
|
||||
Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }],
|
||||
},
|
||||
}
|
||||
await expect(
|
||||
query({ query: commentQuery, variables: resourceVariables }),
|
||||
@ -389,7 +391,9 @@ describe('moderate resources', () => {
|
||||
|
||||
it('changes .reviewedByModerator', async () => {
|
||||
const expected = {
|
||||
data: { Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }] },
|
||||
data: {
|
||||
Comment: [{ id: 'comment-id', reviewedByModerator: { id: 'moderator-id' } }],
|
||||
},
|
||||
}
|
||||
|
||||
await expect(
|
||||
|
||||
@ -20,7 +20,7 @@ export default {
|
||||
WITH submitter, resource, caseFolder
|
||||
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,
|
||||
@ -44,7 +44,10 @@ export default {
|
||||
const { submitter, report, caseFolder, resource, type } = txResult[0]
|
||||
createdRelationshipWithNestedAttributes = {
|
||||
...report.properties,
|
||||
caseFolderId: caseFolder.id,
|
||||
caseFolderId: caseFolder.properties.id,
|
||||
caseFolderUpdatedAt: caseFolder.properties.updatedAt,
|
||||
caseFolderDisable: caseFolder.properties.disable,
|
||||
caseFolderClosed: caseFolder.properties.closed,
|
||||
post: null,
|
||||
comment: null,
|
||||
user: null,
|
||||
@ -106,14 +109,14 @@ export default {
|
||||
|
||||
response = []
|
||||
dbResponse.forEach(ele => {
|
||||
const { report, submitter, caseFolder, resource, type, decision, decisionPending } = ele
|
||||
const { report, submitter, caseFolder, resource, type } = ele
|
||||
|
||||
const responseEle = {
|
||||
...report.properties,
|
||||
caseFolderId: caseFolder.id,
|
||||
caseFolderUpdatedAt: caseFolder.updatedAt,
|
||||
caseFolderDisable: caseFolder.disable,
|
||||
caseFolderClosed: caseFolder.closed,
|
||||
caseFolderId: caseFolder.properties.id,
|
||||
caseFolderUpdatedAt: caseFolder.properties.updatedAt,
|
||||
caseFolderDisable: caseFolder.properties.disable,
|
||||
caseFolderClosed: caseFolder.properties.closed,
|
||||
post: null,
|
||||
comment: null,
|
||||
user: null,
|
||||
@ -151,6 +154,6 @@ export default {
|
||||
},
|
||||
},
|
||||
REPORTED: {
|
||||
// Wolle ...undefinedToNullResolver(['decisionUuid', 'decisionAt', 'decisionDisable']),
|
||||
// Wolle ...undefinedToNullResolver(['caseFolderId', 'caseFolderDisable', 'caseFolderUpdatedAt', 'caseFolderClosed']),
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user