This commit is contained in:
parent
0b6fb70f28
commit
a0fee6ad50
|
@ -46,7 +46,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions);
|
||||
await models.Ticket.isEditableOrThrow(ctx, id, myOptions);
|
||||
|
||||
const item = await models.Item.findById(itemId, null, myOptions);
|
||||
const ticket = await models.Ticket.findById(id, {
|
||||
|
|
|
@ -115,7 +115,7 @@ module.exports = Self => {
|
|||
const userId = ctx.req.accessToken.userId;
|
||||
const models = Self.app.models;
|
||||
const $t = ctx.req.__; // $translate
|
||||
const isEditable = await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions);
|
||||
await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions);
|
||||
|
||||
const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE');
|
||||
if (!editZone) {
|
||||
|
|
|
@ -70,7 +70,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const isEditable = await Self.isEditableOrThrow(ctx, args.id, myOptions);
|
||||
await Self.isEditableOrThrow(ctx, args.id, myOptions);
|
||||
|
||||
const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE');
|
||||
if (!editZone) {
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions);
|
||||
await Self.isEditableOrThrow(ctx, id, myOptions);
|
||||
|
||||
const recalculation = await Self.rawSql('CALL vn.ticket_recalcComponents(?, NULL)', [id], myOptions);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
const ticketToDelete = await models.Ticket.findById(id, {fields: ['isDeleted']}, myOptions);
|
||||
if (ticketToDelete.isDeleted) return false;
|
||||
|
||||
const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions);
|
||||
await Self.isEditableOrThrow(ctx, id, myOptions);
|
||||
|
||||
// Check if ticket has refunds
|
||||
const ticketRefunds = await models.TicketRefund.find({
|
||||
|
|
|
@ -65,13 +65,9 @@ describe('ticket isEditableOrThrow()', () => {
|
|||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
|
||||
const result = await models.Ticket.isEditableOrThrow(ctx, 15, options);
|
||||
|
||||
expect(result).toEqual(false);
|
||||
|
||||
await models.Ticket.isEditableOrThrow(ctx, 15, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions);
|
||||
await Self.isEditableOrThrow(ctx, id, myOptions);
|
||||
|
||||
const ticket = await models.Ticket.findById(
|
||||
id,
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions);
|
||||
await models.Ticket.isEditableOrThrow(ctx, id, myOptions);
|
||||
|
||||
if (ticketId) {
|
||||
const isReceiverEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions);
|
||||
|
|
Loading…
Reference in New Issue