Skip to content

Commit

Permalink
updated to fix issue sending review response
Browse files Browse the repository at this point in the history
  • Loading branch information
ARADDCC002 committed Jun 11, 2024
1 parent d3c3cb6 commit 1cc88aa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions backend/src/services/accessRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Validator } from 'jsonschema'
import { Types } from 'mongoose'

import authentication from '../connectors/authentication/index.js'
import { AccessRequestAction } from '../connectors/authorisation/actions.js'
Expand Down Expand Up @@ -144,10 +145,10 @@ export async function newAccessRequestComment(user: UserInterface, accessRequest
}

const commentResponse = new ResponseModel({
user: toEntity('user', user.dn),
entity: toEntity('user', user.dn),
kind: ResponseKind.Comment,
comment: message,
parentId: accessRequest._id,
parentId: accessRequest._id as Types.ObjectId,
createdAt: new Date().toISOString(),
})

Expand Down
2 changes: 1 addition & 1 deletion backend/src/services/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export async function newReleaseComment(user: UserInterface, modelId: string, se

// Store the response
const commentResponse = new ResponseModel({
user: toEntity('user', user.dn),
entity: toEntity('user', user.dn),
kind: ResponseKind.Comment,
comment,
createdAt: new Date().toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion backend/src/services/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function respondToReview(

// Store the response
const reviewResponse = new ResponseModel({
user: toEntity('user', user.dn),
entity: toEntity('user', user.dn),
kind: ResponseKind.Review,
role,
parentId: review._id,
Expand Down
2 changes: 1 addition & 1 deletion backend/test/services/release.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ describe('services > release', () => {

await newReleaseComment({} as any, 'model', '1.0.0', 'This is a new comment')

expect(releaseModelMocks.findOneAndUpdate).toBeCalled()
expect(responseModelMock.save).toBeCalled()
})

test('newReleaseComment > should throw bad request when attempting to create a release comment on a mirrored model', async () => {
Expand Down

0 comments on commit 1cc88aa

Please sign in to comment.