generated from 8iq/nodejs-hackathon-boilerplate-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(condo): DOMA-5956 offline status change history (#3233)
* feat(condo): DOMA-6681 added TicketMultipleUpdateService * feat(condo): DOMA-5956 added actualCreationDate to TicketChange * feat(condo): DOMA-5956 display ticket status change with actualCreationDate * feat(condo): DOMA-6762 discard not valid status transitions in ticketMultipleUpdate * fix(condo): DOMA-5956 set actualCreationDate to all TicketChanges, sort ticket changes by actualCreationDate in ticket card
- Loading branch information
1 parent
0236b4c
commit 14af11b
Showing
17 changed files
with
875 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
apps/condo/domains/ticket/access/TicketMultipleUpdateService.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Generated by `createservice ticket.TicketMultipleUpdateService --type mutations` | ||
*/ | ||
const get = require('lodash/get') | ||
|
||
const { throwAuthenticationError } = require('@open-condo/keystone/apolloErrorFormatter') | ||
const { getById } = require('@open-condo/keystone/schema') | ||
|
||
const { checkPermissionInUserOrganizationOrRelatedOrganization } = require('@condo/domains/organization/utils/accessSchema') | ||
|
||
async function canTicketMultipleUpdate (data) { | ||
const { authentication: { item: user } } = data | ||
|
||
if (!user) return throwAuthenticationError() | ||
if (user.deletedAt) return false | ||
if (user.isAdmin || user.isSupport) return true | ||
|
||
const ticketId = get(data, 'args.data.id') | ||
if (!ticketId) return false | ||
|
||
const ticket = await getById('Ticket', ticketId) | ||
|
||
return await checkPermissionInUserOrganizationOrRelatedOrganization(user.id, ticket.organization, 'canManageTickets') | ||
} | ||
|
||
/* | ||
Rules are logical functions that used for list access, and may return a boolean (meaning | ||
all or no items are available) or a set of filters that limit the available items. | ||
*/ | ||
module.exports = { | ||
canTicketMultipleUpdate, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.